Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6229 > unrolled thread

Series expansion question

Started byRecif <recif@yahoo.com>
First post2011-11-06 11:01 +0000
Last post2011-11-07 10:54 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Series expansion question Recif <recif@yahoo.com> - 2011-11-06 11:01 +0000
    Re: Series expansion question "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-11-07 10:54 +0000

#6229 — Series expansion question

FromRecif <recif@yahoo.com>
Date2011-11-06 11:01 +0000
SubjectSeries expansion question
Message-ID<j95pf3$m7v$1@smc.vnet.net>
I defined a function:
gts[x_, y_] := Normal[Series[g[x, y], {x, x0, 1}, {y, y0, 1}]]

and when I use it with 'a' and 'b' undefined, I get the value I expect:
gts[a, b]
g[x0,y0] + (a-x0) g^(1,0)[x0,y0] + (b-y0) g^(0,1)[x0,y0] ...

However when I assign values to a and b:
a = x0 + z
b = y0 + z

gts[a,b]
gives me an error:
General::ivar: "x0+z is not a valid variable"

etc.

I would appreciate any help to fix this.
Thanks.
Recif

[toc] | [next] | [standalone]


#6235

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2011-11-07 10:54 +0000
Message-ID<j98dco$3oe$1@smc.vnet.net>
In reply to#6229
"Recif" <recif@yahoo.com> schrieb im Newsbeitrag 
news:j95pf3$m7v$1@smc.vnet.net...
>I defined a function:
> gts[x_, y_] := Normal[Series[g[x, y], {x, x0, 1}, {y, y0, 1}]]
>
> and when I use it with 'a' and 'b' undefined, I get the value I 
> expect:
> gts[a, b]
> g[x0,y0] + (a-x0) g^(1,0)[x0,y0] + (b-y0) g^(0,1)[x0,y0] ...
>
> However when I assign values to a and b:
> a = x0 + z
> b = y0 + z
>
> gts[a,b]
> gives me an error:
> General::ivar: "x0+z is not a valid variable"
>
> etc.
>
> I would appreciate any help to fix this.
> Thanks.
> Recif
>

You should use replacements instead of assignments:

gts[a, b] /. {a -> x0 + z, b -> y0 + z}
Out[88]=
g[x0, y0] + z*Derivative[1, 0][g][x0, y0] +
z*(Derivative[0, 1][g][x0, y0] +
z*Derivative[1, 1][g][x0, y0])

Wolfgang 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web