Solve contains wrong solution

i like this post (click again to cancel)
i dont like this post (click again to cancel)

Hello, I tried to following to find a maxima of a function:

var('t x');
maxima = solve([derivative(f,x)==0, derivative(f,x,2)<0],x)

And the solution sage spits out are:

[x == 1, -2 > 0],
[x == (t - 2)/t, -(t - 2)^2 + 2*(t - 2)*t - t^2 + 6 > 0]

I understand that sage cannot evaluate the validity of the second solution but the first one surely is no solution at all.

Why does it give me this solution or am I doing anything wrong?

asked Dec 01 '12

maweki gravatar image maweki

I know, that I could only solve for f'(x)==0 and filter for f''(x)<0 but solve shouldn't contain solutions like that, I think.

maweki (Dec 02 '12)

3 Answers:

i like this answer (click again to cancel)
i dont like this answer (click again to cancel)

I would not agree with you that these solutions are 'wrong'. They are just presented in a very user unfriendly way. The 1st one, i.e.:

[x == 1, -2 > 0]

definitely is a solution - it just specifies a range of measure zero, since

sage: -2>0

so, it is not 'wrong' as you state - it is just 'totally useless' ;) The other solution is also perfectly ok since

sage: bool(-(t - 2)^2 + 2*(t - 2)*t - t^2 + 6)

so, the solution you want is

x == (t - 2)/t

which I think is ok ..... however I would definetely agree with you that

In[1]:= f[x_, t_] = Exp[x t] (x - 1)^2;
In[2]:= Solve[{D[f[x, t], x] == 0 , D[f[x, t], {x, 2}] < 0, {x, t}]
Out[2]= {{t -> ConditionalExpression[-(2/(-1 + x)), (t | x) \[Element] Reals]}}

from a well known competitor is far more user friendly


posted Dec 02 '12

Mark gravatar image Mark
56 3

updated Dec 02 '12

i like this answer (click again to cancel)
i dont like this answer (click again to cancel)

This is a bug (?) in to_poly_solve in Maxima.

(%i1) load(to_poly_solver);

Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o1) /Applications/MathApps/\
(%i3) display2d:false;

(%o3) false
(%i4) to_poly_solve([2*(x-1)*%e^(t*x)+t*(x-1)^2*%e^(t*x)=0,4*t*(x-1)*%e^(t*x)+t^2*(x-1)^2*%e^(t*x)+2*%e^(t*x)>0],[x]);

(%o4) %union([x = 1,2 > 0],[x = (t-2)/t,
                            t^2-2*(t-2)*t-4*t+4*(t-2)+(t-2)^2+2 > 0])

The current Maxima has

(%o4) %union([x = 1,2 > 0],[x = (t-2)/t,
                        t^2-2*(t-2)*t-4*t+4*(t-2)+(t-2)^2+2 > 0])

which is basically the same issue. I've reported this upstream">here.


posted Dec 03 '12

kcrisman gravatar image kcrisman
7802 20 78 170
i like this answer (click again to cancel)
i dont like this answer (click again to cancel)

I beg to differ :

Maxima 5.28.0 using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) load(to_poly_solve);

Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $

(%o1) /usr/share/maxima/5.28.0/share/to_poly_solve/to_poly_solve.mac

(%i2) display2d:false;

(%o2) false

(%i3) f(x,t):=(%e^(xt))(x-1)^2;

(%o3) f(x,t):=%e^(xt)(x-1)^2

(%i4) map(factor,%solve([factor(diff(f(x,t),x))=0,factor(diff(diff(f(x,t),x),x))<0],x));

(%o4) %union([x = 1,-2 > 0],[x = (t-2)/t,2 > 0])

which is correct.

Note that I load()ed to poly solve, not to_poly_solver ; according to a comment in the former source, the latter is obsolete.


                                          Emmanuel Charpentier

posted Dec 25 '12

Emmanuel Charpentier gravatar image Emmanuel Charpentier
1 1

updated Dec 25 '12

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
Login/Signup to Post

Question tools



Asked: Dec 01 '12

Seen: 122 times

Last updated: Dec 25 '12

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.