Re: Small question about Filling between two functions in a
- To: mathgroup at smc.vnet.net
- Subject: [mg94522] Re: Small question about Filling between two functions in a
- From: Norbert Marxer <marxer at mec.li>
- Date: Mon, 15 Dec 2008 07:47:27 -0500 (EST)
- References: <ae0a817a0812090125u1b44a514v20082610b3a9d0a5@mail.gmail.com>
On 10 Dez., 05:11, "Felipe Mannshardt" <vexie.infam... at googlemail.com> wrote: > Forgot to add another thing, > > if i add, > > g[x], which is, g(x) = k(x) - u(x) > > g[x_]:=32+12 x-18 x^2+2 x^3 > > And also add it to the graph, > > Plot[{k[x],u[x],g[x]},{x,-2,10},Filling->{1->{2}}] > > Now, tell Mathematica to: > > Fill the area between k(x) and u(x) in the interval 2->8 (x Axis) > AND > Fill the area between g(x) and x-Axis in the same interval 2->8 (x Axis) > > Would this be possible in the same Plot ? (in one graph only) ? > > Thanks ! > > On Tue, Dec 9, 2008 at 10:25 AM, Felipe Mannshardt < > > > > vexie.infam... at googlemail.com> wrote: > > Hello, > > > i have been trying to get this working, without much success. > > > What i want, is to fill an area between two functions, but only between= the > > interval from x=2 to x=8 > > > I have, > > > u[x_]:=48x > > k[x_]:=2x^3-18x^2+60x+32 > > > Plot[{k[x], u[x]}, {x, -2, 10}, Filling -> {1 -> {2}}] > > > It draws (fills) every area between k(x) and u(x). > > > How can i tell Mathematica to just fill between a determined interval (= x > > Axis : 2->8 ) ? > > > Thanks ! > > > PS: Between, what is the most used way of pasting text from Mathematica= in > > here ? (Plain Text ? LATEX ? ??? ) > > > Thanks !!!- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - Hello If you want to do everything in one plot you can do it with the help of If[...] functions in the following way: Clear[u, k, g, x]; u[x_] := 48*x k[x_] := 2*x^3 - 18*x^2 + 60*x + 32 g[x_] = k[x] - u[x]; Plot[{u[x], k[x], g[x], If[2 < x < 8, u[x], k[x]], If[2 < x < 8, g[x], 0]}, {x, -2, 10}, Filling -> {4 -> {2}, 5 -> 0}] Best Regards Norbert Marxer