Solve contains wrong solution

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

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

var('t x');
f=(e^(x*t))*(x-1)^2;
maxima = solve([derivative(f,x)==0, derivative(f,x,2)<0],x)
show(maxima);

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
1

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)
0
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
False

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)
True

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

link

posted Dec 02 '12

Mark gravatar image Mark
56 3

updated Dec 02 '12

i like this answer (click again to cancel)
0
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/Sage-5.4.1-OSX-64bit-10.6.app/Contents/Resources/\
sage/local/share/maxima/5.26.0/share/contrib/to_poly_solver.mac
(%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 https://sourceforge.net/p/maxima/bugs/2512/">here.

link

posted Dec 03 '12

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

I beg to differ :

Maxima 5.28.0 http://maxima.sourceforge.net 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.

HTH,

                                          Emmanuel Charpentier
link

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

Tags:

Stats:

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.