Opened 14 years ago
Closed 14 years ago
#4030 closed enhancement (fixed)
[with patch, positive review] Vectors of callable things should be callable
Reported by: | jwmerrill | Owned by: | jwmerrill |
---|---|---|---|
Priority: | major | Milestone: | sage-3.1.2 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The motivation here is being able to evaluate the gradient of a function at a point.
The desired behavior is sage: x, y = var('x, y') sage: f = x^2 + y^2 sage: g = f.gradient() sage: g(x=3,y=2) (6,4) Currently, however sage: g(x=3,y=2) Traceback (most recent call last): ... TypeError: 'sage.modules.free_module_element.FreeModuleElement_generic_dense' object is not callable Calls should also work for a vector of callable symbolic expressions. Note that the gradient part will only work once #2547 is applied. sage: f(x,y) = x^2 + y^2 sage: g = f.gradient() sage: g(3,2) (6,4) sage: g(y=2,x=3) (6,4) }}
Attachments (1)
Change History (7)
Changed 14 years ago by
comment:1 Changed 14 years ago by
- Component changed from algebra to calculus
- Owner changed from tbd to jwmerrill
- Summary changed from Vectors of callable things should be callable to [with patch, needs work] Vectors of callable things should be callable
comment:2 Changed 14 years ago by
- Summary changed from [with patch, needs work] Vectors of callable things should be callable to [with patch, needs review] Vectors of callable things should be callable
- Type changed from defect to enhancement
After applying #4031, the patch here gives the desired behavior.
comment:3 Changed 14 years ago by
- Milestone set to sage-3.1.2
Jason,
please assign a milestone to new tickets. The next release is usually the right choice.
Cheers,
Michael
comment:4 Changed 14 years ago by
- Summary changed from [with patch, needs review] Vectors of callable things should be callable to [with patch, positive review] Vectors of callable things should be callable
Looks good to me. Apply only after #4031.
comment:5 in reply to: ↑ description Changed 14 years ago by
comment:6 Changed 14 years ago by
- Resolution set to fixed
- Status changed from new to closed
Merged in Sage 3.1.2.alpha4
Note: See
TracTickets for help on using
tickets.
The attached patch solves all the cases above except the last, which returns
Not sure what the deal is with that.
This patch should only be applied after #2547.