'Mathematica Series and Solve function

This is my first mathmatica code, I defined the functions:

\[Beta] := v/c
\[Gamma] := 1/Sqrt[1 - \[Beta]^2]
TotalE[\[Gamma][\[Beta]]] := \[Gamma]mc^2
KE := TotalE[\[Gamma][\[Beta]]] - mc^2

No i want to make a series expansion of KE at β → 0 up to order 2,

I tried:

Series[KE, {\[Beta], 1, 2}]

But i got the error massage:

General::ivar: v/c is not a valid variable.

I also wanted to define Ekin as function of β, so i used Solve function to get the inverse function, β[Ekin]:

Solve[KE, \[Beta]]

The same errors arises again:

Solve::ivar: v/c is not a valid variable.


Solution 1:[1]

Try this

Clear[\[Gamma],\[Beta],mc,KE,s,v,c]
\[Gamma] = 1/Sqrt[1 - \[Beta]^2];
TotalE[\[Gamma]*\[Beta]] = \[Gamma]*mc^2;
KE = TotalE[\[Gamma]*\[Beta]] - mc^2;
s=Normal[Series[KE, {\[Beta], 1, 2}]]/.\[Beta]->v/c
Reduce[KE==0, \[Beta]]/.\[Beta]->v/c

which returns

O-mc^2 + mc^2/(Sqrt[2]*Sqrt[1 - v/c]) -
(mc^2*(-1 + v/c))/(4*Sqrt[2]*Sqrt[1 - v/c]) + 
(3*mc^2*(-1 + v/c)^2)/(32*Sqrt[2]*Sqrt[1 - v/c])

and

(mc != 0 && v/c == 0)||(-1+v^2/c^2 !=0 && mc == 0)

What that is trying to do is do your calculations with the simple variable beta, before you turn that into v/c and after the calculations replace beta with v/c.

But there are still things about the way you have written that which worry me. You are kind of writing TotalE like it is a function, but that is not the way to define a Mathematica function and I am concerned this may be going to get you into trouble.

Please let me know if I have misunderstood some of what you are trying to do and explain what I've done wrong and I will try to find a way to fix that.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1