Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8016 > unrolled thread

Filling question

Started byGabriel Landi <gtlandi@gmail.com>
First post2012-01-19 11:39 +0000
Last post2012-01-20 06:57 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Filling question Gabriel Landi <gtlandi@gmail.com> - 2012-01-19 11:39 +0000
    Re: Filling question David Skulsky <edskulsky@gmail.com> - 2012-01-20 06:56 +0000
    Re: Filling question Peter Breitfeld <phbrf@t-online.de> - 2012-01-20 06:57 +0000

#8016 — Filling question

FromGabriel Landi <gtlandi@gmail.com>
Date2012-01-19 11:39 +0000
SubjectFilling question
Message-ID<jf8vdp$5p3$1@smc.vnet.net>
Here is a silly question: How to fill the region between two overlapping 
curves? e.g., the region near x=4 in

Plot[{Exp[-(x - 3)^2], Exp[-(x - 5)^2]}, {x, 0, 10}

Thanks in advance,

Gabriel Landi

[toc] | [next] | [standalone]


#8037

FromDavid Skulsky <edskulsky@gmail.com>
Date2012-01-20 06:56 +0000
Message-ID<jfb375$hro$1@smc.vnet.net>
In reply to#8016
Here's one way:

Plot[{Exp[-(x - 3)^2], Exp[-(x - 5)^2], 
  Min[{Exp[-(x - 3)^2], Exp[-(x - 5)^2]}]}, {x, 0, 10}, 
 Filling -> {3 -> 0}, PlotRange -> All]

David

[toc] | [prev] | [next] | [standalone]


#8039

FromPeter Breitfeld <phbrf@t-online.de>
Date2012-01-20 06:57 +0000
Message-ID<jfb393$hs8$1@smc.vnet.net>
In reply to#8016
Gabriel Landi wrote:

> Here is a silly question: How to fill the region between two overlapping 
> curves? e.g., the region near x=4 in
>
> Plot[{Exp[-(x - 3)^2], Exp[-(x - 5)^2]}, {x, 0, 10}
>
> Thanks in advance,
>
> Gabriel Landi
>

You may use a RegionPlot:

f[x_] = Exp[-(x - 3)^2]; 
g[x_] = Exp[-(x - 5)^2];
{xs, ys} = {x, f[x]} /. First@Solve[f[x] == g[x], x] // Quiet
region = y <= f[x] && x >= xs || y <= g[x] && x <= xs ;
Show[Plot[{f[x], g[x]}, {x, 0, 10}],
 RegionPlot[region, {x, 0, 10}, {y, 0, 10}]]

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web