Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Plotting multivariable integration

I am trying to plot an inverse function. If I do something like this:

 g[x_] := Sin[x]

 F[x_] := NIntegrate[g[y], {y, 0, x}]

 ParametricPlot[{F[x], x}, {x, 0, 2 Pi}]

I get the following error message

"NIntegrate::nlim: y = x is not a valid limit of integration. >>"

However, I also get a plot which is correct. Am I doing something wrong or should I just ignore the error message?

share|improve this question

marked as duplicate by Jens, Sjoerd C. de Vries, rcollyer, R. M. Jan 28 '13 at 15:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Change F[x_] to F[x_?NumericQ]. – b.gatessucks Jan 22 '13 at 19:36
I changed F[x_] to F[x_?NumericQ], but the result was the same. – Steve Jan 23 '13 at 22:39
@Steve The result was the same, because you probably still have the older definition in memory. Use ClearAll[f] before making the new definition. – Sjoerd C. de Vries Jan 28 '13 at 14:51

Do you really mean you want the inverse function of Sin[x]? Then why not just ArcSin[y]? Or if you want to Solve for it:

Solve[Sin[x] == y, x]
Simplify[%, C[1] == 0]

{{x -> ConditionalExpression[\[Pi] - ArcSin[y] + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}, {x -> 
   ConditionalExpression[ArcSin[y] + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}}
{{x -> \[Pi] - ArcSin[y]}, {x -> ArcSin[y]}}

Plot[{ArcSin[y], \[Pi] - ArcSin[y]}, {y, -1, 1},
 Frame -> True]

enter image description here

Of course, the inverse function is multivalued and those are just two branches.

share|improve this answer

Just showing you what @b.gatessucks told you in his comment earlier:

g[x_] := Sin[x]
f[x_?NumericQ] := NIntegrate[g[y], {y, 0, x}]
ParametricPlot[{f[x], x}, {x, 0, 2 Pi}, AspectRatio -> 1]

Mathematica graphics

1) Two warnings: Many times this "trick" doesn't work because you've already defined your function. Do a ClearAll or start a fresh Mma session.

2) Remember to start your symbols with lowercase.

This post may help you too.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.