Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plotting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72996] Re: Plotting
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Sun, 28 Jan 2007 00:51:51 -0500 (EST)

On 1/27/07 at 6:37 AM, ghcgwgwg at singnet.com.sg (Rayne) wrote:

>Hi all, I want to plot the cubic equation f(x) == x^3 - 16x^2 + 3x +
>1 == 0. I had:

>f==x^3-16 x^2+3 x+1 ==== 0 Plot[f,{x,-1,20}]

>but I was unable to get the plot.

If you have accurately posted what you tried, it should not be 
surprising Plot generates error messages.

x^3-16 x^2+3 x+1 === 0  will always evaluate to False since the 
expression x^3-16 x^2+3 x+1 is clearly not identical to 0. So, 
the expression

f==x^3-16 x^2+3 x+1 === 0

Evaluates to f==False.

Now this is an equation and does not define a value for f. So, 
when you try

Plot[f, {x, -1, 20}]

you are asking Mathematica to plot an undefined variable with no 
dependence on x. And the result is error message stating f has 
no numerical values.

Presumably you meant to define f as follows:

f = x^3-16 x^2+3 x+1 == 0

But while this does assign f a value, this is not something Plot 
will work with since

In[3]:=
f = x^3 - 16*x^2 + 3*x + 1 == 0

Out[3]=
x^3 - 16*x^2 + 3*x + 1 == 0

In[4]:=
f /. x -> 2

Out[4]=
False

That is f will evaluate to either True or False for any numeric 
value assigned to x.

You can of course do

Plot[x^3 - 16*x^2 + 3*x + 1, {x, -1, 20}];

Is this what you want?

Note:

In[5]:=
roots=NSolve[f, x]

Out[5]=
{{x -> -0.1726471308825491}, {x -> 0.3664487167738349},
   {x -> 15.806198414108714}}

That is your cubic has three real roots. So, perhaps you want a 
plot of the value of the cubic at these roots, i.e.,

ListPlot[{x /. #, x^3 - 16 x^2 + 3 x + 1 /. #}&/@roots,
          Frame->True, Axes->None, PlotStyle ->PointSize[.02]];
--
To reply via email subtract one hundred and four


  • Prev by Date: RE: Schlegel diagram
  • Next by Date: Re: Sequence of Bernoulli RVs
  • Previous by thread: Re: Plotting
  • Next by thread: Re: Plotting