[Tutor] attaching the first element in a list to a string

Sheila King sheila@thinkspot.net
Wed, 02 May 2001 18:42:04 -0700


On Wed, 02 May 2001 19:17:11 -0500, "Julieta Rangel"
<julieta_rangel@hotmail.com>  wrote about [Tutor] attaching the first element
in a list to a string:

:The integral of 2+5x^1+6x^2+1x^3 is:
:2.5+2.5x^2+2.0x^3+0.25x^4
:
:As you can see, the answer would be right if it weren't for the first term 
:in the polynomial.  The first term should be a 2x, so the answer should look 
:like this:  2x^1+2.5x^2+2x^3+0.25x^4.  Can anyone help me fix this problem?  
:I think that I need to find a way to have the first term on the list labeled 
:pc, which is 2 to be taken into consideration on the string representing the 
:polynomial.  Am I right?  If so, How can I accomplish this?  Also, I need to 
:find a way so that when the coefficient of x^0 ==0 , the output should 
:display a constant c along with the result, so that the answer looks like 
:c+2.5x^2+2x^3+0.23x^4.

I won't respond to the programming issues, since Benoit has already responded.
I'll wait and see if his help solves your problems.

But I'd like to address a math issue:
Shouldn't you have a +c constant added to your integral in *every* case? NOT
just when the coefficient of x^0 is equal to 0.

(BTW: the question is rhetorical. I KNOW that you *should* have it
there...typed the calculus teacher...)

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/