Thank you for all the replies. Re: William Stein I found substitute_function() useful for other purposes, but it wasn't useful in this case since I didn't want to replace all instances of arctan2, just the subset where the first parameter was 0.
Re: Burcin Erocal Your substitution worked admirably well. It simplified everything in a snap. Thank you. Re: kcrisman After having fixed everything using Burcin's suggestion your post made me realize the folly of this simplification. You're right about the definition of arctan2. As you mentioned, the documentation instructed me that arctan2(y,x)=arctan(y/x) and so I thought that arctan2(0,x) would always equal 0. A little more reading reveals that this is wrong. Thanks for pointing this out. On Dec 5, 9:42 pm, kcrisman <[email protected]> wrote: > On Dec 5, 6:15 am, Burcin Erocal <[email protected]> wrote: > > > > > > > On Sat, 5 Dec 2009 03:32:04 -0500 > > > William Stein <[email protected]> wrote: > > > On Fri, Dec 4, 2009 at 9:22 PM, taco <[email protected]> wrote: > > > > > Sooo.... I am currently working on trying to simplify the resulting > > > > expressions in sage to shrink them down to a smaller size. Here is > > > > the problem: I notice that my expressions contain *a lot* of terms > > > > like this, arctan2(0, looooooooooooong_expression). Now I know that > > > > arctan2(0,x) = 0 for all x and so this should simplify my > > > > expressions a great deal. However, I cannot get sage to make this > > > > simplification for me. Simplify() and simplify_full() do not touch > > > > these terms. Does anyone have an idea about how to address this > > > > trigonometric simplification? > > This doesn't really answer the original post. The issue is this: > > sage: arctan2(0,1) > 0 > sage: arctan2(0,-1) > pi > > So in fact Sage is correct in not evaluating this to be zero, as we > consider the angle -pi<theta<=pi for arctan2 (consistent with Python/C > and Maxima). If you assume(x>0) and then use the 'calculus copy of > Maxima', you get zero; the same would happen with > > sage: assume(x>0) > sage: arctan2(0,x).simplify() > 0 > > since that just sends it to Maxima and back. > > sage: forget() > sage: arctan2(0,x).simplify() > arctan2(0,x) > > By the way, the documentation for arctan2 says arctan2(y,x)=arctan(y/ > x), but then (correctly) contradicts it in the next line. Am I > missing something? > > - kcrisman -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
