I have written 2 functions to calculate the stress and strain of a material, the strain function works perfectly, but the stress function which very similar to the Strain function did not return what I expected? Could you please shed some light on this issue?
Strain[neuaxis_, y_] := Module[{b = 0.003,a}, a = -b / neuaxis, a*y + b];
Stress[neuaxis_, y_] = Module[{temp, res, Es = 200*10^3, fsy = 500}, temp =
Strain[neuaxis, y] * Es res = If[temp > fsy, fsy, If[temp < -fsy, -fsy, temp]] res]
The function Strain[30, 50] gives -0.002 which is fine, but my function Stress[30, 50] returns me the unsatisfactory result as below:
res$61948 If[temp$61948 > 500, fsy$61948, If[temp$61948 < -fsy$61948, -fsy$61948, temp$61948]]
;after theres = If[...]statement. As a matter of fact, you really don't need theresvariable at all, sinceIfreturns a value. – MarcoB Jul 17 '16 at 06:05Stress[neuaxis_, y_] := Module[{temp, res, Es = 20010^3, fsy = 500}, temp = Strain[neuaxis, y]Es; res = If[temp > fsy, fsy, If[temp < -fsy, -fsy, temp]] ; res]`
– vapor Jul 17 '16 at 06:05