1
$\begingroup$

How can I find the points of intersection of cosh(x) and sec(x)?

Plotting the two, I can see that it has a root around 4.7, but then I can't tell where the next root is.

But when I use FindRoot with a guess of 4.7 I don't get the root but if I use a guess between 4.72 and 4.8 then I find the root - 4.730040744862704.

Also, another root - 7.8532046241 can be found by guessing between 7.83 and 7.85.

Q: Is there a better way to solve the equation: Cosh[x]==Sec[x]? Q: How do I see the other points of intersection of the graphs y=Cosh[x] and y=Sec[x]?

Any help would be much appreciated. Thanks!

$\endgroup$
2
  • $\begingroup$ FYI FindRoot uses newtons method when you give it a single point and the secant method when you supply 2. The derivative of your function is very large near the root so newtons method shoots off far away from your guess on the first iteration. $\endgroup$
    – george2079
    May 10, 2018 at 15:41
  • $\begingroup$ Q: How do I see the other points of intersection of the graphs y=Cosh[x] and y=Sec[x]? $\endgroup$
    – Ashish
    May 14, 2018 at 15:35

2 Answers 2

3
$\begingroup$

You can use Solve or Reduce if you add a domain restriction:

N @ Solve[Cosh[x] == Sec[x] && -10<x<10, x]
N @ Reduce[Cosh[x] == Sec[x] && -10<x<10, x]

{{x -> 0.}, {x -> 0.}, {x -> 0.}, {x -> 0.}, {x -> -7.8532}, {x -> -4.73004}, {x -> 4.73004}, {x -> 7.8532}}

x == -7.8532 || x == -4.73004 || x == 0. || x == 4.73004 || x == 7.8532

(using NSolve directly seems to miss roots)

$\endgroup$
2
  • 1
    $\begingroup$ Solving N@Solve[Cosh[x]*Cos[x] - 1 == 0 && -10 < x < 10, x] is 20 times faster, presumably because it removes the singularity. $\endgroup$
    – anderstood
    May 10, 2018 at 15:13
  • $\begingroup$ Q: How do I see the other points of intersection of the graphs y=Cosh[x] and y=Sec[x]? $\endgroup$
    – Ashish
    May 14, 2018 at 15:35
0
$\begingroup$

From: About multi-root search in Mathematica for transcendental equations

Clear[findRoots]
Options[findRoots] = Options[Reduce];
findRoots[gl_Equal, {x_, von_, bis_}, 
prec : (_Integer?Positive | MachinePrecision | Infinity) : 
MachinePrecision, wrap_: Identity, opts : OptionsPattern[]] := 
Module[{work, glp, vonp, 
bisp}, {glp, vonp, bisp} = {gl, von, bis} /. 
r_Real :> SetPrecision[r, prec];
work = wrap@Reduce[{glp, vonp <= x <= bisp}, opts];
work = {ToRules[work]};
If[prec === Infinity, work, N[work, prec]]];

A domain restriction is -10 < x < 10

findRoots[Cosh[x] == Sec[x], {x, -10, 10}]

(* {{x -> -7.8532}, {x -> -4.73004}, {x -> 0.}, {x -> 4.73004}, {x -> 7.8532}} *)

Or:

findRoots[Cosh[x]*Cos[x] == 1, {x, -10, 10}](* 33 times faster *)

(* {{x -> -7.8532}, {x -> -4.73004}, {x -> 0.}, {x -> 4.73004}, {x -> 7.8532}}*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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