Here is the example that is the problem. Your last suggestion did
solve the problem with maxima.solve. But now how do I stop the other
\over.
-----------------------------------------------
def CSquare(r1):
eq11=r1;y=b*1
w1=maxima.subst(eq11,b,y)
w2 = latex(eq11); w5 = "$"+w2+"=0"+"$"
V1=p/2;RHalf=maxima.coeff(V1,p,1);#this is 1/2
LSide1a=maxima.lhs(w1)
L1= maxima.coeff(LSide1a,x,1)#coef of linear term
L2= maxima.coeff(LSide1a,x,0)#constant
L3= maxima.coeff(LSide1a,x**2,1)#constant
eq2=factor(w1)
eq4=(1/L3)*LSide1a#mult by coef of quad
eq10=expand(eq4)#div out the constant
#print eq10
R2 = latex(eq10);R3="$"+R2+"$"
M1=maxima.args(eq10);L10=len(M1)
Cof1=maxima.args(eq10);Cof1a=Cof1[1];Cof1b=Cof1[2]
Const = Cof1[2] #constant
Half2=maxima.coeff(Cof1a,x,1);
val2=(RHalf*(Half2))**2 #Addon
Addon=maxima.ev(val2*val2)
eq5=M1[0]+M1[1]+val2
Rside = -Cof1b+val2
eq22=eq5;z=b*1==Cof1b
w3=maxima.subst(eq5,b,z)
eq6=factor(eq5)
w4=maxima.subst(eq6,b,z)
LeftS=maxima.lhs(eq6+Rside)
eq7=Cof1a
eq8=Rside
Soln=solve(w1)
return w5,R3,eq5,eq22,eq6,Rside,Soln
-------------------------------------------------------------
Here is the output
'${x}^{2} - x - \\frac{3}{2}=0$'
'$x^2-x-{{3}\\over{2}}$'<<<<<<<<< the problem
x^2-x+1/4
x^2-x+1/4
(2*x-1)^2/4
7/4
[x=-(sqrt(7)-1)/2,x=(sqrt(7)+1)/2]
--------------------------------------------------
Input --val1=CSquare(x^2-x-3/2);val1[0];val1[1];val1[2];val1[3];val1
[4];val1[5];val1[6]
On Oct 6, 3:51 pm, "[email protected]" <[email protected]> wrote:
> This \over is from Maxima.
> try
>
> a1=maxima.solve(x^2-x-3,x)
> R1=a1[0]
> R3=maxima.rhs(R1).sage()
> latex(R3)
>
> R.
>
> On 6 říj, 22:25, Mikie <[email protected]> wrote:
>
>
>
> > Yes, your right. I am latexing a value from maxima.solve(x^2-x-3,x).
> > Then maxima.rhs(). Then latexing the value. It still gives me the
> > \over. I am using 3.4.
> > When I assign it to a variable it works as below. If you would try
> > a1=maxima.solve(x^2-x-3,x)
> > R1=a1[0]
> > R3=maxima.rhs[R1]
> > latex(R3)
> > produces -- {{1-\sqrt{13}}\over{2}}
> > not good
>
> > On Oct 6, 1:46 pm, "[email protected]" <[email protected]> wrote:
>
> > > Hm, this is my Sage 4.1.1
>
> > > a1=-(sqrt(13)-1)/2
> > > latex(a1)
>
> > > output is -\frac{1}{2} \, \sqrt{13} + \frac{1}{2}
>
> > > You may have old version of Sage
>
> > > latex(-{{\sqrt[13]-1\over[2}}) produces error
>
> > > Robert Marik
>
> > > On 6 říj, 21:10, Mikie <[email protected]> wrote:
>
> > > > If I have this a1=-(sqrt(13)-1)/2 in a variable, then latex(a1) it
> > > > produces -{{\sqrt[13]-1\over[2}}.
> > > > If I do latex(-{{\sqrt[13]-1\over[2}}) get \frac{1-\sqrt{13}}{2},
> > > > which is what I want.
>
> > > > This is in a function. I need the latter. The \over does not do the
> > > > pretty print.
> > > > Is there a work around?
> > > > Thanx
>
> > > > ------------------------------------
> > > > def Solver2a(exp1,exp2):
> > > > eq11=exp1;w=b*1==0
> > > > w1=maxima.subst(eq11,b,w)
> > > > R1 = maxima.solve(exp1,exp2);
> > > > w2 = latex(eq11); w3 = "$"+w2+"$"
> > > > R2 = latex(R1);R3="$"+R2+"$"
> > > > R4 = R1[0];R5=maxima.rhs(R4);R6=latex(R5);
> > > > str1="Calculate the symbolic solutions for the following
> > > > equation."
> > > > str2="And here is the solution :"
> > > > return str1,w3,str2,R1,R6,R5
> > > > -------------------------------------- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---