Hyperbolic tangents ate my variable! [SOLVED]

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

Hyperbolic tangents ate my variable! [SOLVED]

Postby LordMantir » Tue Nov 03, 2009 7:25 pm UTC

I am in the unfortunate situation of having to plot a graph of the following form:
y = k_1 tanh(\frac{k_2 \cdot x}{y})

Is it possible to get the y outside the tanh without swallowing the other y up in an inverse hyperbolic tangent? My maths (starting Upper VIth double maths) doesn't stretch this far.

EDIT: Solved by plotting x = f(y). Not pretty but it works.
Last edited by LordMantir on Fri Nov 06, 2009 9:39 pm UTC, edited 1 time in total.
LordMantir
 
Posts: 26
Joined: Fri Jul 11, 2008 11:08 am UTC

Re: Hyperbolic tangents ate my variable!

Postby rhino » Tue Nov 03, 2009 8:05 pm UTC

EDIT:

Do you have to find y as a function of x in order to be able to plot?

(is this homework?)
User avatar
rhino
 
Posts: 115
Joined: Fri Dec 08, 2006 3:43 pm UTC
Location: Cambridge, UK

Re: Hyperbolic tangents ate my variable!

Postby Macbi » Tue Nov 03, 2009 8:17 pm UTC

You can certainly find x as a function of y, does that help?
User avatar
Macbi
 
Posts: 775
Joined: Mon Apr 09, 2007 8:32 am UTC

Re: Hyperbolic tangents ate my variable!

Postby LordMantir » Tue Nov 03, 2009 9:40 pm UTC

This is a possible extension to my A2 physics coursework. At the moment I am using the high- and low-value approximations for tanh x to plot two graphs on the same axes. So, kind of homework. The context is wave speed formulae: the actual formula I would like to plot is:
c = \frac{g}{2f\pi}tanh(\frac{2df\pi}{c})

for constant f, g and varying d. I could certainly, given enough time, plot an approximation using an iterative process, using last iteration's y values each iteration, but that's fiddly and also I don't have software available that will do that nicely. Getting x as a function of y is a possibility but not ideal.

If it's not easily done then the approximations are fine, but being a mathematician at heart I wanted to know if it was possible, hopefully piggybacking on someone else's experience of similar situations without trying to do it and ending up down a dead end and using up time that could be more productively spent actually finishing the coursework. After the deadline I will most likely have a better go at this myself - this is an interim solution, asking you guys for help!
LordMantir
 
Posts: 26
Joined: Fri Jul 11, 2008 11:08 am UTC

Re: Hyperbolic tangents ate my variable!

Postby rhino » Tue Nov 03, 2009 10:31 pm UTC

If you're hoping to rearrange the equation into something of the form y = f(x) then I can show that it can't be done:

Note that tanh is an odd function, in that tanh(-x) = -tanh(x).
From this it very quickly follows that if (x0,y0) solves your equation, then so does (x0,-y0). That means that y is not a function of x.
However, this is probably a "silly" problem because I assume that from the physical context, only one solution will make sense.

More worrying (though I can't prove it) is the possibility that you might not be able to obtain something like "y = plus or minus f(x)" where f is a "friendly" function built out of exponentials, trigonometric functions, polynomials and logs.

The good news is that you don't need to do this if all you're trying to do is draw an accurate graph (re-read the two posts above!)
User avatar
rhino
 
Posts: 115
Joined: Fri Dec 08, 2006 3:43 pm UTC
Location: Cambridge, UK

Re: Hyperbolic tangents ate my variable!

Postby BlackSails » Tue Nov 03, 2009 10:33 pm UTC

You could expand tanh in a taylor series, and take a bunch of terms.
User avatar
BlackSails
 
Posts: 2123
Joined: Thu Dec 20, 2007 5:48 am UTC

Re: Hyperbolic tangents ate my variable!

Postby Averazul » Wed Nov 04, 2009 2:54 am UTC

You can rearrange for x = f(y), graph that, then flip the graph along the line y = x
Averazul
 
Posts: 28
Joined: Mon Jul 21, 2008 2:27 am UTC
Location: San Luis Obispo, CA


Return to Mathematics

Who is online

Users browsing this forum: oliver_ and 4 guests