35 Reputation

3 years, 128 days

@Carl Love Thank you for your solut...

Thank you for your solution, the read statement works like I want it to. However, it will not accept the restart command which is in the .mpl file. Is there a way to clear all variabeles the second time it runs the file?

Thanks...

I wasn't clear in my problem statement, sorry for that. However, you interpreted my question correctly.

I found another solution, (similar to yours).

```restart; with(plots);
a := -1/2; b := 1/2; c := -2; d := 2; n := 20;
g := proc (x) options operator, arrow; value(Int(sigma(t), t = 0 .. x)) end proc;
sigma := proc (z) options operator, arrow; 2*sqrt(2*h^2-4*z^2)*z/h^2 end proc;
h := i/n;
f := proc (z) if z < 0.2 then 1 elif z = 0.2 then 1 else (z+1) end if end proc
for i from 1 to n do
an2[i] := plot(f(i/(n))*sigma(z),z=-1/(2)*h..1/(2)*h,view=[a..b,c..d], color=AQUAMARINE):
an3[i] := plot( 2*g(x),x = 0 .. (1/2)*h,view = [a .. b, c .. d], color = RED)
end do:
p := plots[display]([seq(an2[i], i = 1 .. n)], insequence = true);
q := plots[display]([seq(an3[i], i = 1 .. n)], insequence = true);
display(p, q)```

it works!...

plots[animate](plot, [piecewise(h > 1, tau[1], tau[2]), piecewise(h > 1, z = -(1/2)*J .. (1/2)*J, z = -(1/2)*h .. (1/2)*h), color = piecewise(h > 1, red, blue), legend = shear*stress], h = 0 .. 1+1/sqrt(3), frames = 51)

and it works! Thank you very much for your answer, I didn't know you could use piecewise like that. Moreover I didn't expect reactions so fast, thanks again. Graduation is one step closer ;)