rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

spurious solution of trig equation, missed actual solution #3079

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 13:37:22 Created by robert_dodier on 2008-07-30 02:12:31 Original: https://sourceforge.net/p/maxima/bugs/1464


(sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x));

solve (%, x);

`solve' is using arc-trig functions to get a solution. Some solutions will be lost.

=> [x = %pi,x = %pi/2,x = 0]

x = %pi and x = 0 are bona fide solutions, x = %pi/2 is spurious. A plot shows a root near 1.9 which find_root says is 1.9106....

Forwarded from sage-devel 2008-07-29.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 13:37:23 Created by willisbl on 2008-07-30 02:33:08 Original: https://sourceforge.net/p/maxima/bugs/1464/#1c4a


Logged In: YES user_id=895922 Originator: NO

Of course, Maxima should solve this equation without help. At least Maxima has the tools to solve it: (%o45) (sin(x)-8*cos(x)*sin(x))*(sin(x)^2+cos(x))-(2*cos(x)*sin(x)-sin(x))*(-2*sin(x)^2+2*cos(x)^2-cos(x)) (%i46) exponentialize(%)$ (%i47) ratsubst(z, exp(%i*x),%)$ (%i48) solve(%,z)$ (%i49) subst(exp(%i*x),z,%)$ (%i50) map(lambda([s], solve(s,x)),%); (%o50) [[x=-%i*log(-(2*sqrt(2)*%i)/3-1/3)],[x=-%i*log((2*sqrt(2)*%i)/3-1/3)],[x=0],[x=-%i*log(-1)]]

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 13:37:26 Created by willisbl on 2009-03-03 09:22:03 Original: https://sourceforge.net/p/maxima/bugs/1464/#e889


The new to_poly_solver solves this equation:

(%i7) eq : (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x)); (%o7) (sin(x)-8*cos(x)*sin(x))*(sin(x)^2+cos(x))-(2*cos(x)*sin(x)-sin(x))*(-2*sin(x)^2+2*cos(x)^2-cos(x))

(%i8) sol : to_poly_solve(eq,x); (%o8) %union([x=2*%pi*%z22+%pi],[x=2*%pi*%z24],[x=2*%pi*%z26-atan(2*sqrt(2))+%pi],[x=2*%pi*%z28+atan(2*sqrt(2))-%pi])

(%i9) makelist(sublis(s,eq),s,args(sol)); (%o9) [0,0,0,0]