Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10002 > unrolled thread

finding inverses of functions

Started byJohn Accardi <accardi@accardi.com>
First post2012-05-09 07:51 +0000
Last post2012-05-10 08:56 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  finding inverses of functions John Accardi <accardi@accardi.com> - 2012-05-09 07:51 +0000
    Re: finding inverses of functions Szabolcs Horvát <szhorvat@gmail.com> - 2012-05-10 09:02 +0000
    Re: finding inverses of functions Peter Breitfeld <phbrf@t-online.de> - 2012-05-10 08:56 +0000
    Re: finding inverses of functions A Retey <awnl@gmx-topmail.de> - 2012-05-10 08:56 +0000

#10002 — finding inverses of functions

FromJohn Accardi <accardi@accardi.com>
Date2012-05-09 07:51 +0000
Subjectfinding inverses of functions
Message-ID<jod7lu$5f8$1@smc.vnet.net>
Hello,  I am trying to get Mathematica to find the inverse of:

y = 3x^3 + 2e^(2x)  (which I know is invertible)

InverseFunction only seems to give inverses of built-ins, like Sine.

I tried: 

Solve[ y == 3x^3 + 2e^(2x), x ] but get a message that Solve does not have methods suitable.  (Solve works for simpler functions, however.)

Any ideas?  Thanks.

[toc] | [next] | [standalone]


#10018

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2012-05-10 09:02 +0000
Message-ID<jog06m$g3f$1@smc.vnet.net>
In reply to#10002
On 2012.05.09. 9:51, John Accardi wrote:
> Hello,  I am trying to get Mathematica to find the inverse of:
>
> y = 3x^3 + 2e^(2x)  (which I know is invertible)
>
> InverseFunction only seems to give inverses of built-ins, like Sine.
>
> I tried:
>
> Solve[ y == 3x^3 + 2e^(2x), x ] but get a message that Solve does not have methods suitable.  (Solve works for simpler functions, however.)
>
> Any ideas?  Thanks.
>

While it's easy to see that this function has an inverse on the set of 
reals, the inverse function might not be expressible using elementary 
functions.

This doesn't prevent Mathematica from being able to compute the inverse 
function to arbitrary precision at any point.

Let's write it as a pure function:

   f = Function[x, 3 x^3 + 2 E^(2 x)]

Note that Exp[1] is written as E, and not as e.

The inverse of this function is represented in Mathematica with

   if = InverseFunction[f]

Since you know that the inverse exists, you can use this confidently. 
You can evaluate it for machine numbers like this:

In[63]:= if[1.]
Out[63]= -0.305526

Or for exact numbers like this:

In[64]:= if[1]
Out[64]= Root[{-1 + 2 E^(2 #1) + 3 #1^3 &, 
-0.305526037783858835745318654576}]

Note that this is an exact result that can be evaluated to arbitrary 
precision:

In[65]:= N[%, 100]
Out[65]= 
-0.3055260377838588357453186545759642671712616849155334618731589419894350889720642702908817009965973507

I recommend reading this blog post:

http://blog.wolfram.com/2008/12/18/mathematica-7-johannes-kepler-and-transcendental-roots/

-- 
Szabolcs Horvát
Visit Mathematica.SE:  http://mathematica.stackexchange.com/

[toc] | [prev] | [next] | [standalone]


#10020

FromPeter Breitfeld <phbrf@t-online.de>
Date2012-05-10 08:56 +0000
Message-ID<jofvr7$fum$1@smc.vnet.net>
In reply to#10002
John Accardi wrote:

> Hello,  I am trying to get Mathematica to find the inverse of:
>
> y = 3x^3 + 2e^(2x)  (which I know is invertible)
>
> InverseFunction only seems to give inverses of built-ins, like Sine.
>
> I tried: 
>
> Solve[ y == 3x^3 + 2e^(2x), x ] but get a message that Solve does not have methods suitable.  (Solve works for simpler functions, however.)
>
> Any ideas?  Thanks.
>

Because your function is trancendental you can't hope for a closed form.
But InverseFunction can be used:

f[x_] = 3 x^3 + E^(2 x)
g[y_] = InverseFunction[f][y]

Plot[f[x], {x, -2, 3}]
Plot[g[y], {y, -50, 250}]

-- 
_________________________________________________________________
Peter Breitfeld | Bad Saulgau, Germany | http://www.pBreitfeld.de

[toc] | [prev] | [next] | [standalone]


#10021

FromA Retey <awnl@gmx-topmail.de>
Date2012-05-10 08:56 +0000
Message-ID<jofvs6$fv1$1@smc.vnet.net>
In reply to#10002
Am 09.05.2012 09:51, schrieb John Accardi:
> Hello,  I am trying to get Mathematica to find the inverse of:
>
> y  = 3x^3 + 2e^(2x)  (which I know is invertible)

but do you know a symbolic solution? I think solving equations of this 
type symbolically is difficult, if not impossible in general.

> InverseFunction only seems to give inverses of built-ins, like Sine.

InverseFunction works as designed for your case, it just doesn't provide 
a simple symbolic expression. But this works as expected:

finv = InverseFunction[3 #^3 + 2 E^(2 #) &]

Plot[finv[x], {x, -10, 10}]

note that the InverseFunction object represents the inverse function 
without the need to actually be able to determine a symbolic expression 
in general. It can be used like any other function definition in most 
functions that work with functions and they will return values when 
given arguments. The same is true for InterpolatingFunction and 
CompiledFunction objects.

In this case InverseFunction returns Root objects for exact numbers 
(e.g. finv[1]) and floating point approximations for floating point 
arguments (e.g. finv[1.]). Probably that's the best a computer program 
can do for a general case like this. TI consider this the true power of 
Mathematica :-)

hth,

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web