2
$\begingroup$

This question already has an answer here:

I want to numerically solve $$\cosh\left(\frac{1}{x}\right)-\frac{1}{x^2}\sinh\left(\frac{1}{x}\right)=0.$$

A strange thing is that Wolfram|Alpha it solves it perfectly, but Mathematica I have this:

enter image description here

How can this be possible?

$\endgroup$

marked as duplicate by Artes, m_goldberg, Daniel Lichtblau, MarcoB, LCarvalho Dec 18 '17 at 22:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ what is the output from Wolfram? $\endgroup$ – Sumit Dec 17 '17 at 11:32
  • $\begingroup$ Please post the input you gave to Wolfram alpha language also. The Wolfram alpha is different from the Wolfram Mathematica language. You could have typed something which Wolfram alpha understood to be something different from Wolfram mathematica, since Wolfram alpha is AI based and uses natural language input which is not the case with the Wolfram Mathematica language. $\endgroup$ – Nasser Dec 17 '17 at 11:40
  • $\begingroup$ Use FindRoot[Cosh[1/x] - 1/x^2 Sinh[1/x], {x, 1}] $\endgroup$ – Raffaele Dec 17 '17 at 15:01
  • 1
    $\begingroup$ @Nasser - this is the OP's input: wolframalpha.com/input/… $\endgroup$ – Jason B. Dec 17 '17 at 16:57
  • 1
    $\begingroup$ NSolve requires some domain restrictions so that there will be finitely many solutions. In[124]:= NSolve[ Cosh[1/x] - Sinh[1/x]/x^2 == 0 && 0 < x < 100, x, Reals] Out[124]= {{x -> 0.897517}} $\endgroup$ – Daniel Lichtblau Dec 17 '17 at 17:17
7
$\begingroup$

Usually NSolve is preferable for polynomical functions. You can solve your problems in this way:

FindRoot[Cosh[1/x] - Sinh[1/x]/x^2, {x, .1}] (* with startvalue *)
(* {x -> 0.897517} *)

or

NMinimize[{1, Cosh[1/x] - Sinh[1/x]/x^2 == 0}, x] (* without startvalue *)
(* {1., {x -> 0.897517}} *)
$\endgroup$
  • $\begingroup$ I did not know the f[x]==0 constraint + nminimize trick... is it yours? $\endgroup$ – Picaud Vincent Dec 17 '17 at 12:18
  • 1
    $\begingroup$ @Picaud Vincent: Unfortunately not ( ;-) ). I found it by chance someware in the advanced NMinimze documentation... $\endgroup$ – Ulrich Neumann Dec 17 '17 at 12:26
  • 1
    $\begingroup$ @PicaudVincent Related to this trick: mathematica.stackexchange.com/questions/159589/…. $\endgroup$ – anderstood Dec 17 '17 at 13:10
  • $\begingroup$ @anderstood thanks $\endgroup$ – Picaud Vincent Dec 17 '17 at 13:12
  • $\begingroup$ The NMinimize-trick can be found in the help NMinimize\NeatEaxamples! $\endgroup$ – Ulrich Neumann Dec 17 '17 at 15:44

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