Group Abstract Group Abstract

Message Boards Message Boards

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

Plot variables related by a transcendental equation

Posted 9 months 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

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!

Try:

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