Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in solve command #15499

Open
ppurka opened this issue Dec 9, 2013 · 4 comments
Open

Regression in solve command #15499

ppurka opened this issue Dec 9, 2013 · 4 comments

Comments

@ppurka
Copy link
Member

ppurka commented Dec 9, 2013

From google spreadsheet which no one reads X-(

The following is a vector calculus example. It supposedly should solve the critical point equations for the given function (symbolically, where possible, otherwise numerically):

x,y=var('x,y')
f(x,y)=((x-1)^2+(y-3)^2)*((x+1)^2+(y+2)^2)/(x^2+y^2+1)
solve([f.gradient()[0]==0,f.gradient()[1]==0],x,y)

Works with 5.5.rc0 (assuming answer is correct)

sage: solve([f.gradient()[0]==0,f.gradient()[1]==0],x,y)
[[x == (0.45 + 1.65*I), y == (-11/20*I + 27/20)], [x == (0.45 - 1.65*I), y == (11/20*I + 27/20)], [x == (2.14624170747e-08 + 2.50000000895*I), y == (-I + 1/2)], [x == (-2.14624155595e-08 + 2.49999999105*I), y == (-I + 1/2)], [x == (-1.22085882983e-09 - 2.49999999706*I), y == (I + 1/2)], [x == (1.22085741408e-09 - 2.50000000294*I), y == (I + 1/2)], [x == 0.108848345629, y == 0.064959221634], [x == 2.0690897184, y == -0.785458685751], [x == -2.08897196262, y == 0.935164613209], [x == (0.00551694210392 + 1.15257220423*I), y == (-0.0573325779446 + 2.78408620946*I)], [x == (0.00551694210392 - 1.15257220423*I), y == (-0.0573325779446 - 2.78408620946*I)], [x == (-0.4 + 1.2*I), y == (-3/5*I - 4/5)], [x == (-0.4 - 1.2*I), y == (3/5*I - 4/5)], [x == -1, y == -2], [x == 1, y == 3]]

Breaks with 5.5

sage: solve([f.gradient()[0]==0,f.gradient()[1]==0],x,y)
[2*(x - 1)*((y + 2)^2 + (x + 1)^2)/(x^2 + y^2 + 1) + 2*(x + 1)*((y - 3)^2 + (x - 1)^2)/(x^2 + y^2 + 1) - 2*((y + 2)^2 + (x + 1)^2)*((y - 3)^2 + (x - 1)^2)*x/(x^2 + y^2 + 1)^2 == 0, 2*(y - 3)*((y + 2)^2 + (x + 1)^2)/(x^2 + y^2 + 1) + 2*(y + 2)*((y - 3)^2 + (x - 1)^2)/(x^2 + y^2 + 1) - 2*((y + 2)^2 + (x + 1)^2)*((y - 3)^2 + (x - 1)^2)*y/(x^2 + y^2 + 1)^2 == 0]

Update: it works again with sage 7.6.beta4,
but not all results are correct

CC: @kcrisman @sagetrac-jakobkroeker

Component: calculus

Keywords: regression

Stopgaps: wrongAnswerMarker

Issue created by migration from https://trac.sagemath.org/ticket/15499

@ppurka ppurka added this to the sage-6.1 milestone Dec 9, 2013
@kcrisman
Copy link
Member

kcrisman commented Dec 9, 2013

comment:1

Could be a change in how Maxima does these.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@rwst
Copy link

rwst commented Jul 15, 2015

comment:5

With 6.8:

sage: solve([f.gradient()[0]==0,f.gradient()[1]==0],x,y)
[[x == (0.4500000000000001 + 1.65*I), y == (-11/20*I + 27/20)], [x == (0.4499999999999998 - 1.65*I), y == (11/20*I + 27/20)], [x == (2.1462417074716e-08 + 2.500000008950185*I), y == (-I + 1/2)], [x == (-2.146241555952319e-08 + 2.499999991049815*I), y == (-I + 1/2)], [x == (-1.220858829829863e-09 - 2.499999997056549*I), y == (I + 1/2)], [x == (1.220857414076436e-09 - 2.500000002943449*I), y == (I + 1/2)], [x == 0.1088483456288377, y == 0.06495922163399628], [x == 2.069089718402096, y == -0.7854586857514639], [x == -2.088971962616823, y == 0.9351646132094527], [x == (0.005516942103919547 + 1.152572204234338*I), y == (-0.05733257794463129 + 2.784086209457084*I)], [x == (0.00551694210391972 - 1.152572204234338*I), y == (-0.05733257794463129 - 2.784086209457084*I)], [x == (-0.4 + 1.2*I), y == (-3/5*I - 4/5)], [x == (-0.4000000000000001 - 1.2*I), y == (3/5*I - 4/5)], [x == -1, y == -2], [x == 1, y == 3]]
sage: f.gradient()[0](0.45+1.65*I, (-11/20*I + 27/20))
-1.21597189939003e16 - 3.60287970189640e14*I
sage: f.gradient()[1](0.45+1.65*I, (-11/20*I + 27/20))
-8.89911286368410e16 - 8.92613446144832e16*I

Doesn't look correct...

@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Mar 3, 2017

Stopgaps: wrongAnswerMarker

@sagetrac-jakobkroeker

This comment has been minimized.

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants