1

I would like to compute the Taylor expansion of monomials whose powers are nonnegative rational 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 rationals.

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.

Even the case of integer powers is intricate. 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]]
Smilia
  • 592
  • 4
  • 14
  • If a1=10 and a2=1, is x^a1 still the correct answer? – Carl Woll Nov 04 '19 at 18:08
  • indeed, in such case it's not. I don't give specific values to a1 and a2. However I expect mathematica to understand that x^a2 y^3 is never in the expected result and x^a1 may or may not so he should keep it. – Smilia Nov 04 '19 at 18:10
  • Is it correct that a more refined question would be "Why s^(a+3)+O[s]^3 assuming a > 0 won't simplify?"? – swish Nov 04 '19 at 18:12
  • yes it is this point that my question is raising. Also I can change the implementation of the multivariate Taylor routine – Smilia Nov 04 '19 at 18:14
  • Is there some reason you are not using the built in command Series? – Bill Watts Nov 04 '19 at 18:30
  • Because it doesn't encode the true multivariate taylor expansion, see here :

    https://mathematica.stackexchange.com/questions/15023/multivariable-taylor-expansion-does-not-work-as-expected

    – Smilia Nov 04 '19 at 18:33

0 Answers0