Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to reproduce the following graph on Jensen's inequality for the probabilistic case (source: wikipedia) but with

  • the exponential function as Y,
  • the normal distribution on the X-axis and therefore
  • the log-normal distribution on the Y-axis coming out or the transformation.

enter image description here

I am not really a well versed user of Mathematica and here I don't have any idea whatsoever how to achieve the task. Thank you for your help.

EDIT: To be more specific: I know how to plot the original distribution. What I don't know is how to turn the resulting distribution around by 90° in the same diagram.

share|improve this question
    
Have you already tried anything or browsed the online help or this site for related questions? Showing at least some effort on your behalf will better your chances of getting help. –  Yves Klett Feb 6 '13 at 10:31
    
There's a Plot command. Have a look at the online help for it, and see how you get on. –  cormullion Feb 6 '13 at 10:33
2  
@vonjd No worries - my mind-reading skills not working well today... :) –  cormullion Feb 6 '13 at 11:34
1  
Imagine me sighing when first taking a look at your question. Reconsidered. –  Yves Klett Feb 6 '13 at 12:05
3  
You'll certainly avoid downvotes in this kind of questions simply by posting your (perhaps non-working but self-contained) minimal code sample. –  belisarius Feb 6 '13 at 13:25
show 5 more comments

1 Answer 1

up vote 14 down vote accepted

To make this plot, you first need to know about PDF, which gives the probability distribution functions for various distributions. Your distributions are NormalDistribution and LogNormalDistribution, which isn't too hard to figure out. To make the normal plot, you can just use Plot. Since the log-normal is vertical, you need something else; ParametricPlot works well. The exponential is pretty trivial.

The styling of each line is done using PlotStyle. The L-shaped lines can be added as an Epilog to a Plot, but since I'm combining several plots already, I just made a separate Graphics object for them. I also add the stray Text at the same time.

We remove the numeric ticks by setting Ticks to a custom set, which we use to mark the E(X) and Y(E(X). The axes labels are just AxesLabel and we get pretty arrows by adding Arrowheads to AxesStyle.

Module[{xlist = {3/4, 1/3, 1/2, 5/4}}, 
 Show[Plot[PDF[NormalDistribution[1, 0.2]][x], {x, 0, 2}, 
   PlotStyle -> Directive[Dashed, Gray]], Plot[Exp[x], {x, 0, 2}], 
  ParametricPlot[{PDF[LogNormalDistribution[1, 0.2]][y], y}, {y, 0, 
    5}, PlotStyle -> Directive[Dashed, Gray]], 
  Graphics[{Transpose[{{Red, Black, Black, Black}, 
      Line[{{#, 0}, {#, Exp[#]}, {0, Exp[#]}}] & /@ xlist}], {Blue, 
     Text[Y == \[CurlyPhi][X], {3/2, Exp[3/2]}, {1.1, 0}]}}], 
  PlotRange -> {{0, 2}, {0, 5}}, 
  Ticks -> {{{First[xlist], \[DoubleStruckCapitalE][X]}}, {{Exp[
       First[xlist]], Y[\[DoubleStruckCapitalE][X]]}}}, 
  AspectRatio -> 1, AxesLabel -> {X, Y}, 
  AxesStyle -> Arrowheads[{0.05}]]]

final graphic

share|improve this answer
    
Wow - Thank you: +1! –  vonjd Feb 6 '13 at 11:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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