1 | initial version |
You can use sympy
:
sage: sympy.var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: sympy.solve([gamma - 1/sqrt(1-v^2/c^2), m - gamma*m_0, E - m*c^2, E_0 - m_0*c^2], v,m,m_0,gamma)
[(-c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0),
(c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0)]
Funnily, after doing that, Sage is able to solve your system:
sage: var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: eq1 = gamma == 1/sqrt(1-v^2/c^2)
sage: eq2 = m == gamma*m_0
sage: eq3 = E == m*c^2
sage: eq4 = E_0 == m_0*c^2
sage: solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
[[gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == -sqrt(E^2 - E_0^2)*c/E], [gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == sqrt(E^2 - E_0^2)*c/E]]
I don't understand where this interaction comes from.
2 | No.2 Revision |
You can use sympy
:
sage: import sympy
sage: sympy.var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: sympy.solve([gamma - 1/sqrt(1-v^2/c^2), m - gamma*m_0, E - m*c^2, E_0 - m_0*c^2], v,m,m_0,gamma)
[(-c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0),
(c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0)]
Funnily, after doing that, Sage is able to solve your system:
sage: var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: eq1 = gamma == 1/sqrt(1-v^2/c^2)
sage: eq2 = m == gamma*m_0
sage: eq3 = E == m*c^2
sage: eq4 = E_0 == m_0*c^2
sage: solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
[[gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == -sqrt(E^2 - E_0^2)*c/E], [gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == sqrt(E^2 - E_0^2)*c/E]]
I don't understand where this interaction comes from.
3 | No.3 Revision |
You can use sympy
:
sage: import sympy
sage: sympy.var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: sympy.solve([gamma - 1/sqrt(1-v^2/c^2), m - gamma*m_0, E - m*c^2, E_0 - m_0*c^2], v,m,m_0,gamma)
[(-c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0),
(c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0)]
Funnily, after doing that, Or, you can add asumptions on Sage is able to solve your system:symbols:
sage: var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: assume(gamma > 0, m > 0, m_0 > 0, c > 0, E > 0, E_0 > 0)
sage: sage: eq1 = gamma == 1/sqrt(1-v^2/c^2)
....: sage: eq2 = m == gamma*m_0
....: sage: eq3 = E == m*c^2
....: sage: eq4 = E_0 == m_0*c^2
....: sage: solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
[[gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == -sqrt(E^2 - E_0^2)*c/E], [gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == sqrt(E^2 - E_0^2)*c/E]]
I don't understand where this interaction comes from.
4 | No.4 Revision |
You can use sympy
:
sage: import sympy
sage: sympy.var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: sympy.solve([gamma - 1/sqrt(1-v^2/c^2), m - gamma*m_0, E - m*c^2, E_0 - m_0*c^2], v,m,m_0,gamma)
[(-c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0),
(c*sqrt(1 - E_0**2/E**2), E/c**2, E_0/c**2, E/E_0)]
Or, you can add asumptions on Sage symbols:
sage: var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
sage: assume(gamma > 0, m > 0, m_0 > 0, c > 0, E > 0, E_0 > 0)
sage: sage: eq1 = gamma == 1/sqrt(1-v^2/c^2)
....: sage: eq2 = m == gamma*m_0
....: sage: eq3 = E == m*c^2
....: sage: eq4 = E_0 == m_0*c^2
....: sage: solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
[[gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == -sqrt(E^2 - E_0^2)*c/E], [gamma == E/E_0, m == E/c^2, m_0 == E_0/c^2, v == sqrt(E^2 - E_0^2)*c/E]]