Opened 14 years ago
Closed 11 years ago
#385 closed enhancement (fixed)
[with patch, positive review] implement at for symbolics
Reported by: | was | Owned by: | gfurnish |
---|---|---|---|
Priority: | major | Milestone: | sage-4.2.1 |
Component: | calculus | Keywords: | |
Cc: | jason, burcin, was, mhansen | Merged in: | sage-4.2.1.alpha0 |
Authors: | Karl-Dieter Crisman | Reviewers: | David Joyner |
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
On 6/7/07, Randy LeVeque <rjl@amath.washington.edu> wrote: > By the way, I'm just trying to figure out how sage does Taylor series. > Maybe you can pass this on to whoever the best person is to chat with about > this... > > In maple I can do things like > > > mtaylor(u(x+h,t+k),[h,k],3); > 2 > u(x, t) + D[1](u)(x, t) h + D[2](u)(x, t) k + 1/2 D[1, 1](u)(x, t) h > > 2 > + h D[1, 2](u)(x, t) k + 1/2 D[2, 2](u)(x, t) k > > > which is very convenient for numerical analysis when computing truncation > errors of finite difference methods (h and k are mesh widths in space and > time). In sage a general expansion of this sort doesn't seem possible even > in a single variable, e.g., > > sage: taylor(u(x+h),h,0,4) > x + h > > Apparently an undefined function like u(x) is taken to be the identity map? To define a formal function, do u = function('u'). Then sage: u = function('u') sage: u(x + h) u(x + h) sage: diff(u(x+h), x) diff(u(x + h), x, 1) To get the Taylor expansion you would do this: sage: taylor(u(x+h),h,0,4) -- however -- this currently doesn't work in SAGE since we hadn't considered doing this yet. What happens is Maxima does the computation and outputs the following expression: 'u(x)+(?%at('diff('u(x+h),h,1),h=0))*h+(?%at('diff('u(x+h),h,2),h=0))*h^2/2+(?%at('diff('u(x+h),h,3),h=0))*h^3/6+(?%at('diff('u(x+h),h,4),h=0))*h^4/24 SAGE doesn't know yet how to parse the "at" function, so you get an error -- it will have to be added. [Note that I don't necessarily consider maxima the ultimate underlying engine for SAGE's symbolic computation capabilities -- but it does provide a very quick way for SAGE to have a powerful symbolic system for which a lot of subtle bugs have already been fixed (over the last 40 years of Maxima development). ] Definitely point out lots of things like this in your talk at SD4! -- William
Attachments (1)
Change History (10)
comment:1 Changed 13 years ago by
- Milestone set to sage-2.9.1
comment:2 Changed 13 years ago by
- Owner changed from was to gfurnish
- Status changed from new to assigned
comment:3 Changed 12 years ago by
- Type changed from defect to enhancement
comment:4 Changed 11 years ago by
comment:5 Changed 11 years ago by
- Cc jason burcin was mhansen added
- Status changed from new to needs_review
- Summary changed from implement at for symbolics to [with patch, needs review] implement at for symbolics
Try this patch. It should do the trick. Notice that I do not make it a normal symbolic function like in functions/other.py or something, because it's only for use here for now. If necessary, I could do that, though - it's a nice second way to do things instead of .subs(), so I could also import it globally if appropriate. I put in doctests for this, #3914, and a direct call.
comment:6 follow-up: ↓ 7 Changed 11 years ago by
Attachment 'trac_385-at-evaluate.patch' not found :(
comment:7 in reply to: ↑ 6 Changed 11 years ago by
Replying to robert.marik:
Attachment 'trac_385-at-evaluate.patch' not found :(
It must have gotten lost somewhere during the latest Trac outage. This should work now.
comment:8 Changed 11 years ago by
- Status changed from needs_review to positive_review
- Summary changed from [with patch, needs review] implement at for symbolics to [with patch, positive review] implement at for symbolics
Passes sage -testall and does what it claims. Adds some very very useful functionality.
comment:9 Changed 11 years ago by
- Merged in set to sage-4.2.1.alpha0
- Resolution set to fixed
- Reviewers set to David Joyner
- Status changed from positive_review to closed
This would also resolve #3914.