Plot inverse function Mathematica

In summary, to plot inverse function you need to:1) Set f to the solution set {{y->100 ...}}2) Use "Frame-> True" to change your "AxisLabel" to "FrameLabel"3) Plot[F,{x,-3,3}]
  • #1
meridian
3
0
I want to plot inverse function using Mathematica
Code:
In[1]:=f = Solve[x == a * Log[y/100], y]

Out[2] = {{y -> 100 E^(x/a)}}
and then? how to use this reult to plot?

ThanksAnother question is about the axeslabel, when I set the Frame->True, the AxesLabel can not be displayed correctly, where the label of x-coordinate is correct, but that of y-coordinate is missing, How to solve this problem?

thanks again
 
Last edited:
Physics news on Phys.org
  • #2
You can strip out the result from the brackets:

Code:
In[209]:= f = Solve[x == a*Log[y/100], y]
Out[209]= {{y->100 E^(x/a)}}
In[212]:= F = f[[1]][[1]][[2]]
Out[212]= 100 E^(x/a)

Then Plot[F,{x,-3,3}] to plot. (assuming you have a value for "a")
 
  • #3
Also, once you use "Frame-> True" you need to change your "AxisLabel" to a "FrameLabel". That should solve it.
 
  • #4
Hepth said:
You can strip out the result from the brackets:

Code:
In[209]:= f = Solve[x == a*Log[y/100], y]
Out[209]= {{y->100 E^(x/a)}}
In[212]:= F = f[[1]][[1]][[2]]
Out[212]= 100 E^(x/a)

Then Plot[F,{x,-3,3}] to plot. (assuming you have a value for "a")



I am completely a beginner therefore I would like to ask what you did in the In[212].. i mean what is the philosphy behind it..

Thank you in advance

Yannis
 
  • #5
ok:
209: I set f is the solution set {{y->100 ...}} etc
212: I basically say, take the 2nd component of the 1st component of the 1st component of "f"

So you have :
{{y->100 E^(x/a)}}[[1]] = {y->100 E^(x/a)}
{{y->100 E^(x/a)}}[[1]][[1]] = y->100 E^(x/a)
{{y->100 E^(x/a)}}[[1]][[1]][[2]] = 100 E^(x/a)

Basically the {}{} brackets are like a set, or table. And since its doubly thick {{X-> Y}} You need to pull out "Y".
the [[1]] and [[2]] takes the first or second or whatever value of the set preceeding it.
{1,2,3,4,3,2,1}[[5]] = 3 (indexed the 5th component)

If there were two solutions you would get to choose. Notice:

In[11]:= f = Solve[x^2 == 4, x]
Out[11]= {{x->-2},{x->2}}
In[12]:= f[[1]]
Out[12]= {x->-2}
In[13]:= f[[2]]
Out[13]= {x->2}
 
  • #6
Hepth said:
ok:
209: I set f is the solution set {{y->100 ...}} etc
212: I basically say, take the 2nd component of the 1st component of the 1st component of "f"

So you have :
{{y->100 E^(x/a)}}[[1]] = {y->100 E^(x/a)}
{{y->100 E^(x/a)}}[[1]][[1]] = y->100 E^(x/a)
{{y->100 E^(x/a)}}[[1]][[1]][[2]] = 100 E^(x/a)

Basically the {}{} brackets are like a set, or table. And since its doubly thick {{X-> Y}} You need to pull out "Y".
the [[1]] and [[2]] takes the first or second or whatever value of the set preceeding it.
{1,2,3,4,3,2,1}[[5]] = 3 (indexed the 5th component)

If there were two solutions you would get to choose. Notice:

In[11]:= f = Solve[x^2 == 4, x]
Out[11]= {{x->-2},{x->2}}
In[12]:= f[[1]]
Out[12]= {x->-2}
In[13]:= f[[2]]
Out[13]= {x->2}


Great! Just on time since I was trying to do exactly what u illustrate in your last example..thank u very much!
 

1. What is a plot inverse function in Mathematica?

A plot inverse function in Mathematica is a way to graphically represent the inverse of a given function. It allows you to visualize the relationship between the input and output values of a function and its inverse.

2. How do I plot an inverse function in Mathematica?

To plot an inverse function in Mathematica, you can use the InverseFunction[] command. First, define your original function using the Function[] command, and then use InverseFunction[] to find the inverse. Finally, use the Plot[] command to graph both functions on the same plot.

3. Can I customize the plot of an inverse function in Mathematica?

Yes, you can customize the plot of an inverse function in Mathematica by using various options in the Plot[] command. Some options include changing the color, style, and range of the plot, adding labels and legends, and adjusting the axes and ticks.

4. How can I check if the plotted inverse function is correct?

You can check the correctness of a plotted inverse function in Mathematica by using the Plot[] command with the InverseFunction[] function. If the plotted function and the original function intersect at a 45-degree angle, then the inverse function is correct.

5. What if I encounter errors while plotting an inverse function in Mathematica?

If you encounter errors while plotting an inverse function in Mathematica, first check the syntax of your commands and ensure that the functions are defined correctly. You can also refer to the Mathematica documentation or seek help from forums and online resources. Additionally, try using different options and parameters in the Plot[] command to see if that resolves the issue.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
240
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
745
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
886
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top