       RE: change of a coefficient in a polynomial

• To: mathgroup at smc.vnet.net
• Subject: [mg44793] RE: [mg44772] change of a coefficient in a polynomial
• From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
• Date: Thu, 27 Nov 2003 11:38:17 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```>-----Original Message-----
>From: Paolo Bientinesi [mailto:pauldj at cs.utexas.edu]
To: mathgroup at smc.vnet.net
>To: mathgroup at smc.vnet.net
>Subject: [mg44793] [mg44772] change of a coefficient in a polynomial
>
>
>
>assume you are given a polynomial
>
>p[x_] :=  c + c x + c x^2 ....
>
>and you want to generate a polynomial p1[x] from p[x]
>changing one coefficient only, like:
>
>p1[x_] := -c + c x + c x^2
>
>
>Is there any other way other than the obvious CoefficientList
>solution?
>
>Thanks
>--
>Paolo
>
>pauldj at cs.utexas.edu		        paolo.bientinesi at iit.cnr.it
>

Paolo,

as I have no idea of what you want to attain (what does that operation mean
in mathematical terms? has that something to do with polynomials at all?),

In:= p[x_] := SeriesData[x, 0, Array[c, {10000}, {0}]]
In:= p1[x_] := p[x] /. c -> somethingelse
In:= Coefficient[p1[x], x, 5000] // Timing
Out= {0.651 Second, somethingelse}
In:= p1[x]; // Timing
Out= {0.1 Second, Null}

In:= q = p[x];
In:= q1 = q + (somethingelse - Coefficient[q, x, 5000]) x^5000; // Timing
Out= {0.491 Second, Null}
In:= Coefficient[q1, x, 5000] // Timing
Out= {0.571 Second, somethingelse}
In:= q1; // Timing
Out= {0.01 Second, Null}

In:= cf = CoefficientList[q, x]; // Timing
Out= {0.641 Second, Null}
In:= cf[] // Timing
Out= {0.01 Second, c}
In:= cf1 = ReplacePart[cf, something, 5001]; // Timing
Out= {0.02 Second, Null}
In:= cf1[]
Out= something

--
Hartmut Wolf

```

• Prev by Date: Re: Table format gets lost while write to outputfile?
• Next by Date: Re: IO-Performance of Mathematica 4.1
• Previous by thread: Re: change of a coefficient in a polynomial