Re: Plot a function with constants
- To: mathgroup at smc.vnet.net
- Subject: [mg36013] Re: [mg35998] Plot a function with constants
- From: BobHanlon at aol.com
- Date: Mon, 12 Aug 2002 03:34:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 8/11/02 6:39:20 AM, remi.dumasNOSPAM at club-internet.fr writes: >I would like to plot this function : > 1 >n(e)=______________ > Exp[b(e-mu)]+1 > >and get a graphic like that, with the letters > >n(e) > ^ > | > | >1| ____________ > | \ > | \ > | | > |_______________ \_____________________\ e > mu > / > >how can i do it, i specified >SetAttributes{b,constant} etc ... but it don't work > >please help me, i use mathematica 4 Needs["Graphics`Legend`"]; Needs["Graphics`Arrow`"]; 1/(Exp[b(e-mu)]+1); Rewrite the expression as 1/(Exp[b*mu(e/mu-1)]+1); % == %% // Simplify True In order to Plot the normalized function you must provide one or more specific values for the product b*mu With[{btm =4, edmMax = 3}, Plot[1/(Exp[btm(edm-1)]+1), {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], "n(e}"}, PlotStyle -> Hue[2/3], Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}]]; For multiple values With[{btmMin = -1,btmMax =4,edmMax = 3,n = 6}, Plot[Evaluate[ Table[1/(Exp[btm(edm-1)]+1), {btm,btmMin, btmMax, (btmMax-btmMin)/(n-1)}]], {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], "n(e}"}, PlotStyle -> Table[Hue[(btm-btmMin)/(btmMax-btmMin+3)], {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], PlotLegend-> Table[btm, {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], LegendPosition->{.85,-.35}, LegendLabel->"b*mu =", Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}, ImageSize -> 400]]; Just for laughs : With[{btmMin = -4,btmMax =4,edmMax = 2,n = 600}, Plot[Evaluate[ Table[1/(Exp[btm(edm-1)]+1), {btm,btmMin, btmMax, (btmMax-btmMin)/(n-1)}]], {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], "n(e}"}, PlotStyle -> Table[Hue[(btm-btmMin)/(btmMax-btmMin+3)], {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}, ImageSize -> 400]]; Bob Hanlon Chantilly, VA USA