Non trivial series in Matematica

  • Thread starter Thread starter unih
  • Start date Start date
  • Tags Tags
    Series
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
8 replies · 2K views
unih
Messages
27
Reaction score
0
Hi dear all
I have some functional in Mathematica that depends on the functions (for example u1(x,y,t) u2(x,y,t) and others) and its derivatives.
I want to expand this functional in series of ε.
Its perturbation theory as you understand, and I should take into account that not only functions but also
derivatives (by themselfes) are also have scale, i.e (in my example) u1~u2~∂x~∂y~ε, ∂t2 and I want to get smth up to ε2 (like for example u1(x,y)+u2(x,y)+u1(x,y)*u2(x,y)+∂xu1(x,y)+∂xu2(x,y)+∂yu1(x,y)+∂tf(x,y))
How to do it?
Thank you very much!
 
Physics news on Phys.org
I know what is Series. They don't do what i need
 
Describe more precisely what you need.

Perhaps give a simple, but not too simple, example that shows exactly what the input should be and what the output should be and why.

Please be certain to show and explain what you mean by "get smth up to epsilon^2."
 
Last edited:
Thank you for your replay!
For example
u1(t,x,y)+u1(t,x,y)2+∂xu2(t,x,y)+∂tu1(t,x,y)+∂tu2(t,x,y)+u1(t,x,y)∂tu2(x,y,z)+∂tf(t,x,y)
now I take into account that u1~u1~∂x~∂y~ε , ∂t2 and alculate the orders of every part of expression

u1(t,x,y)~ε
u1(t,x,y)22 (=1+1)
xu2(t,x,y)~ε2 (=1+1)
tu1(t,x,y)~ε3 (=2+1)
tu2(t,x,y)~ε2 (=2+1)
u1(t,x,y)∂tu2(x,y,z)~ε4 (=1+2+1)
tf(t,x,y)~ε2 (=2+0)

Now I want this expression up to ε2, so I get
u1(t,x,y)+u1(t,x,y)2+∂xu2(t,x,y)+∂tf(t,x,y)+O(ε3)
 
Possibly something like

Subscript[u,1][t,x,y] + Subscript[u,1][t,x,y]^2 + ∂x Subscript[u,2][t,x,y] + ∂t Subscript[u,1][t,x,y] + ∂t Subscript[u,2][t,x,y] + Subscript[u,1][t,x,y] ∂t Subscript[u,2][x,y,z] + ∂t f[t,x,y] //. {∂t Subscript[u,1][t,x,y]->0, Subscript[u,1][t,x,y] ∂t Subscript[u,2][x,y,z]->0}

which, if I have not made any mistakes, replaces each of your higher order terms with zero which Mathematica then drops.

I don't know if this is what you really want or not. I don't know of any simple automated method that will do this for you. I believe this method is "brittle", which means that tiny changes in your input may make it fail for reasons that are very hard to understand. Perhaps someone with more skill than I can show you a better way of doing what you want.

I do understand that people see subscripts used widely in mathematical publications, they see that Mathematica has some ability to display subscripts and that some people have a compulsion to use subscripts in Mathematica that cannot be overcome, but again and again and again people find or create problems for themselves when trying to use subscripts. Plan for that.
 
Last edited:
Thank you. I did smth like that
The problem is not a subscript (in matematika code I don't use them, here they are just for beaty). the problem is that i want to do smth automatically and up to the order I want.
 
Just rescale all your variables by epsilon, then Taylor expand that. Here's a simple example:

Code:
In[18]:= f[x, y] /. a : (x | y) :> eps a
         % + O[eps]^2

Out[18]= f[eps x, eps y]

Out[19]= f[0,0]+(y (f^(0,1))[0,0]+x (f^(1,0))[0,0]) eps+O[eps]^2

This can be packaged into a function such as

Code:
EpsExpand[fn_, vars_List, ord_Integer] := Module[{eps},
  Normal[Series[fn /. a : (Alternatives @@ vars) :> eps a, {eps, 0, ord}]] /. eps -> 1]
EpsExpand[fn_, vars_, ord_Integer] := EpsExpand[fn, {vars}, ord]
then
Code:
In[25]:= EpsExpand[f[x, y], {x, y}, 2]

Out[25]= f[0,0]+y (f^(0,1))[0,0]+x (f^(1,0))[0,0]+1/2 (y^2 (f^(0,2))[0,0]+2 x y (f^(1,1))[0,0]+x^2 (f^(2,0))[0,0])

You should be able to generalize this to the case that interests you.