Ticket #2143 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch; positive review ] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus

Reported by: jkantor Owned by: jkantor
Priority: major Milestone: sage-2.10.4
Component: numerical Keywords:
Cc: dfdeshom Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Attachments

optimize.patch Download (12.7 KB) - added by dfdeshom 5 years ago.
2143.patch Download (12.4 KB) - added by dfdeshom 5 years ago.
2143-2.patch Download (13.4 KB) - added by mhansen 5 years ago.

Change History

comment:1 Changed 5 years ago by was

Clicking the link gives:

Forbidden

You don't have permission to access /home/jkantor/optimize.patch on this server.

Of course, I could fix that since I'm root on that machine... but I'm too busy at the moment.

comment:2 Changed 5 years ago by ncalexan

  • Summary changed from [with patch, needs review] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus to [with patch that is not accessible!] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus

comment:3 Changed 5 years ago by dfdeshom

  • Cc dfdeshom added
  • Summary changed from [with patch that is not accessible!] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus to [with patch; needs review ] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus

Changed 5 years ago by dfdeshom

comment:4 Changed 5 years ago by dfdeshom

Attaching the patch on trac for convenience...

comment:5 Changed 5 years ago by dfdeshom

Review:

Doctests were failing due to either missing imports or unsuppressed output. I'm attaching a patch where all doctests pass...

Changed 5 years ago by dfdeshom

comment:6 Changed 5 years ago by rlm

  • Milestone changed from sage-2.11 to sage-2.10.4

Changed 5 years ago by mhansen

comment:7 Changed 5 years ago by mhansen

  • Summary changed from [with patch; needs review ] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus to [with patch; positive review ] wrap scipy optimization routines and cvxopt linear programming, add gradient/hessian to calculus

I fixed some typos and formatting issues. Both 2143.patch and 2143-2.patch should be applied.

comment:8 Changed 5 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

Merged 2143.patch and 2143-2.patch in Sage 2.10.4.rc0

comment:9 Changed 5 years ago by edrex

sage: f(x,y)=x^2+y^2
sage: f.gradient()
<type 'exceptions.NotImplementedError'>:
sage: f.parent()
Callable function ring with arguments (x, y)
sage: var('x,y')
sage: g=x^2+y^2
sage: g.gradient()
sage: g.parent()
Symbolic Ring
(2*x, 2*y)

I guess this isn't a bug, just not implemented yet? I thought f(x)=x2 was equivalent to var('x');f=x2 but evidently they are different?

comment:10 Changed 5 years ago by mhansen

These are actually different things.

sage: preparse('f(x)=x^2')
'_=var("x");f=symbolic_expression(x**Integer(2)).function(x)'
sage: preparse("var('x');f=x^2")
"var('x');f=x**Integer(2)"

comment:11 Changed 5 years ago by edrex

Ah... I like the f(x,y)=x2+y2 syntax/construction better, since it makes the mapping explicit for expressions which may not contain all variables. Filed as #2547

Note: See TracTickets for help on using tickets.