RE: How to use inversefunction
- To: mathgroup at smc.vnet.net
- Subject: [mg36229] RE: [mg36189] How to use inversefunction
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 27 Aug 2002 02:07:45 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
David, Except in a few cases, Mathematica will not automatically generate the inverse function for you. You will have to Solve the equations and construct the inverse function yourself. In two of your three cases there are actually multiple inverse functions. Taking the easy one first. Clear[x]; Solve[f[x] == f, x][[1, 1]] // Simplify x[f_] = x /. % x -> (3 + 2*f)/(1 - f) (3 + 2*f)/(1 - f) So we now have the inverse function. x[f] (3 + 2*f)/(1 - f) For the quadratic equation there are two solution. Clear[x] sols = Solve[f[x] == f, x] {{x -> (1/2)*(7 - Sqrt[9 + 4*f])}, {x -> (1/2)*(7 + Sqrt[9 + 4*f])}} We define the two solutions and identify them by an index. x[1][f_] = x /. sols[[1, 1]] x[2][f_] = x /. sols[[2, 1]] (1/2)*(7 - Sqrt[9 + 4*f]) (1/2)*(7 + Sqrt[9 + 4*f]) For the third example there is a double infinity of solutions. Clear[x] sols = Solve[f[x] == f, x] Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some \ solutions may not be found." {{x -> -(ArcSin[f]/3)}} Using some trigonometry we can define the solutions as (I hope I got this right) Clear[x]; x[1, n_][f_] = (-ArcSin[f] + 2 Pi n)/3 x[2, n_][f_] = (-Pi + ArcSin[f] + 2Pi n)/3 Here are some of the solutions for f = 1/2. Table[x[1, n][1/2], {n, -5, 5}]~Join~Table[x[1, n][1/2], {n, -5, 5}] // Sort f /@ % {-((61*Pi)/18), -((61*Pi)/18), -((49*Pi)/18), -((49*Pi)/18), -((37*Pi)/18), -((37*Pi)/18), -((25*Pi)/18), -((25*Pi)/18), -((13*Pi)/18), -((13*Pi)/18), -(Pi/18), -(Pi/18), (11*Pi)/18, (11*Pi)/18, (23*Pi)/18, (23*Pi)/18, (35*Pi)/18, (35*Pi)/18, (47*Pi)/18, (47*Pi)/18, (59*Pi)/18, (59*Pi)/18} {1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2} Generally, when you want inverse functions you are going have to do some work. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: David [mailto:davidol at hushmail.com] To: mathgroup at smc.vnet.net How can I get mathematica to display the inverse of functions like: f(x) = x^2 - 7*x + 10 or f(x) = cos(3*x + 1/2*pi) or f(x) = (x - 3) / (x + 2) I'm having trouble getting the syntax right.