Why There is No Built-in Function in MATLAB to Calculate sinhd as There is One for sind?
5 views (last 30 days)
Show older comments
Why??
2 Comments
David Goodmanson
on 20 Jun 2020
Hi Ahmed,
since sinh is not a periodic function, there would appear to be little demand for the sinh function in degrees. Do you have an example?
John D'Errico
on 20 Jun 2020
Funny. I even upvoted the question (something I admittedly rarely tend to do) since even though as a mathematician I know it makes no sense to do this, I can see where the question comes from, and why someone would ask it.
Answers (1)
John D'Errico
on 20 Jun 2020
Edited: John D'Errico
on 20 Jun 2020
Because it would make absolutely no mathematical sense to do so? Really, this is a reasonable question, since I can see how it arises.
The standard trig functions: sin, cos, tan, etc., are all defined in terms of radians. However some people would prefer to use degrees. Converting radians to degrees is a trivial thing to do, just multiply by pi/180 to convert degrees to radians, or by 180/pi to go from radians to degrees. There are even functions provided in MATLAB to convert in each direction, thus rad2deg and deg2rad.
However, many people (I would guess mostly students) seem to think better in degrees, and radians seem a bit foreign to some. I think that was even true for me in my very early days, before it just became natural to think in radians. Anyway, at some point in time The Mathworks introduced sind, cosd, etc. I'm almost positive the sind/cosd/etc. functions were not in the really early releases of MATLAB when I started, However, the help tells me only they were introduced before R2006a, which is not actually that far back. Gosh, I've been retired longer than that. :)
Anyway, it really does make sense to have sind, etc., since so many people just think in degrees.
But even though the hyperbolic trig functions have similar names as the regular trig functions, that does not mean they have any meaning in terms of degrees versus radians. The hyperbolic trig functions are NOT periodic functions at all.
And, while the regular trig functions have you looking at a circle, the hyperbolic functions are really more like exponential functions in their shape and behavior. We can derive an arc of a hyperbola from them, but not a circle.
That is, the parametric curve (cos(t),sin(t)) will create a unit circle as t varies from 0 to 2*pi. However, if we form the parametric curve (cosh(t),sinh(t)), we will see a hyperbolic arc. Try it.
t = linspace(0,2*pi);
s = linspace(-2,2);
plot(cos(t),sin(t),'-b',cosh(s),sinh(s),'-r')
axis equal

While they are both described as conic sections, the similarity does not extend forever.
The hyperbolic trig functions have lots of identities that look vaguely like those you know for the regulat trig functions. For example, whereas we know that
sin(x)^2 + cos(x)^2 = 1
we have
sinh(x) + cosh(x) = exp(x)
but also
cosh(x)^2 - sinh(x)^2 = 1
So the hyperbolic trig functions have many similarities to the classical ones. But the similarities have a limit. There is no reasonable meaning we can put to using degrees for the hyperbolic trig functions instead of radians. Therefore, there is no sinhd function provided, since it has no reason to exist.
In the rare case that you have some reason to want sinhd to exist, nothing at all stops you from defining such a function. (Seriously, I cannot see why.) But this is the beauty of MATLAB. You can define any function you want.
sinhd = @(D) sinh(D*pi/180);
God only knows why you want it though.
0 Comments
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!