Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.2K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Remove nonnegative power variable term?

Posted 6 years ago

I would like to compute the Taylor expansion of monomials whose powers are nonnegative integers variables.

First, here is a function which encodes the multivariate Taylor expansion at the points pts, at the order ord and with respect to the variables var.

mTaylor[expr_,var_List,pts_List,ord_Integer] /; Length[var] == Length[pts] := \
    Normal[(expr /. Thread[var -> s (var-pts)+pts]) + O[s]^ord] /. {s->1}

Assume I want to compute the multivariate Taylor expansion of the expression:

expr = x^a1 + x^a2 y^3

at the order $2$, wrt $(x,y)$ at $(0,0)$ and where $a1,a2$ are nonnegative integers.

The expected results would be

res = x^a1 (*=mTaylor[expr,{x,y},{0,0},3]*)

However I can't get my Taylor function correct to yield this result.

I tried using global assumptions :

$Assumptions = Element[a1,NonNegativeIntegers] && Element[a2,NonNegativeIntegers]

I tried also to write a routine to remove the high order terms but again it doesn't seem it handles the assumptions on the power:

EliminTe[expr_,var_List,ordre_Integer]:=Module[{},\
      FromCoefficientRules[Select[CoefficientRules[expr, var], Refine[Total@#[[1]] <= ordre    ,Assumptions->Element[a2,NonNegativeIntegers]] &], var]] 

Here is my code

mTaylor[expr_,var_List,pts_List,ord_Integer] /; Length[var] == Length[pts] := \
Normal[(expr /. Thread[var -> s (var-pts)+pts]) + O[s]^ord] /. {s->1}

$Assumptions = Element[a1,NonNegativeIntegers] && Element[a2,NonNegativeIntegers]

expr = x^a1 + x^a2 y^3 

res = Refine[mTaylor[expr,{x,y},{0,0},3]]
POSTED BY: foo bar
4 Replies
Posted 6 years ago

Yes, thanks !

POSTED BY: foo bar

What are "the good terms"?

Your function is

ff = x^a1 + x^a2 y^3

Define

rr = {x -> x0, y -> y0}

then your Taylor-Expansion literally is

taylor = (ff /. rr ) + (D[ ff, x] /. rr ) (x - x0) + (D[ ff, y] /. rr ) (y - y0) + 1/2 ((D[ff, x, x] /. rr) (x - x0)^2 + 
     2 (D[ff, x, y] /. rr) (x - x0) (y - y0) + (D[ff, y, y] /.  rr) (y - y0)^2)

The Method given in Mathematica.stackexchange yields

fff = ff /. {x -> x0 + t (x - x0), y -> y0 + t (y - y0)}

taylor1 = Normal[Series[fff, {t, 0, 2}]] /. t -> 1

and

In[32]:= taylor - taylor1 // FullSimplify

Out[32]= 0

which obviously does the job. So you only have to modify your mTaylor a bit:

mTaylor[expr_, var_List, pts_List, ord_Integer] /;   Length[var] == Length[pts] := 
 Normal[Series[(expr /. Thread[var -> s (var - pts) + pts]), {s, 0, ord}]] /. {s -> 1}

Then

In[45]:= mTaylor[ff, {x, y}, {x0, y0}, 2] - taylor1 // FullSimplify

Out[45]= 0

and

In[46]:= mTaylor[ff, {x, y}, {0, 0}, 2]

Out[46]= x^a1
POSTED BY: Hans Dolhaine
Posted 6 years ago

Thanks Neil. The problem of Series is that it doesn't compute the "true" multivariate Taylor expansion, see https://mathematica.stackexchange.com/questions/15023/multivariable-taylor-expansion-does-not-work-as-expected

I am thinking a way around Series to keep the good terms.

POSTED BY: foo bar

foo, :)

Use Series to get the Taylor Series:

Normal[Series[x^a1 + x^a2 *y^3, {x, 0, 1}, {y, 0, 1}]]

Normal removes the higher order terms.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard