Message Boards Message Boards

0
|
5182 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How do I Plot with an inverse function?

Posted 4 years ago

I want to plot a function which is dependent on v over p. I have another function for p[v] so i thought I could plot using the inverse function. Can somebody tell me what I did wrong here?

In[11]:= p[t_, v_] := (8*t*v^2 - 9 v^2 + 3)/((3 v - 1) v^2)

In[13]:= T = 0.95

Out[13]= 0.95

In[46]:= p1[v_] := p[T, v]

In[47]:= V[P_] := InverseFunction[p1][P]

In[48]:= Plot[-T*Log[3 V[p] - 1] + T/(3 V[p] - 1) - 9/(4 V[p]), {p, 0,
   2}]
Attachment

Attachments:
POSTED BY: Florian Maier
3 Replies

Try for example V[1] and you will see that V has complex values.The function p1 is not invertible. InverseFunction[p1] is picking a solution of an equation of third degree.

POSTED BY: Gianluca Gorni

Florian,

one should do one step after the other - and check after each whether the result makes sense. So, when you e.g. plot p1[v] it becomes obvious - as Gianluca has pointed out - that it cannot simply be inverted:

enter image description here

Say, you are interested in the right hand side only, you can continue like so:

p2[v_] := Piecewise[{{Infinity, v <= 0}}, p1[v]]
ip = InverseFunction[p2];
Plot[ip[t], {t, 0, 5}]

enter image description here

This looks promising, and then the final function can be plotted:

Plot[-T*Log[3 ip[t] - 1] + T/(3 ip[t] - 1) - 9/(4 ip[t]), {t, 0, 2}]

enter image description here


Here is still an important/interesting remark to make: The following does not work (as written in the o.p.):

Plot[-T*Log[3 ip[p] - 1] + T/(3 ip[p] - 1) - 9/(4 ip[p]), {p, 0, 2}]

i.e. p cannot be used as dummy variable here. The reason is that p must stay the head of the function you started with, but within Plot or Table it becomes a Block variable and will be temporarily redefined inside those environments. A simple example of that problem would read:

s[t_] := Sin[t]
Plot[s[s], {s, 0, 10}]

Does that all make sense to you?

POSTED BY: Henrik Schachner
Posted 4 years ago

Hello Gianluca and Henrik!

Thank you for your answers, now I understand what I did wrong.

POSTED BY: Updating Name
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract