Ask Your Question
0

missing solutions in solve

asked 2018-03-10 19:35:19 +0100

ortollj gravatar image

updated 2018-03-11 08:30:19 +0100

Hi

SageMath 8.1, Windows 10, Jupyter Notebook.

why there are 3 missing solutions in S4 ?

forget()
t = var('t')

f_x = function('f_x')(t) 
f_y = function('f_y')(t)

assume(t, 'real')
assume(t > 0)
assume(t < 2*pi)
f_x=cos(t)
f_y=1/2 *sin(2*t)
S4=solve(derivative(f_y,t)/derivative(f_x,t)==0,t)
show(S4)
fP=parametric_plot( (f_x, f_y), (t,0,2*pi))
for s in S4 :
    p=point2d((f_x(t=s.rhs()),f_y(t=s.rhs())),size=30, rgbcolor=hue(0.75), marker='d', markeredgecolor='red')
#p2=point2d((f_x(t=s.rhs()+pi/2),f_y(t=s.rhs()+pi/2)),size=30, rgbcolor=hue(0.75), marker='d', markeredgecolor='red')
#p3=point2d((f_x(t=s.rhs()+pi),f_y(t=s.rhs()+pi)),size=30, rgbcolor=hue(0.75), marker='d', markeredgecolor='red')
#p4=point2d((f_x(t=s.rhs()+3*pi/2),f_y(t=s.rhs()+3*pi/2)),size=30, rgbcolor=hue(0.75), marker='d', markeredgecolor='red')
#show(fP+p+p2+p3+p4)
show(fP+p)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-03-11 08:58:10 +0100

Emmanuel Charpentier gravatar image

updated 2018-03-11 18:45:45 +0100

Note : This was a good answer to the bad question. See below...

This smells of homework. Therefore, some hints .

You're trying to find the zeroes of $\displaystyle-\frac{\sin\left(t\right)}{\cos\left(2 \, t\right)}$ (expression quite easily obtained with Sage). A plot of this function (as easily obtained...) should help to convince you that this function has exactly one zero in the open interval $(0~2\pi)$ of $\mathbb{R}$. Proving it formally is also a good exercice.

However, this plot might also attract your attention to this function's poles, which aren't quite the same thing...

Now for the _right_ question :

Indeed, the default solver (Maxima's) gives only a partial solution to the real equation (i. e. $\displaystyle\frac{\cos(2t)}{sin(t)}=0$).

One can obtain a better set of solution with:

solve(cos(2*t),t,to_poly_solve="force")
[t == 1/4*pi + 1/2*pi*z40]

(see solve's doc). But this doesn't fulfills the constraint $0\lt t\lt2\pi $.

Note that sympy's solver is not really better :

sage: [s._sage_() for s in sympy.solve(cos(2*t),t)]
[1/4*pi, 3/4*pi]

Mathematica seems to be able to solve the system, but its answer can't currently be parsed back in Sage :

sage: S=[t>0,t<2*pi,cos(2*t)==0]
sage: mathematica.Solve(S,t)
{{t -> Pi/4}, {t -> (3*Pi)/4}, {t -> (5*Pi)/4}, {t -> (7*Pi)/4}}
edit flag offensive delete link more

Comments

Hi Emmanuel it is not the problem, I know the four points t=pi/4,pi/4 +pi/2,pi/4 +2pi/2,pi/4+3pi/2 the problem is why the command solve does not get the four solutions.(you put the expression upside down in your post above)

the question is why in this code below, S4 get only One of the fourth solution because I have precised : assume(t < 2*pi)

forget()
t = var('t')

f = function('f')(t) 


assume(t, 'real')
assume(t > 0)
assume(t < 2*pi)
f=cos(2*t)
S4=solve(f==0,t)
show(S4)

I think that if we did not specify the domain, as there is an infinity of solutions, the command Solve should provide a single solution, but when we specified the domain, the command solve should give all the solutions belonging to this domain.

ortollj gravatar imageortollj ( 2018-03-11 11:17:19 +0100 )edit

You are right. I should never, ever attempt to answer an ask.sage... question before the morning's tea has kicked up....

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2018-03-11 18:49:25 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-10 19:35:19 +0100

Seen: 409 times

Last updated: Mar 11 '18