Any way to solve these simultaneous equations using Sage?
Input is as following
1: var('E_0,E,gamma,c,v,m,m_0')
(E_0, E, gamma, c, v, m, m_0)
2: eq1 = gamma == 1/sqrt(1-v^2/c^2)
3: eq2 = m == gamma*m_0
4: eq3 = E == m*c^2
5: eq4 = E_0 == m_0*c^2
6: solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
The expected solution for v is v = c * sqrt(1-E_0^2/E^2).
I get the following error message. I tried assuming all the variables to be positive and real, but get the same error message.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-c0343319abfc> in <module>()
----> 1 solve([eq1,eq2,eq3,eq4],v,m,m_0,gamma)
/home/sage/sage-7.4/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
863 s = []
864
--> 865 sol_list = string_to_list_of_solutions(repr(s))
866
867 # Relaxed form suggested by Mike Hansen (#8553):
/home/sage/sage-7.4/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in string_to_list_of_solutions(s)
538 from sage.structure.sequence import Sequence
539 from sage.calculus.calculus import symbolic_expression_from_maxima_string
--> 540 v = symbolic_expression_from_maxima_string(s, equals_sub=True)
541 return Sequence(v, universe=Objects(), cr_str=True)
542
/home/sage/sage-7.4/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in symbolic_expression_from_maxima_string(x, equals_sub, maxima)
1798 if len(x) == 0:
1799 raise RuntimeError("invalid symbolic expression -- ''")
-> 1800 maxima.set('_tmp_',x)
1801
1802 # This is inefficient since it so rarely is needed:
/home/sage/sage-7.4/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in set(self, var, value)
504 raise TypeError
505 cmd = '%s : %s$'%(var, value.rstrip(';'))
--> 506 self.eval(cmd)
507
508 def clear(self, var):
/home/sage/sage-7.4/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.pyc in _eval_line(self, line, locals, reformat, **kwds)
450 line = line[ind_dollar+1:]
451 if statement:
--> 452 maxima_eval("#$%s$" % statement)
453 if not reformat:
454 return result
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:7698)()
793
794 """
--> 795 lispargs = EclObject(list(args))
796 return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
797
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__init__ (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:7221)()
658 """
659 if len(args) != 0:
--> 660 self.set_obj(python_to_ecl(args[0]))
661
662 def __reduce__(self):
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.python_to_ecl (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:6254)()
473 return Cnil
474 else:
--> 475 L=cl_cons(python_to_ecl(pyobj[0]),Cnil)
476 ptr=L
477 for a in pyobj[1:]:
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.python_to_ecl (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:5990)()
457 elif isinstance(pyobj,bytes):
458 s=<bytes>pyobj
--> 459 return ecl_safe_read_string(s)
460 elif isinstance(pyobj,Integer):
461 if pyobj >= MOST_NEGATIVE_FIXNUM and pyobj <= MOST_POSITIVE_FIXNUM:
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_read_string (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:5409)()
374 cdef cl_object o
375 o = ecl_cstring_to_base_string_or_nil(s)
--> 376 o = ecl_safe_funcall(read_from_string_clobj,o)
377 return o
378
/home/sage/sage-7.4/src/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_funcall (/home/sage/sage/src/build/cythonized/sage/libs/ecl.c:5208)()
355 if ecl_nvalues > 1:
356 s = si_coerce_to_base_string(ecl_values(1))
--> 357 raise RuntimeError("ECL says: "+ecl_base_string_pointer_safe(s))
358 else:
359 return ecl_values(0)
RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.