Group Abstract Group Abstract

Message Boards Message Boards

0
|
19.3K Views
|
11 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Plot inverse functions?

Posted 9 years ago
POSTED BY: Devin Luu
11 Replies
Posted 9 years ago
POSTED BY: Brad Klee
Posted 9 years ago
POSTED BY: Devin Luu
Posted 9 years ago

Perhaps ArcTan[x,y] instead of ArcTan[x/y]

V[r_, ?_] := Exp[-(r - 1)^2]*(Exp[-?^2] + Exp[-(? - 2 ?/3)^2] + Exp[-(? + 2 ?/3)^2]) /. ?->ArcTan[x, y];
TransformedField["Polar"->"Cartesian", V[r, ?], {r, ?}->{x, y}];
ContourPlot[%, {x, -2, 2}, {y, -2, 2}, PlotRange -> All]

enter image description here

Read the help page carefully to make certain the order of x,y and x/y are correct in your ArcTan.

POSTED BY: Bill Simpson
Posted 9 years ago

Hi Bill, can I ask what version of Mathematica you are using? I've copied and pasted the exact same code onto my notebook and am still having the same problem.

enter image description here

POSTED BY: Devin Luu
Posted 9 years ago

In V10.1 it displays without the discontinuity.

In V11.1 it displays with the discontinuity.

Perhaps you can think very carefully, write your own version of TransformedField and see if you can avoid the discontinuity.

Perhaps someone can look at the internal details of TransformedField and see if the implementation has shown "unexpected behavior".

POSTED BY: Bill Simpson
Posted 9 years ago

Use the option Exclusions -> None to ContourPlot

V[r_, \[CurlyPhi]_] := 
  Exp[-(r - 1)^2]*(Exp[-\[CurlyPhi]^2] + 
      Exp[-(\[CurlyPhi] - 2 \[Pi]/3)^2] + 
      Exp[-(\[CurlyPhi] + 2 \[Pi]/3)^2]) /. \[CurlyPhi] -> 
    ArcTan[x, y];
TransformedField["Polar" -> "Cartesian", 
  V[r, \[CurlyPhi]], {r, \[CurlyPhi]} -> {x, y}];
ContourPlot[%, {x, -2, 2}, {y, -2, 2}, PlotRange -> All, 
 Exclusions -> None]
POSTED BY: Hans Milton
Posted 9 years ago

You know what Hans? That was it.

Thank you.

POSTED BY: Devin Luu
Posted 9 years ago

Good responses all around, and I agree. It's useful to think about the conditions where you expect an inverse function to exist, and how are the inverse functions defined or calculated from first principles?

You should conclude that the notion of an inverse function is essentially a local concept, limited to domains where the direct function is either strictly increasing or strictly decreasing.

Then, if necessary, you can program functionality to "patch" your direct and inverse functions. For example:

Show[
 Plot[Cos[x], {x, -Pi, 0}],
 Plot[Cos[x], {x, 0, Pi}, PlotStyle -> Red], PlotRange -> All,
 ImageSize -> 500
 ]

Cosine

Extrapolate this patching scheme to the entire domain, taking advantage of translation ivariance. Then permute $x$ and $y$ axis, and you will calculate the following patched inverse function

Show[

Plot[
-ArcCos[x] + 2 Pi # & /@ Range[-5, 5], {x, -1, 1}, 
PlotRange -> {-10, 10}, PlotStyle -> Blue],
Plot[
ArcCos[x] + 2 Pi # & /@ Range[-5, 5], {x, -1, 1}, 
PlotRange -> {-10, 10}, PlotStyle -> Red],
ListPlot[{Cos[#], #} & /@ (Range[-150, 100]/10), 
PlotMarkers -> {Automatic, 10}]]

Patches 2

Thanks, Brad.

POSTED BY: Brad Klee

In simple terms, x = Cos[theta] is a multivalued function. Many values of theta (in fact, an infinite number, theta + 2 n pi) give the same value of x. In mathematical jargon, ArcCos[x] is an injective but not a bijective function.

POSTED BY: S M Blinder

To put it in simple terms, if ArcCos did not evaluate to a number it would be fairly useless. Same for Log and all the rest.

As for multiple solutions to trig equations, there is Solve and Reduce. Example:

In[203]:= Solve[Cos[x] == 1, x]

(* Out[203]= {{x ->  ConditionalExpression[2 \[Pi] C[1], C[1] \[Element] Integers]}} *)
POSTED BY: Daniel Lichtblau

Is this more like what you wanted?

ParametricPlot[{Cos[t], t}, {t, -2 Pi, 2 Pi}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard