Message Boards Message Boards


Use FindRoot as a loop function?

Posted 2 years ago
1 Reply
0 Total Likes
FindRoot[{ω^2 == g k Tanh[k D], H0^2==H^2 (1+ 2 k D/Sinh[k D]) Tanh[k D]},{k,0.02},{H,6}]

I want to make this a function, which will solve for k and H for a given range of D. Can anyone help?

This is one way:

myLoopFunction[\[Omega]_, g_, D_, H0_] := 
  FindRoot[{\[Omega]^2 == g k Tanh[k D], 
    H0^2 == H^2 (1 + 2 k D/Sinh[k D]) Tanh[k D]}, {k, 0.02}, {H, 6}];
myLoopFunction[1, 1, 1, 1]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract