Ask Your Question
1

Solve contains wrong solution

asked 2012-12-01 22:14:02 +0200

maweki gravatar image

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?

edit retag flag offensive close merge delete

Comments

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 gravatar imagemaweki ( 2012-12-02 05:16:16 +0200 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2012-12-25 08:10:26 +0200

Emmanuel Charpentier gravatar image

updated 2012-12-25 09:56:04 +0200

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
edit flag offensive delete link more
0

answered 2012-12-03 13:53:01 +0200

kcrisman gravatar image

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 here.

edit flag offensive delete link more
0

answered 2012-12-02 07:46:07 +0200

Mark gravatar image

updated 2012-12-02 07:49:47 +0200

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

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2012-12-01 22:14:02 +0200

Seen: 730 times

Last updated: Dec 25 '12