1

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?

Steve
  • 83
  • 1
  • 3

2 Answers2

1

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.

David Park
  • 2,613
  • 18
  • 14
1

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.

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453