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[0] + c[1]*x + c[2]*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[0] + x*c[1] + x^2*c[2] x + c[0] + x^2*c[2] c[0] + x*c[1] + x^2*Sin[c[2]] c[0] + x*c[1] + x^2*c[2] + x^3*f[0] Bobby Paolo Bientinesi <pauldj at cs.utexas.edu> wrote in message news:<bpurvg$oc7$1 at smc.vnet.net>... > Second question about polynomials: > > assume you are given a polynomial > > p[x_] := c[0] + c[1] x + c[2] x^2 .... > > and you want to generate a polynomial p1[x] from p[x] > changing one coefficient only, like: > > p1[x_] := -c[0] + c[1] x + c[2] x^2 > > > Is there any other way other than the obvious CoefficientList > solution? > > Thanks