Message Boards Message Boards

1
|
442 Views
|
5 Replies
|
10 Total Likes
View groups...
Share
Share this post:

Plot variables related by a transcendental equation

Posted 18 days ago

Hello!

I need help generating a plot, but I don't understand the mechanics of Mathematica well enough to generate what I need.

I'm trying to plot q as a function of L, and I have the constraints

2 L == z (1+Tanh[z])

and

q == -z^2 / (2 L^2)

I've tried several different approaches, but I can't get what I need.

The closest I've come is to use ContourPlot[], as described at https://mathematica.stackexchange.com/questions/22445/plotting-the-solutions-to-a-transcendental-equation. With this technique, I am able to plot z as a function of L:

ContourPlot[ 
 L == z  (1 + Tanh[z])/2), {z, 0, 5}, {L, 0, 
  10}]  (* Not the plot I need *)

Unfortunately, I don't see how to extend it to plotting q as a function of L.

Any help would be most appreciated.

Thanks,

Chris

P.S. This is the non-dimensionalized energy, q, of the double Dirac well problem as a function of the non-dimensionalized separation, L.

5 Replies

Try:

POSTED BY: Mariusz Iwaniuk

POSTED BY: Michael Rogers

Simpler:

 ContourPlot[Evaluate[2 L == z (1 + Tanh[z]) /. Solve[q == -z^2/(2 L^2), z]], {L, -1/3, 
   3}, {q, -5, 0}, Frame -> False, Axes -> True, 
  AxesLabel -> Automatic, PlotPoints -> 100, 
  ContourStyle -> {Blue, Blue}] 

Regards M.I.

POSTED BY: Mariusz Iwaniuk

Thanks, Mariusz! That's just what I needed. Thanks for helping me while I learn Mathematica.

After doing battle with Mathematica for a while (before I saw your post), I tried a different approach and found an analytical solution to the problem and went with that. Your response is still helpful to me, though: In trying to understand how your solution works, I had to better understand the /. notation. Now that you forced me to dig deeper, I can see that your approach is rather straight-forward.

Thanks again!

Michael:

(1) Once I noticed it could be re-cast as a parametric plot, that's what I went with. (You seem to have noticed it faster than I did.)

(2) Thank you VERY MUCH for your note about the Lambert W solution. I'm a recovering engineer, and I have begun a new journey to a PhD in theoretical physics. I'll set aside time to study this approach.

Your comments are especially valuable because I'm still preparing for my PhD effort by taking MIT's OCW classes in physics. As such, I don't have a professor to guide me, so tips like this are great.

Thank you.

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