1
$\begingroup$

why does the following instruction ok in mathematica, and it returns a boolean value

In[398]:= catenary[x, 1, 0, 0] == catenary[-x, 1, 0, 0]
Out[398]:= True

and not this one?

In[406]:= catenary[-x, 1, 0, 0] == -catenary[x, 1, 0, 0]
Out[406]:= Cosh[x] == -Cosh[x]

I wanted to have a boolean value too.. to prove the symmetry.. Thanks for your help!

$\endgroup$
1
  • 1
    $\begingroup$ Wrap the entire thing in TrueQ[] if need be. Less facetiously: your last equation is true for x an odd multiple of $\dfrac{\pi i}{2}$ and false otherwise. $\endgroup$ Jun 19, 2012 at 15:52

1 Answer 1

1
$\begingroup$

I think you should use three "="s, i.e.,

Cosh[x]===Cosh[-x]

(* True *)

If you need the Boolean value, then

Cosh[x] === Cosh[-x] // Boole

(* 1 *)

$\endgroup$
6
  • 1
    $\begingroup$ Cosh[x] == Cosh[-x] works fine; Mathematica is not too dumb to not know that the hyperbolic cosine is even. $\endgroup$ Jun 19, 2012 at 16:30
  • $\begingroup$ @J.M. But Sinh[x]==Sinh[-x] return itself, which is not the purpose of the programmer, whereas, Sinh[x]===Sinh[-x] works fine. $\endgroup$
    – yulinlinyu
    Jun 21, 2012 at 1:28
  • $\begingroup$ Again: Sinh[] is not the function in the OP. $\endgroup$ Jun 21, 2012 at 1:29
  • $\begingroup$ This is an example to illustrate the way to cope with the problem. I don't think the author need Cosh ONLY but no other functions. $\endgroup$
    – yulinlinyu
    Jun 21, 2012 at 1:31
  • 1
    $\begingroup$ You'd think that, until you see OP's other questions... $\endgroup$ Jun 21, 2012 at 1:32

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.