Re: beginner's question -- syntax related?
- To: mathgroup at smc.vnet.net
- Subject: [mg13369] Re: [mg13284] beginner's question -- syntax related?
- From: BobHanlon at aol.com
- Date: Mon, 20 Jul 1998 02:50:22 -0400
- Sender: owner-wri-mathgroup at wolfram.com
John, Plot[{3-Sqrt[5-4x-x^2],3+Sqrt[5-4x-x^2]}, {x, -5, 0}]; ls[x_] := {3-Sqrt[5-4x-x^2],3+Sqrt[5-4x-x^2]}; ??Plot "Plot[f, {x, xmin, xmax}] generates a plot of f as a function of x from xmin \ to xmax. Plot[{f1, f2, ... }, {x, xmin, xmax}] plots several functions fi." Attributes[Plot] = {HoldAll, Protected} Options[Plot] = {AspectRatio -> GoldenRatio^(-1), Axes -> Automatic, AxesLabel -> None, AxesOrigin -> Automatic, AxesStyle -> Automatic, Background -> Automatic, ColorOutput -> Automatic, Compiled -> True, DefaultColor -> Automatic, Epilog -> {}, Frame -> False, FrameLabel -> None, FrameStyle -> Automatic, FrameTicks -> Automatic, GridLines -> None, ImageSize -> Automatic, MaxBend -> 10., PlotDivision -> 30., PlotLabel -> None, PlotPoints -> 25, PlotRange -> Automatic, PlotRegion -> Automatic, PlotStyle -> Automatic, Prolog -> {}, RotateLabel -> True, Ticks -> Automatic, DefaultFont :> $DefaultFont, DisplayFunction :> $DisplayFunction, FormatType :> $FormatType, TextStyle :> $TextStyle} Note that Plot has Attribute HoldAll. You need to Evaluate the list for Plot to work in the second form. Plot[Evaluate[ls[x]], {x,-5,0}]; Bob Hanlon In a message dated 7/17/98 8:53:51 AM, john at dlugosz.com wrote: >This works: Plot[{3-Sqrt[5-4x-x^2],3+Sqrt[5-4x-x^2]}, {x, -5, 0}] > >This doesn't: > ls := {3-Sqrt[5-4x-x^2],3+Sqrt[5-4x-x^2]}, {x, -5, 0} > > Plot[ls, {x,-5,0}] > >Somehow, the ls isn't getting taken as the list of two expressions. I >tried both = and := when creating ls, with the identical effect. > >Clearly, I'm missing something about syntax. Can someone help me?