Ask Your Question

missing solutions in solve

asked 2018-03-10 12:35:19 -0500

ortollj gravatar image

updated 2018-03-11 01:30:19 -0500


SageMath 8.1, Windows 10, Jupyter Notebook.

why there are 3 missing solutions in S4 ?

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_y=1/2 *sin(2*t)
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')
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-03-11 01:58:10 -0500

Emmanuel Charpentier gravatar image

updated 2018-03-11 12:45:45 -0500

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:

[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


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)

t = var('t')

f = function('f')(t) 

assume(t, 'real')
assume(t > 0)
assume(t < 2*pi)

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 05:17:19 -0500 )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 12:49:25 -0500 )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


Asked: 2018-03-10 12:35:19 -0500

Seen: 84 times

Last updated: Mar 11