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

Click For Summary

Discussion Overview

The discussion revolves around solving the characteristic equation cosh(x)*cos(x) = x using MATLAB or Mathematica. Participants explore methods for finding intercept points and address issues encountered while using the FindRoot function in Mathematica.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant describes an attempt to use FindRoot in Mathematica but encounters errors related to function definitions and multivalued inverses.
  • Another participant suggests that the issue arises from using lowercase letters for built-in functions, recommending the use of capital letters instead.
  • A follow-up question is posed regarding a more complex equation, which leads to further discussion about the syntax required for the FindRoot function.
  • Another participant points out that using round parentheses instead of square brackets around the variable x causes errors, suggesting the correct syntax for the function to work properly.
  • Solutions are provided for different starting points in the FindRoot function, with specific numerical results mentioned.

Areas of Agreement / Disagreement

Participants generally agree on the importance of correct syntax in Mathematica for the FindRoot function, but the discussion includes unresolved issues regarding more complex equations and the implications of different starting points.

Contextual Notes

Limitations include potential misunderstandings of function syntax in Mathematica, as well as the complexity of the equations being solved, which may lead to different solutions based on starting points.

ko_kidd
Messages
21
Reaction score
0

Homework Statement



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

Homework Equations



cosh(x)*cos(x) = x

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

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.
 
Physics news on Phys.org
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.
 
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}]
 
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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
1
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K