Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 23rd, 2006, 2:28 PM   #1
mck134
Newbie
 
Join Date: Mar 2006
Posts: 3
Rep Power: 0 mck134 is on a distinguished road
integer number to polynomial

how can i convert an integer number to a polynomial? (i'm using c++)
mck134 is offline   Reply With Quote
Old Mar 23rd, 2006, 3:55 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Neglecting the language, do you know how to convert an integer to a polynomial, otherwise? If not, the language is of no consequence.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 23rd, 2006, 5:05 PM   #3
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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?
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Mar 23rd, 2006, 5:15 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You are correct.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 24th, 2006, 12:26 AM   #5
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
x^2 + 3*x - 7 = ???

there are limitless possibilities
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Mar 24th, 2006, 12:40 AM   #6
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3 Jimbo is on a distinguished road
42, obviously... (x ~= 5.65)
Jimbo is offline   Reply With Quote
Old Mar 24th, 2006, 1:26 AM   #7
pal
Programmer
 
pal's Avatar
 
Join Date: Mar 2005
Location: Washington
Posts: 90
Rep Power: 4 pal is on a distinguished road
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.
pal is offline   Reply With Quote
Old Mar 24th, 2006, 8:00 AM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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!!!
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 24th, 2006, 11:25 AM   #9
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
Let me take a dig at that...
An integer can be represented as a polynomial. Just put an X^0 next to it.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Mar 24th, 2006, 12:22 PM   #10
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:57 AM.

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