Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Mar 24th, 2006, 12:57 PM   #11
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Quote:
(X-1)(X+1) = (X-1)
X+1 = 1
Looked pretty cool but you're dividing by 0 when you divide through by (x - 1), so really that step is flawed. Heh.
Cerulean is offline   Reply With Quote
Old Mar 24th, 2006, 1:16 PM   #12
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
I like this one:

a = b (definition)
a^2 = ab (multiply both sides with a)
a^2 - b^2 = ab - b^2 (substract b^2)
(a - b)(a + b) = b(a - b) (factor)
a + b = b (delete the same terms)
2b = 1b (since a equals b)
2 = 1



has the same flaw as mjordan's, btw.
Polyphemus_ is offline   Reply With Quote
Old Mar 24th, 2006, 3:01 PM   #13
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 Cerulean
Looked pretty cool but you're dividing by 0 when you divide through by (x - 1), so really that step is flawed. Heh.
Shh! Nobody has to know!
__________________
"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 24th, 2006, 4:21 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Strange, MJ, that problem was on another forum I haunt in the last couple weeks.
__________________
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, 5:34 PM   #15
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Trolls only, eh? Suits ya.

I've known about that one for a while - pretty clever.

Anyway, back to converting an integer to a polynomial... to the OP: best think about what you're trying to do. It sure as hell ain't "converting", whatever that's supposed to mean. It might be integrating, as pal suggests...
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 24th, 2006, 5:54 PM   #16
mck134
Newbie
 
Join Date: Mar 2006
Posts: 3
Rep Power: 0 mck134 is on a distinguished road
what i meant by integer to polynomial is: suppose you have a very big number that can't be represented by a built-in integer data type. so you can take this number as a string, convert to a polynomial, do the operations like addition and than convert the result to a string and print. sth like 19375343 is 1*x^7 +9*x^6+....+4*x^1+3*x .
mck134 is offline   Reply With Quote
Old Mar 24th, 2006, 6:10 PM   #17
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Why would you use a string? Just make your own datatype:
class ReallyLong
{
    long number[8];
    
    // insert code to manage stuff
}
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 24th, 2006, 6:51 PM   #18
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Shoot, if that's what you need, why don't you just get a bignum library?
__________________
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 25th, 2006, 7:32 AM   #19
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Makes sense. For some reason I forgot there were already solutions out there.
__________________
Me :: You :: Them
Ooble 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 3:02 AM.

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