Re: Taylor Series Expansions
- To: mathgroup at smc.vnet.net
- Subject: [mg32382] Re: [mg32372] Taylor Series Expansions
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 17 Jan 2002 02:23:36 -0500 (EST)
- References: <200201160831.DAA09716@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Joe Helfand wrote: > > Wow! > > I have definitely come to the right place. Thanks for all the > responses. Using the Map built in function solved my problem (it still > took a bit, so you can imagine what I was dealing with). Here is > something else which I have wasted some time on not knowing as much > about Mathematica as I should. It has to do with multi-variable Taylor > series expansion. Mathematica has a built in Series function. But when > you use this for multi-variable functions, it doesn't do quite what I'd > expect. Let's say I have a function for two fariables, and I want to > expand to 2nd order. When I use Series, it expands each varible to > second order, but includes the cross terms, which I want to belong to a > 4th order expansion. For example: > > In[1172]:= > Normal[Series[Exp[x y], {x, 0, 2}, {y, 0, 2}]] > > Out[1172]= > \!\(1 + x\ y + \(x\^2\ y\^2\)\/2\) > > But what I really want is just 1 + x y, where if I go to fourth order, > then I'll take the x^2 y^2 / 2. I had to take some time to write some > sloppy Taylor series expansion functions that did what I wanted. Is > there a way to get around this problem or do you have any suggestions? > > Thanks Again, > Joe The best way I have seen was posted a few years ago: http://library.wolfram.com/mathgroup/archive/1998/Jul/msg00058.html If you want to expand somewhere other than the origin you will have to modify the code a bit. An alternative method that works readily for this case may be found at: http://library.wolfram.com/mathgroup/archive/1998/Jun/msg00332.html On the topic of Integrate and sums, it has been pointed out that current behavior (of built-in Integrate) is NOT to map over the sum because we may then lose track of "bad" things (singularities, say) that could cancel. We are experimenting with changes that do the mapping and check after the fact for presence of bad stuff. If nothing obvious breaks then we will do it this way in our next release and you can get results like the one below. integrand = (a*c*Cos[t])/(g*s) + (b*q*Cos[2*t])/(c*f) + (c*Cos[3*t])/(a*d) + (d*f*Cos[4*t])/(a*h*n) + (e*q*Cos[5*t])/(a*g) + (f*l*Cos[6*t])/(m*r*w) + (b*g*Cos[7*t])/(n*o*x) + (h*Sin[t])/(b*c) + (i*Sin[2*t])/(e*h*r) + (j*y*Sin[3*t])/(l*p) + (d*k*Sin[4*t])/(c*j) + (a*l*m*Sin[5*t])/(b*f*h*s) + (m*p*Sin[6*t])/(j*k) + (n*q*Sin[7*t])/(c*x); In[3]:= Timing[Integrate[integrand, {t, 0, 2 Pi}]] Out[3]= {0.05 Second, 0} Daniel Lichtblau Wolfram Research
- References:
- Taylor Series Expansions
- From: Joe Helfand <jhelfand@wam.umd.edu>
- Taylor Series Expansions