![]() |
What would the easiest way to go about scripting, or writing a program, that output all the (positive) solutions to a 5dimensional problem?
for instance: (1/2)A + (1/4)B + (1/8)C + (1/16)D + (1/32)E = 1/2 |
I take it you mean (1/2)x + (1/4)x + (1/8)x + (1/16)x + (1/32)x = 1/2. The solution is to parse it into some sort of array or something that holds all the info, and then rearrange the equation I know this doesn't really help, but there's more ;). Apparently Perl is brilliant for this sort of thing - look it up.
|
I used different letters rather than "X" because each variable needs to be different based on the coefficient. I'll get back to this post once i work it out
|
Ah... you mean ax^5 + bx^4 + cx^3 + dx^2 + ex = 0? I see... sounds complicated...
|
may i ask why you need this?
|
Ooble, i mean as in :
(1/2)A + (1/4)B + (1/8)C + (1/16)D + (1/32)E = 1/2 as stated in my first post :P Ade: It was a homework assignment for my brother (he's 12, i think they were just supposed to guess the answer), and being the programming dood i am, i wanted to figure out if it could be done by a program, since most things can, but i didn't know where to start, so i came here |
Heh... sorry. That's my mind twisting things until they bear no resemblance to the original for ya.... be glad I'm not malicious :P
|
What Class? Pre-Calc? Or Calc?
|
I'm guessing you mean all integers for values A, B, C, D, E. I just limited this to a 10 due to time constraints. I'm not sure this is what you want, but run this and tell me:
:
#include <stdio.h> |
This all brings back painful memoriesof A-level math
|
| All times are GMT -5. The time now is 1:07 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC