Re: Creation and evaluation of polynomials
- To: mathgroup at smc.vnet.net
- Subject: [mg89453] Re: Creation and evaluation of polynomials
- From: dh <dh at metrohm.ch>
- Date: Tue, 10 Jun 2008 03:39:00 -0400 (EDT)
- References: <g2j05j$510$1@smc.vnet.net>
Hi,
could you please explain how {1,0,0,0,1,0,1} is related to p^5 + 3p^2?
Perhaps, you mean {0, 0, 3, 0, 0, 1}, what I could understand. If so,
there is no need to convert to a string:
p={0,0,3,0,0,1};
pol[p_,var_]:= p.Table[var^i,{i,0,Length[p]-1}];
pol[p,x]
hope this helps, Daniel
jmgomezgoo at gmail.com wrote:
> Hi!
>
> Image we have a function that create a Polynomial:
>
> polynomial[{1,0,0,0,1,0,1,}] -> p^5 + 3p^2
>
> And we want to calulate roots and the derivate of this polynomial.
>
> I try with ToString[polynomial[{1,0,0,0,1,0,1}]] in order to use
> convert the polynomial expression to string first and later use
>
> ToExpression[]
>
> and calculate roots
>
> D[ToExpression[ToString[polynomial[{1,0,0,0,1,0,1}]], x]
>
> like the next examples:
>
> D[ToExpression["x^2+2x"], x]
>
> or
>
> NSolve[ToExpression["x^2+2x==x"], x]
>
>
> But ToString erase ^ symbol.
>
> Somebody knows how to solve it?
>
>
> Warm regards
> -jm
>
>
>
--
Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>