MathGroup Archive 2003

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

Search the Archive

RE: I need some help about this error


>-----Original Message-----
>From: spin9 at terra.com.br [mailto:spin9 at terra.com.br]
To: mathgroup at smc.vnet.net
>Sent: Monday, February 10, 2003 7:08 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg39308] [mg39305] I need some help about this error
>
>
>f[x_] := x^2 - 2
>Ne[x_] := x - f[x]/f'[x]
>ap = NestList[Ne, 1.5, 5]
>tang[h_] := f[h] + f'[h](x - h)
>t = tang /@ ap
>
>Plot[{t}, {x, -10, 10}, AxesOrigin -> {0, 0}, 
>  PlotRange -> {{-5, 5}, {-3, 5}}] 
>
>Now, How can I plot the last command?
>
>I got the following errors:
>
>Plot::"plnr": "\!\(te[x]\) is not a machine-size real number at
>\!\(x\) = \
>\!\(-9.999999166666667`\)."
>Plot::"plnr": "\!\(te[x]\) is not a machine-size real number at
>\!\(x\) = \
>\!\(-9.188660168541684`\)."
>
>I want to make a "program" that will plot the successives tangent
>lines of approximations of any function (when possible) using the
>Newton Methods... any idea on how can I implement or solve that
>problem?
>
>Thank you very much!
>

In[8]:= Attributes[Plot]
Out[8]= {HoldAll, Protected}

So you have to evaluate your arguments. But, I fear, you'll not see too
much, as Newton convergences is to rapidly in this case; but here's the
method:

With[{delta = 10^-1, x0 = Sqrt[2]}, 
  Plot[Evaluate[Prepend[t, f[x]]], Evaluate[Prepend[x0 + delta*{-1, 1}, x]],

    PlotStyle -> Prepend[Table[{}, {Length[t]}], {Hue[0], Thickness[.005]}],

    PlotRange -> {All, Thread[f[x0 + delta*{-1, 1}]]}]]

You may play with delta, and pull large the graphics.

--
Hartmut Wolf



  • Prev by Date: Re: Simplify[Abs[x],x<0]]
  • Next by Date: Derivatives package
  • Previous by thread: Re: I need some help about this error
  • Next by thread: Re: I need some help about this error