Question: Time consuming code

Hi dear friends

How do I improve my ability to manipulate code?

Thanks

_________________________________________________________________________________________

 

restart:

Digits := 30: m := 20: p0 := 8.: g := -0.3: nu := 0.3: a := 1:


w := sum(b[n]*r^(1.02*n), n = 1 .. m):


ODE := r^3*(g*r+a)^3*(diff(w, r, r, r, r))+2*(diff(w, r, r, r))*r^2*(4*g*r+a)*(g*r+a)^2+(diff(w, r, r))*r*(3*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2+11*g^3*r^3+3*a^2*g*nu*r+15*a*g^2*r^2+3*a^2*g*r-a^3)+(diff(w, r))*(6*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2-2*g^3*r^3-3*a*g^2*r^2+a^3):


for P from p0 by 0.1e-1 to p0+1 do
W := simplify(subs(solve({seq(evalf(subs(r = j/(m+2), ODE)), j = 2 .. m-1), subs(r = 1, diff(w, r))}, {seq(b[j], j = 1 .. m)}), w/b[m])):
F := (int(((diff(W, `$`(r, 2))+(diff(W, r))/r)^2-(2*(1-nu))*(diff(W, `$`(r, 2)))*(diff(W, r))/r)*r*(1+g*r/a)^3, r = 0 .. a))/(int((diff(W, r))^2*r, r = 0 .. a)):
delta[trunc(100*(P-p0))] := abs(F-P) end do:


plot(W, r = 0 .. a);


Min := min(seq(delta[j], j = 0 .. 100)):


for j from 0 to 100 do if delta[j] = Min then print(p0+j/(100.)) else  end if end do;

Please Wait...