On 2013-11-22, John Cremona <john.crem...@gmail.com> wrote: > 1. It is a fact that if a^2+b^2=1 then arcsin(a)+arcsin(b)=pi/2, but > how can I get this to happen automatically? I have an expression > which comes out as > > arcsin(1/3*sqrt(3)*sqrt(2)) + arcsin(1/3*sqrt(3)) > > which I would like to get simplified in this way.
I think this can be achieved via simplification rules in Maxima. I don't know if there are other ways to get the same result elsewhere in Sage (if so I am interested to hear about it -- I wouldn't mind adopting some ideas into Maxima). Here's what I have. matchdeclare (aa, lambda ([e], not atom(e) and op(e) = nounify(asin))); matchdeclare (xx, lambda ([e], atom(e) or op(e) # nounify(asin))); tellsimpafter (aa + xx, xx + FOO1 (aa)); FOO1(a):=if op(a) = "+" then FOO2 (a) else a; FOO2(a):=(a:args(a), for i thru length(a) do (for j from i + 1 thru length(a) do if a[i] # 0 then (FOO3 (a[i], a[j]), if %% # false then [a[i], a[j]] : [%%, 0])), apply ("+", a)); FOO3(u,v):=if is (equal (args(u)[1]^2 + args(v)[1]^2, 1)) = true then %pi/2; If there are any asin terms, call FOO1 on them. If there's more than one, FOO1 gets an expression like asin(u) + asin(v) + ... (otherwise it's just asin(u)), so call FOO2 on the "+" expression. FOO2 marches thru the list of asin terms and tries to combine them two by two (via FOO3). With that I get the following: (%i9) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3); (%o9) %pi/2 (%i10) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - 1; (%o10) %pi/2-1 (%i11) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - x + y; (%o11) y-x+%pi/2 (%i12) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - asin(x) + u; (%o12) -asin(x)+u+%pi/2 (%i13) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) + asin(sqrt(1 - u^2)) + asin (u); (%o13) %pi This is just what I got from some half-hearted hacking; I'm sure there are serious limitations. Good luck, have fun, & hope this helps. Robert Dodier -- 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/groups/opt_out.