Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   integer number to polynomial (http://www.programmingforums.org/showthread.php?t=9008)

mck134 Mar 23rd, 2006 3:28 PM

integer number to polynomial
 
how can i convert an integer number to a polynomial? (i'm using c++)

DaWei Mar 23rd, 2006 4:55 PM

Neglecting the language, do you know how to convert an integer to a polynomial, otherwise? If not, the language is of no consequence.

Mjordan2nd Mar 23rd, 2006 6:05 PM

How would one convert an integer to a polynomial anyway? An integer is just a number, a polynomial is a multi-termed expression, or am I wrong?

DaWei Mar 23rd, 2006 6:15 PM

You are correct.

bl00dninja Mar 24th, 2006 1:26 AM

x^2 + 3*x - 7 = ???

there are limitless possibilities

Jimbo Mar 24th, 2006 1:40 AM

42, obviously... (x ~= 5.65)

pal Mar 24th, 2006 2:26 AM

well you can integrate integers in to polynomials.
for example, let say you have two integers (3 and 4).
polynomial would be.

int result = (3 * x) + (4 *y);

now you might want to obviously define those variables if you want to.
But since polynomials are there mathematically to solve for a variable, you might want to solve for one of those two x and y variables, if you already have a value of one those two (in terms of algebra).
will be able to code it. might have to actually recognize those as a string or char arrays to fiddle around like soliving algebraic problems. char and integer or string and integer conversions could be used as well, I'm sure there are many other ways too.

DaWei Mar 24th, 2006 9:00 AM

Quote:

convert an integer
Quote:

let say you have two integers
Top ten answers on the board, show me, "Two equals One"!
BRACCCCCCCCKKKKKKKKKKKKKKK!!!!!!!!!!! Bad answer, bad answer!!!

InfoGeek Mar 24th, 2006 12:25 PM

Let me take a dig at that...
An integer can be represented as a polynomial. Just put an X^0 next to it.

Mjordan2nd Mar 24th, 2006 1:22 PM

Quote:

Originally Posted by DaWei
show me, "Two equals One"!

Kk. ;)

Given that X=1:

x^2 = X
x^2-1 = X - 1
(X-1)(X+1) = (X-1)
X+1 = 1
2 = 1

:p

Found this on a site, found it quite intresting.


All times are GMT -5. The time now is 5:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC