Skip to main content

Timeline for Hold expression with RandomInteger

Current License: CC BY-SA 3.0

14 events
when toggle format what by license comment
Sep 6, 2013 at 18:55 comment added Mr.Wizard @Blackbird That gets pretty complicated because of the internal format of those expressions. Basically Mathematica doesn't really use that format: it's purely for input. I need to leave for the day but at another time when we are both here perhaps you would post a question asking about these so that I may answer with more room than comments provide.
Sep 6, 2013 at 18:53 comment added Pankaj Sejwal @Mr.Wizard : yes yes the same.
Sep 6, 2013 at 18:51 comment added Mr.Wizard @Blackbird Again, do you mean e.g. a - b - c - d and a / b / c / d or something else?
Sep 6, 2013 at 18:50 comment added Pankaj Sejwal @Mr.Wizard : well if OP had requested for a Divide or Subtract operator between the operands than how you can modify this post with somewhat similar syntactic approach.
Sep 6, 2013 at 18:40 comment added Mr.Wizard @Blackbird I can answer that with one of my favorite retorts: "It works, just not the way you think it does." Hold[-x] // FullForm shows that -x parses as Times[-1, x], so if you want to multiply and then negate arguments it will work fine. :^) I'm not sure what you tried with for Divide but I figure something like 1/x which parses as Times[1, Power[x, -1]]. That's even stranger as now you will have a power tower ending in -1. Incidentally what multiple-argument form of subtract and divide were you aiming for? I mean, did you want a - b - c - d for example?
Sep 6, 2013 at 18:34 comment added Pankaj Sejwal @Mr.Wizard: Ya there is and I am increasing it as well..:p actually one more question , is it possible to write such a short notation for Subtract and Divide, because it doesn't seem to work.
Sep 6, 2013 at 18:28 comment added Mr.Wizard @Blackbird Oh s#!t, there's a quota on those now? :o)
Sep 6, 2013 at 18:26 comment added Pankaj Sejwal @Mr.Wizard:thanks for replying, I thought I have already finished my quota of stupid questions for today.
Sep 6, 2013 at 18:22 comment added Mr.Wizard @Blackbird It is not directly documented that I know of, but it comes from an understanding of Mathematica's parsing. +x parses as Plus[x] as can be seen with Hold[+x] // FullForm. So +## is Plus[##] and then it's just a matter of SlotSequence which is directly documented. As a second example 1 x parses as Times[1, x] so we can use 1 ## as shorthand for multiplying arguments.
Sep 6, 2013 at 17:37 comment added Mr.Wizard @ybeltukov I'm glad you appreciate it. Thanks for the vote.
Sep 6, 2013 at 17:33 comment added ybeltukov Great! Your solution is very compact and can be generalized to any numbers of terms, +1 :)
Sep 6, 2013 at 17:21 comment added Mr.Wizard @rcollyer Yes, it's a favorite of mine, thank-you-very-much. :D
Sep 6, 2013 at 17:16 comment added rcollyer The form +## rates highly on my weirdo meter. Weirdo. BTW, +1. :)
Sep 6, 2013 at 17:09 history answered Mr.Wizard CC BY-SA 3.0