Sharedhyperspherical.ipynbOpen in CoCalc
Could you please help me to understand what the problem is with the solving of the system of equations? Thank you in advance. Cristina
var('r2 si co')
assume(r12>0,r22>0,r32>0,d32>0)
eq1 = r12==r2*d32*(1.-si*(co+(3.0*(1-co*co))^(1./2.))/2.)/2.
eq2 = r22==r2*d32*(1.-si*(co-(3.0*(1-co*co))^(1./2.))/2.)/2.
eq3 = r32==r2*d32*(1.+si*co)/2.0
eq1.show()
eq2.show()
eq3.show()
r12=0.500000000000000(0.500000000000000(co+3.00000000000000co2+3.00000000000000)si+1.00000000000000)d32r2r_{12} = 0.500000000000000 \, {\left(-0.500000000000000 \, {\left(\mathit{co} + \sqrt{-3.00000000000000 \, \mathit{co}^{2} + 3.00000000000000}\right)} \mathit{si} + 1.00000000000000\right)} d_{32} r_{2}
r22=0.500000000000000(0.500000000000000(co3.00000000000000co2+3.00000000000000)si+1.00000000000000)d32r2r_{22} = 0.500000000000000 \, {\left(-0.500000000000000 \, {\left(\mathit{co} - \sqrt{-3.00000000000000 \, \mathit{co}^{2} + 3.00000000000000}\right)} \mathit{si} + 1.00000000000000\right)} d_{32} r_{2}
r32=0.500000000000000(cosi+1.00000000000000)d32r2r_{32} = 0.500000000000000 \, {\left(\mathit{co} \mathit{si} + 1.00000000000000\right)} d_{32} r_{2}
solve([eq1,eq2,eq3],r2,si,co)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-21-23b2cb9ba4cb> in <module>() ----> 1 solve([eq1,eq2,eq3],r2,si,co) /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds) 1048 s = [] 1049 -> 1050 sol_list = string_to_list_of_solutions(repr(s)) 1051 1052 # Relaxed form suggested by Mike Hansen (#8553): /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.pyc in string_to_list_of_solutions(s) 578 from sage.structure.sequence import Sequence 579 from sage.calculus.calculus import symbolic_expression_from_maxima_string --> 580 v = symbolic_expression_from_maxima_string(s, equals_sub=True) 581 return Sequence(v, universe=Objects(), cr_str=True) 582 /ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in symbolic_expression_from_maxima_string(x, equals_sub, maxima) 2157 _augmented_syms = {} 2158 except SyntaxError: -> 2159 raise TypeError("unable to make sense of Maxima expression '%s' in Sage"%s) 2160 finally: 2161 is_simplified = False TypeError: unable to make sense of Maxima expression '[if((-pi/2<parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2)))and(parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2))<==pi/2),[_SAGE_VAR_co==-((2*_SAGE_VAR_r32-_SAGE_VAR_r22-_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAG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_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2),_SAGE_VAR_r2==(2*_SAGE_VAR_r32+2*_SAGE_VAR_r22+2*_SAGE_VAR_r12)/(3*_SAGE_VAR_d32),_SAGE_VAR_si==(2*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(_SAGE_VAR_r32+_SAGE_VAR_r22+_SAGE_VAR_r12)],union())]' in Sage
var('a')
solve(x^2-a,x)
[x == -sqrt(a), x == sqrt(a)]