       Re: change of a coefficient in a polynomial

• To: mathgroup at smc.vnet.net
• Subject: [mg44790] Re: change of a coefficient in a polynomial
• From: drbob at bigfoot.com (Bobby R. Treat)
• Date: Thu, 27 Nov 2003 11:38:14 -0500 (EST)
• References: <bpurvg\$oc7\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I had an error in my earlier post:

ClearAll[changeCoefficient]
changeCoefficient[poly_, x_, n_, target_] :=
Collect[poly + (target[Coefficient[poly, x, n]] -
Coefficient[poly, x, n])*x^n, x]

p[x_] := c + c*x + c*x^2
changeCoefficient[p[x], x, 0, -#1 & ]
changeCoefficient[p[x], x, 1, 1 & ]
changeCoefficient[p[x], x, 2, Sin]
changeCoefficient[p[x], x, 3, f]

-c + x*c + x^2*c
x + c + x^2*c
c + x*c + x^2*Sin[c]
c + x*c + x^2*c + x^3*f

Bobby

Paolo Bientinesi <pauldj at cs.utexas.edu> wrote in message news:<bpurvg\$oc7\$1 at smc.vnet.net>...
>
> 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

```

• Prev by Date: Re: Interpolation with random nodes
• Next by Date: Re: Remote Display on Linux still unsolved !
• Previous by thread: Re: change of a coefficient in a polynomial
• Next by thread: Re: change of a coefficient in a polynomial