Question: eval{recurse] Vs simplify with Side relations

This question is as much an observation of somthing I accidently stumbled across. I was using eval[recurse] to evaluate expressions reduced with LargeExpressions. I found eval['recurse'](eval['recurse']([Expr1 , Expr2] , [Q=.. Q1=.....])[]) to be better than simplify(eval['recurse']([Expr1 , Expr2] , [Q=.. Q1=.....])[]).

I only realised what was happening  when I put the below together. Then I could see the wood from the trees. 

It would be interesting to know why.

restart

 

Pt:=[[(sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(Q[6])*(t^2 + 1)/(sqrt(sqrt(Q[2])/(4*a*c - b^2)^2)*sqrt((2*sqrt(Q[2])*a*c^2*e^2 + 2*sqrt(Q[2])*b^2*c^2*f - 8*sqrt(Q[2])*a^3*c*f + 2*sqrt(Q[2])*a^2*b^2*f + 16*sqrt(Q[2])*a^2*c^2*f + 2*sqrt(Q[2])*a^2*c*d^2 - 4*sqrt(Q[2])*a^2*c*e^2 - 8*sqrt(Q[2])*a*c^3*f - 4*sqrt(Q[2])*a*c^2*d^2 + 2*sqrt(Q[2])*a^3*e^2 + 2*sqrt(Q[2])*c^3*d^2 - 2*sqrt(Q[2])*b*c^2*d*e + 4*sqrt(Q[2])*a*b*c*d*e - 2*sqrt(Q[2])*a^2*b*d*e - 4*sqrt(Q[2])*a*b^2*c*f + sqrt(Q[2])*sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(2*sqrt(Q[2]) - 2*Q[10])*Q[7] - 2*Q[11])*signum((sqrt(Q[2])*sqrt(2*sqrt(Q[2]) + 2*Q[10])*sqrt(2*sqrt(Q[2]) - 2*Q[10])*Q[7] - 8*((a - c)^2*sqrt(Q[2])/4 + Q[5]/4)*Q[8])*Q[4])*Q[4])*(t^2 - 1)) + 2*sqrt(2*sqrt(Q[2]) - 2*Q[10])*t*sqrt(Q[6])*Q[9]/(sqrt(sqrt(Q[2])/(4*a*c - b^2)^2)*sqrt((2*sqrt(Q[2])*a*c^2*e^2 + 2*sqrt(Q[2])*b^2*c^2*f - 8*sq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[5] = (a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(a + c), Q[6] = signum((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)/(4*a*c - b^2))*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)/(4*a*c - b^2), Q[7] = csgn((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(b*I + a - c)*I)*b, Q[8] = 4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2, Q[9] = csgn((4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)*(b*I + a - c)*I), Q[10] = (a - c)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2), Q[11] = (a + c)*(a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2]]:

length(Pt);  # was >27,000

5002

(1)

valsh:=[a = -9, b = -9, c = 16, d = -10, e = 7, f = -36]

[a = -9, b = -9, c = 16, d = -10, e = 7, f = -36]

(2)

S1:=eval['recurse'](Pt,valsh)[];

length(%)

 

[-(1/657)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*Q[6]^(1/2)*(t^2+1)*431649^(1/2)/(Q[2]^(1/4)*((-28903750*Q[2]^(1/2)+Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-2*Q[11])*signum((Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-8*((625/4)*Q[2]^(1/2)+(1/4)*Q[5])*Q[8])*Q[4])*Q[4])^(1/2)*(t^2-1))-(2/657)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*t*Q[6]^(1/2)*Q[9]*431649^(1/2)/(Q[2]^(1/4)*((-28903750*Q[2]^(1/2)+Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]+2*Q[11])*signum((Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]+8*(-(625/4)*Q[2]^(1/2)+(1/4)*Q[5])*Q[8])*Q[4])*Q[4])^(1/2)*(t^2-1))-257/657, (1/657)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[6]^(1/2)*(t^2+1)*Q[9]*431649^(1/2)/(Q[2]^(1/4)*((-28903750*Q[2]^(1/2)+Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-2*Q[11])*signum((Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]-8*((625/4)*Q[2]^(1/2)+(1/4)*Q[5])*Q[8])*Q[4])*Q[4])^(1/2)*(t^2-1))-(2/657)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*t*Q[6]^(1/2)*431649^(1/2)/(Q[2]^(1/4)*((-28903750*Q[2]^(1/2)+Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]+2*Q[11])*signum((Q[2]^(1/2)*(2*Q[2]^(1/2)+2*Q[10])^(1/2)*(2*Q[2]^(1/2)-2*Q[10])^(1/2)*Q[7]+8*(-(625/4)*Q[2]^(1/2)+(1/4)*Q[5])*Q[8])*Q[4])*Q[4])^(1/2)*(t^2-1))-24/73], [Q[2] = 377479229074, Q[4] = 1/377479229074, Q[5] = 114273866, Q[6] = 23123/657, Q[7] = -9, Q[8] = 23123, Q[9] = 1, Q[10] = -578075, Q[11] = 2642354603518]

 

2074

(3)

simplify(S1);# this is  simplify with side retations
length(%)

[-(257/248003853501618)*377479229074^(3/4)*((377479229074^(1/4)*(t^2-1)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)+(1/168849)*657^(1/2)*23123^(1/2)*431649^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(t^2+1))*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)+(2/168849)*23123^(1/2)*657^(1/2)*431649^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)*t)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t-1)*(t+1)), -(12/13777991861201)*377479229074^(3/4)*((377479229074^(1/4)*(t^2-1)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)-(1/141912)*657^(1/2)*23123^(1/2)*431649^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)*(t^2+1))*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)+(1/70956)*(2*377479229074^(1/2)-1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2))/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t-1)*(t+1))]

 

