Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'defining functions' topicStudent Support Forum > General > "defining functions"

Next Comment >Help | Reply To Topic
Author Comment/Response
Randy Silvers
03/19/05 00:14am

I'm having trouble with the syntax to define an inverse function. I want to run the same routine but over different functional forms, so it is easier to define the function initially and not have to change it everywhere within the routine. Parts of the routine use the inverse function.

I define v[x_]:=x^.5

and v[9] returns 3, and v[x] returns x^.5

I want to define h[] to be the inverse function so that h[3] returns 9 and h[v] returns v^2

But, h[x_]:=InverseFunction[v[x]] yields h[3] returns InverseFunction[3]

If I use h[x_]:=InverseFunction[v][x], then h[3] returns v^(-1)[3] and h[p] returns v^(-1)[p]. These should be 3^2 and p^2.

Ultimately, I need that in the routine, for NMinimize to work.

If I define h[x_] as above, then the output is the list of the objective function and constraints that include v^(-1)

If instead I use the inelegant, direct h[x_]:=x^2, then the routine returns the numerical solutions. This is what I want.

How do I get Mathematica to treat h[x_]:=InverseFunction[v] the same as if I had defined h[x_]:=x^2?


Subject (listing for 'defining functions')
Author Date Posted
defining functions Randy Silvers 03/19/05 00:14am
Re: defining functions yehuda ben-s... 03/26/05 6:13pm
Re: defining functions Randy Silvers 04/13/05 08:54am
Next Comment >Help | Reply To Topic