Thanks a lot, John! (and sorry for the delay in answering) I see the point: it is simply undefined.
But I do not quite agree with you in that "[one] would not expect a computer algebra system to give the same answers with simple substitutions in the two orders": ideally, I would expect that the answer to substituting x=1 is something like "undefined", since it is so. But I don't know if that is possible in Sage right now. Cheers, Jesús 2014-07-21 16:44 GMT+02:00 John Cremona <john.crem...@gmail.com>: > The expression y = (1-x)/(1-x*cos(t)) is, as given, undefined whenever > x*cos(t)=1, for example at (x,t)=(1,0). > > When x=1 it simplifies to 0/(1-cos(t)), which equals 0 except where > cos(t)=1 where it is undefined but has a limiting value of 0. > > When t=0 it simplfies to (1-x)/(1-x), which equals 1 except when x=1 > where it is undefined, but has a limiting value of 1. > > So you get different limits when first x -> 1 and then t->0 compared > with first t->0 and then x->1. The function has no continuous > extension to (x,t)=(1,0). Hence I would not expect a computer algebra > system to give the same answers with simple substitutions in the two > orders. > > On 21 July 2014 15:14, kcrisman <kcris...@gmail.com> wrote: >>> Hi guys, >>> >>> This is so simple that probably someone else has already noticed it, but >>> just in case: >>> >>> sage: x,t = var('x,t') >>> sage: f = (1-x)/(1-x*cos(t)) >>> sage: f(x=1) >>> 0 >>> sage: f(t=0)(x=1) >>> 1 >>> >> >> My guess is that this is more of a convention than anything else. >> >> sage: x/x >> 1 >> sage: 0/x >> 0 >> >> Maxima: >> (%i1) x/x; >> (%o1) 1 >> (%i2) 0/x; >> (%o2) 0 >> >> If Mma and Maple do it too, that would be my guess. In any case, it is >> 'known' and I bet you'll find other examples with a search of the email >> lists (though searching for x/x might be hard!). It's possible to not >> immediately do such reductions >> >> sage: x.mul(1/x,hold=True) >> x/x >> >> but I'm not sure how to combine that with the substitution that you are >> doing. >> >> - kcrisman >> >>> The second one is, of course, the correct answer. (FYI, Mathematica9 >>> fails, too.) >>> >>> Wouldn't the first one return some sort of conditional expression: "if t=0 >>> then 1, else 0" >>> >>> I would be happy to help in the debugging, if I can get some indication of >>> what is running in the background, i.e. what function is called when one >>> does the substitution "f(x=1)". >>> >>> Cheers, >>> Jesús Torrado >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-support" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-support+unsubscr...@googlegroups.com. >> To post to this group, send email to sage-support@googlegroups.com. >> Visit this group at http://groups.google.com/group/sage-support. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "sage-support" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sage-support/Gxaui0CAzCM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.