0
$\begingroup$
ClearAll
(*befor finding the root for a lower stiffness use NSlove to find , \
then put that value back on the Rootfind and find the beta for \
varying stiffness *)
Y = 2*10^11;
Iyy = 8.333*10^-6;
L = 4;
z = Array[# &, 50, {0.01, 0.5}];
T = Length[z];
k = 10^12;(*1*10^b;*)
a = 1/(4*b^3*(1 - Cosh[b]*Cos[b]));
phi1 = ConstantArray[0, {T, 1}];
phi2 = ConstantArray[0, {T, 1}];
phi3 = ConstantArray[0, {T, 1}];
phi4 = ConstantArray[0, {T, 1}];
eq = ConstantArray[0, {T, 1}];
eq1 = ConstantArray[0, {T, 1}];
S = ConstantArray[0, {T, 1}];
om = ConstantArray[0, {T, 1}];
fn = ConstantArray[0, {T, 1}];
a1 = (Cos[b*x] - Cosh[b*x]);
a2 = (Sin[b*x] - Sinh[b*x]);
For[i = 2, i < T + 1, i++,
  phi1[[i]] = (Cos[b] - Cosh[b])*(Sin[b*(1 - z[[i]])] - 
      Sinh[b*(1 - z[[i]])]);
  phi2[[i]] = (Sin[b] - Sinh[b])*(Cos[b*(1 - z[[i]])] - 
      Cosh[b*(1 - z[[i]])]);
  phi3[[i]] = (Sin[b] + Sinh[b])*(Sin[b*(1 - z[[i]])] - 
      Sinh[b*(1 - z[[i]])]);
  phi4[[i]] = (Cos[b] - Cosh[b])*(Cos[b*(1 - z[[i]])] - 
      Cosh[b*(1 - z[[i]])]);
  eq[[i]] = 
   a ((phi1[[i]] - phi2[[i]])*(a1 /. x -> z[[i]]) + (phi3[[i]] + 
         phi4[[i]])*(a2 /. x -> z[[i]])); eq1[[i]] = 1 + (k*eq[[i]])];
f[x_] := eq1[[2]] /. b -> x;
p = Plot[f[x], {x, 0, 30}, Mesh -> {{0}}, MeshFunctions -> (f[#] &)]
seeds = Cases[Normal[p], Point[r_] : -> r[[1]], \[Infinity]]
roots = Tabel[
   x /. FindRoot[f[x], {x, s}], {s, 
    seeds}] \[Union] (SameTest -> (Abs[#1 - #2] < 1/10^-6 &))

tried to extract the first four roots (all the roots at a time ) of the transcendental equation but not working. It is throwing some error. find root, nsolve, find roots with the interval is also not working.

$\endgroup$
  • 2
    $\begingroup$ How about if you show the first place you get an error, provide code to duplicate that error, and tell us what the error is. "Not working" is not a very descriptive. $\endgroup$ – bill s Nov 22 '17 at 18:59
  • 1
    $\begingroup$ In the definition of seeds replace : -> with :> In the definition of roots. you misspelled Table. In the SameTest change 1/10^-6 (i.e., 10^6) with 10^-6 $\endgroup$ – Bob Hanlon Nov 22 '17 at 19:04
  • $\begingroup$ @BobHanlon [best answer] . thanks, problem solved. apparently, i did some typo i code . could you suggest me best coding practice? $\endgroup$ – Vijay Kumar S Nov 23 '17 at 7:07
0
$\begingroup$

You can use GraphicsMeshFindIntersections. Although this depends on the sampling (PlotPoints) of the plot (and your required accuracy):

p = Plot[{f[x], 0.}, {x, 0.1, 30}, PlotPoints -> 350];
intersections = Graphics`Mesh`FindIntersections[p] // Chop

Labeled[Show[p, Frame -> True, Axes -> False, 
Epilog -> {PointSize[.025], Red, Point[intersections]}], 
Style[#, 20] &@Column[N[intersections, 10], Frame -> All], Right]

enter image description here

Just bracket your interval to find the solutions you are looking for.

$\endgroup$
  • $\begingroup$ Thanks, alot sir. It was really helpful. Best answer $\endgroup$ – Vijay Kumar S Nov 24 '17 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.