MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: fill in harberger triangle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115602] Re: fill in harberger triangle
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 16 Jan 2011 05:52:14 -0500 (EST)

I don't like the logic or paradigm of Epilog, so I'd do it this way:

a = 10.2;
e = 1.4;
q[p_] = 10.2 p^1.4;
lowerBound = p /. Solve[q[p] == 100, p][[1]] // Quiet;
Show[Plot[q[p], {p, 0, 30}, PlotRange -> {0, Automatic}],
  Plot[q[p], {p, lowerBound, 20}, Filling -> 100],
  Graphics[{Line[{{0, 100}, {30, 100}}], Line[{{20, 0}, {20, 1200}}]}]]

A "complete" graphics object covering the full range of x and y values  
must go first, or things go very wrong.

This shows nothing but the filled area:

a = 10.2;
e = 1.4;
q[p_] = 10.2 p^1.4;
lowerBound = p /. Solve[q[p] == 100, p][[1]] // Quiet;
Show[Plot[q[p], {p, lowerBound, 20}, Filling -> 100],
  Plot[q[p], {p, 0, 30}, PlotRange -> {0, Automatic}],
  Graphics[{Line[{{0, 100}, {30, 100}}], Line[{{20, 0}, {20, 1200}}]}]]

And this shows nothing but the lines, with a ridiculous aspect ratio:

a = 10.2;
e = 1.4;
q[p_] = 10.2 p^1.4;
lowerBound = p /. Solve[q[p] == 100, p][[1]] // Quiet;
Show[Graphics[{Line[{{0, 100}, {30, 100}}],
    Line[{{20, 0}, {20, 1200}}]}],
  Plot[q[p], {p, 0, 30}, PlotRange -> {0, Automatic}],
  Plot[q[p], {p, lowerBound, 20}, Filling -> 100]]

Stupid, I know... but that's the way it is.

Bobby

On Sat, 15 Jan 2011 03:42:37 -0600, Sjoerd C. de Vries  
<sjoerd.c.devries at gmail.com> wrote:

> I usually cheat by drawing the same graph twice, with slightly
> different settings like below:
>
> a = 10.2;
> e = 1.4;
> q[p_] = 10.2 p^1.4;
> lowerBound = p /. Solve[q[p] == 100, p][[1]] // Quiet;
> Show[
>  Plot[q[p], {p, 0, 30}, PlotRange -> {0, Automatic},
>   Epilog -> {Line[{{0, 100}, {30, 100}}],
>     Line[{{20, 0}, {20, 1200}}]}],
>  Plot[q[p], {p, lowerBound, 20}, Filling -> 100]
>  ]
>
> BTW I take it you meant to say: a horizontal line with Q (instead of
> P) = 100 and a vertical line with P (instead of Q) = 20
>
> Cheers -- Sjoerd
>
> On Jan 14, 12:21 pm, r_poetic <radford.scha... at mms.gov> wrote:
>> Hello,
>> while the Filling option for Plot is great, how can I use it (or
>> another feature of Mathematica 8) to fill in only the area between a
>> curve and a vertical line and a horizontal line?  For instance,
>> between (1) the function Q= A * P ^ E, where A and E are given
>> constants, (2) a horizontal line e.g. P = 100, and (3) a vertical
>> line, e.g. Q = 20.  The fill is only inside the triangle-like area.
>> This would be the "harberger triangle" showing consumer surplus in
>> economics.
>>
>> Thanks!
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Help on compiling a function
  • Next by Date: Washington DC Area Mathematica Special Interest Group
  • Previous by thread: Re: fill in harberger triangle
  • Next by thread: Re: fill in harberger triangle