Question: Consistency and stability of numerical calculation

Hi

Please download and check the attached file.
It seems when you run the code more than one time, various results are obtained each time.

What is the reason? How it can be fixed?

Thanks


 

restart; Digits := 20; tm := time(); with(LinearAlgebra); m := 6; a := .1; b := 10*a; E := 1; h := 1; nu := .3; ur := -w*z+u0; u0 := 0; ut := add(add(T[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); w := (r-b)^2*(r-a)^2*add(add(W[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); er := diff(ur, r); et := ur/r+(diff(ut, t))/r; ert := 1/2*(diff(ut, r)-ut/r+(diff(ur, t))/r); u := -(1/2)*E*(2*er*et*nu+er^2+et^2)/(nu^2-1)+2*E*ert^2/(2+2*nu); N := sum(i+1, i = 0 .. m); PI := int(int(int(u*r, z = -(1/2)*h .. (1/2)*h), t = 0 .. 2*Pi), r = a .. b)-.5*P*(int(int(r*(diff(w, r))^2, r = a .. b), t = 0 .. 2*Pi)); s1 := seq(indets(add(add(T[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k], k = 1 .. N); s2 := seq(indets(add(add(W[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k+N], k = 1 .. N); PI := subs(s1, s2, PI); for k to 2*N do diff(PI, c[k]); if % = 0 then ex := `union`({}, {k}) else eq[k] := % end if end do; NE := seq(ex[j], j = 1 .. numelems(ex)); M := GenerateMatrix([`$`(eq[j], j = 1 .. 2*N)], [`$`(c[j], j = 1 .. 2*N)])[1]; M := DeleteColumn(DeleteRow(M, NE), NE); Determinant(M); 12*fsolve(%, P = 0 .. 1)*(-nu^2+1)*a^2/(E*h^3); Time = time()-tm

Time = 85.363

(1)

``


 

Download Stability.mw

Please Wait...