Re: Filling question
- To: mathgroup at smc.vnet.net
- Subject: [mg124462] Re: Filling question
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Fri, 20 Jan 2012 01:53:48 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jf8vdp$5p3$1@smc.vnet.net>
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