1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

FZERO or some method of computing the intercept points in MATLAB or Mathematica

  1. Dec 14, 2008 #1
    1. The problem statement, all variables and given/known data

    General problem--I don't know how to solve for the characteristic equation in MATLAB or Mathematica to find the solution of an equations such as

    2. Relevant equations

    cosh(x)*cos(x) = x

    (I know you can re-write this equation but it's just an example)

    3. The attempt at a solution

    In Mathematica I tried:

    In[2]:= FindRoot[cos[x]*cosh[x] == x, {x, 0}]

    During evaluation of In[2]:= FindRoot::nlnum: The function value \
    {0.+cos[0.] cosh[0.]} is not a list of numbers with dimensions {1} at \
    {x} = {0.}. >>

    Out[2]= FindRoot[cos[x] cosh[x] == x, {x, 0}]

    In[4]:= Solve[cos[x]*cosh[x] == x, x]

    During evaluation of In[4]:= InverseFunction::ifun: Inverse functions \
    are being used. Values may be lost for multivalued inverses. >>

    During evaluation of In[4]:= InverseFunction::ifun: Inverse functions \
    are being used. Values may be lost for multivalued inverses. >>

    During evaluation of In[4]:= Solve::tdep: The equations appear to \
    involve the variables to be solved for in an essentially \
    non-algebraic way. >>

    Out[4]= Solve[cos[x] cosh[x] == x, x]


    Is there some method of doing this in either program? I know I can get intersection points on my calculator but that defeats the purpose of using these programs.
     
  2. jcsd
  3. Dec 14, 2008 #2
    You used this:

    "FindRoot[cos[x]*cosh[x] == x, {x, 0}]"

    SImply use capitals for the first letter of the functions like this:

    "FindRoot[Cos[x]*Cosh[x] == x, {x, 0}]"

    and you'll get x -> 0.893796

    Built-in functions in Mathematica all begin with capitals.
     
  4. Dec 14, 2008 #3
    Ah thanks for the reminder:

    question though, what if I have something more complex like:

    In[123]:= FindRoot[1 - Cos[x]*Cosh[x] == x*Sin (x)*Cosh (x), {x, 0}]

    During evaluation of In[123]:= FindRoot::nlnum: The function value \
    {0.+0. Cosh Sin} is not a list of numbers with dimensions {1} at {x} \
    = {0.}. >>

    Out[123]= FindRoot[1 - Cos[x] Cosh[x] == x Sin x Cosh x, {x, 0}]
     
  5. Dec 15, 2008 #4
    Your problem is that in the part of the expression to the right of the ==, you have used round parentheses to surround the variable x. Change them to square brackets, and it should work. I get a solution of {x -> 0.}.

    FindRoot[1 - Cos[x]*Cosh[x] == x*Sin [x]*Cosh [x], {x, 0}]

    If I use a starting point of 3, like this:

    FindRoot[1 - Cos[x]*Cosh[x] == x*Sin [x]*Cosh [x], {x, 3}]

    I get a solution of 2.74914
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: FZERO or some method of computing the intercept points in MATLAB or Mathematica
  1. MATLAB FZERO Help (Replies: 2)

  2. Matlab Newton's Method (Replies: 1)

Loading...