Skip to main content
18 events
when toggle format what by license comment
Aug 25, 2015 at 7:37 history edited auxsvr CC BY-SA 3.0
Added question about the cache
Aug 22, 2015 at 17:28 history edited auxsvr CC BY-SA 3.0
edited title
Aug 22, 2015 at 17:23 comment added auxsvr @PatrickStevens Thanks!
Aug 22, 2015 at 17:22 history edited auxsvr CC BY-SA 3.0
Added a solution for the third example
Aug 22, 2015 at 16:56 comment added Patrick Stevens @auxsvr Use InputForm or FullForm to see enough of the internal form of something that you can use Part or Extract on it.
Aug 21, 2015 at 19:48 history edited auxsvr CC BY-SA 3.0
added 335 characters in body
Aug 19, 2015 at 0:48 answer added Simon Rochester timeline score: 2
Aug 18, 2015 at 23:33 history edited auxsvr CC BY-SA 3.0
Added another example
Aug 18, 2015 at 18:39 comment added auxsvr @Guesswhoitis. @MichaelE2, Is there a way to see what parts of Piecewise I need to access in order to form the list? I'm asking because via trial and error I got y[[2,1,1,1]] for the first part of the second element of a list with Piecewise results and y[[3,2]] for the second part of the third element.
Aug 16, 2015 at 19:13 comment added auxsvr For future reference: I had to work around this by creating a list, selecting the appropriate results with Part.
Aug 16, 2015 at 11:38 comment added Michael E2 I was responding to your query, "Doesn't this explanation assume a specific order of reading the result?" The answer is yes. I don't know what you mean to imply by citing "the default for val is 0." In both cases above, a specific expression is supplied for val. The docs describe val thus: "Piecewise uses default value val if none of the Subscript[cond, i] apply." To make things confusing, it goes on to indicate the "default for val" -- i.e. the default for the default. (I was not addressing your principal question. Sorry for the confusion.)
Aug 16, 2015 at 7:20 comment added auxsvr @MichaelE2 According to the documentation, the default for val is 0, which is not the case here. The second conditional of the second result is only valid in the case $\sin(x)<0$ and $a^2(a^2+q^2−2mr()+r^2)\sin^2(x)\leq (a^2+r()^2)^2$, which is not the result Mathematica returns!
Aug 13, 2015 at 12:08 comment added Michael E2 According to the documentation for Piecewise, the conditions are evaluated in order, until one evaluates to True; the value displayed with the condition True is in fact the default value val (where val is the term in the docs). (The last value displayed will always be the default and be accompanied by True.)
Aug 13, 2015 at 10:39 comment added auxsvr Actually, "true" cannot mean "otherwise", because in the second conditional of the second result this explanation is wrong!
Aug 13, 2015 at 10:38 comment added J. M.'s missing motivation Sometimes, Mathematica finds it convenient to return piecewise results; in your case, the "specific order" seems to be quite apparent: "first result if the first condition is met, and the second result otherwise".
Aug 13, 2015 at 10:36 comment added auxsvr Doesn't this explanation assume a specific order of reading the result? Is this standard behaviour in Mathematica?
Aug 13, 2015 at 10:29 comment added J. M.'s missing motivation "What does the True conditional mean?" - it's what we often refer to as the "otherwise" case for piecewise-defined functions.
Aug 13, 2015 at 10:25 history asked auxsvr CC BY-SA 3.0