2316

(4)

simplify(%%);
length(%)

[-(1/71716466988)*(-2471*706^(1/2)+249218)^(1/2)*(2471*706^(1/2)+249218)^(1/2)*((73^(1/2)*(t^2+1)*(46246*706^(1/2)-1156150)^(1/2)+(257/3)*706^(1/4)*(14+2*706^(1/2))^(1/2)*t^2)*(-14+2*706^(1/2))^(1/2)+2*73^(1/2)*(t*(46246*706^(1/2)+1156150)^(1/2)*(14+2*706^(1/2))^(1/2)-257*706^(1/4)))*706^(1/4)/(t^2-1), (1/71716466988)*(-2471*706^(1/2)+249218)^(1/2)*((73^(1/2)*(t^2+1)*(46246*706^(1/2)+1156150)^(1/2)-72*706^(1/4)*(14+2*706^(1/2))^(1/2)*t^2)*(-14+2*706^(1/2))^(1/2)-2*73^(1/2)*((14+2*706^(1/2))^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*t-216*706^(1/4)))*(2471*706^(1/2)+249218)^(1/2)*706^(1/4)/(t^2-1)]

 

744

(5)

 

S2:=eval['recurse'](eval['recurse'](Pt,valsh)[]);# I find this interesting
length(%)

[-(1/162938531750563026)*(2*377479229074^(1/2)-1156150)^(1/2)*23123^(1/2)*657^(1/2)*(t^2+1)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t^2-1))-(1/81469265875281513)*(2*377479229074^(1/2)+1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*(t^2-1))-257/657, (1/162938531750563026)*(2*377479229074^(1/2)+1156150)^(1/2)*23123^(1/2)*657^(1/2)*(t^2+1)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)+14)^(1/2)*(t^2-1))-(1/81469265875281513)*(2*377479229074^(1/2)-1156150)^(1/2)*t*23123^(1/2)*657^(1/2)*431649^(1/2)*377479229074^(3/4)/(((9/377479229074)*377479229074^(1/2)*(2*377479229074^(1/2)-1156150)^(1/2)*(2*377479229074^(1/2)+1156150)^(1/2)+(625/8162419)*377479229074^(1/2)-14)^(1/2)*(t^2-1))-24/73]

 

1283

(6)

simplify(S2); #
length(%)

 

[-(1/406325592)*(14+2*706^(1/2))^(1/2)*(((181442/3)*(14+2*706^(1/2))^(1/2)*t^2+706^(3/4)*73^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*(t^2+1))*(-14+2*706^(1/2))^(1/2)+2*(46246*706^(1/2)+1156150)^(1/2)*73^(1/2)*706^(3/4)*(14+2*706^(1/2))^(1/2)*t-362884*73^(1/2))*(-14+2*706^(1/2))^(1/2)/(t^2-1), (14+2*706^(1/2))^(1/2)*((-2*706^(3/4)*73^(1/2)*(46246*706^(1/2)-1156150)^(1/2)*t-50832*(-14+2*706^(1/2))^(1/2)*t^2)*(14+2*706^(1/2))^(1/2)+(304992+(t^2+1)*(46246*706^(1/2)+1156150)^(1/2)*706^(3/4)*(-14+2*706^(1/2))^(1/2))*73^(1/2))*(-14+2*706^(1/2))^(1/2)/(406325592*t^2-406325592)]

 

705

(7)
 

 

Download 2024-05-31_Eval_Recurse_vs_Simplify_Side_Rels.mw

Please Wait...