File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Aaah, the beauty, the elegance...

 
Manku Thimma
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... of a recursive solution!
Solve for a<sub>1</sub> to a<sub>n</sub>, given b<sub>1</sub> to b<sub>n</sub>, and c<sub>1</sub> to c<sub>n</sub>:
a<sub>n</sub>b<sub>1</sub> = c<sub>1</sub>
a<sub>n-1</sub>b<sub>1</sub> + a<sub>n</sub>b<sub>2</sub> = c<sub>2</sub>
a<sub>n-2</sub>b<sub>1</sub> + a<sub>n-1</sub>b<sub>2</sub> + a<sub>n</sub>b<sub>3</sub> = c<sub>3</sub>
:
:
a<sub>1</sub>b<sub>1</sub> + a<sub>2</sub>b<sub>2</sub> + a<sub>3</sub>b<sub>3</sub> + ... + a<sub>n</sub>b<sub>n</sub> = c<sub>n</sub>

[This message has been edited by Manku Thimma (edited July 21, 2001).]
 
Paul Ralph
Ranch Hand
Posts: 313
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we get any more information?
As it is...
3 variables, 1 equation then...
5 variables, 2 equations
7 variables, 3 equations...and so forth.
Don't we need to know how the b variables relate to each other or how the b variables relate to the c variables?
Or something like that?
Paul R
 
Andy Ceponis
Ranch Hand
Posts: 782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is:
8
 
Andy Ceponis
Ranch Hand
Posts: 782
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or was it -4958390.328947234121?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the canonical answer to this is:
42
 
Manku Thimma
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are all these numbers popping up from?
You are given three arrays a, b, and c, with n elements each. Using the above set of equations, write a recursive function to fill in the elements 1 to n of array a, given the values in elements 1 to n in arrays b and c.
So, using the equations, a<sub>n</sub> = c<sub>1</sub>/b<sub>1</sub>. And now, using a<sub>n</sub>, we get a<sub>n-1</sub> = (c<sub>2</sub> - a<sub>n</sub>b<sub>2</sub>) / b<sub>1</sub>. And so on... to get a<sub>1</sub>. Enjoy!

[This message has been edited by Manku Thimma (edited July 23, 2001).]
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Do you guys have life? For god's sakes, why are you posting recursive functions on the net? Go out and do something social for crying out loud.
 
Greg Harris
Ranch Hand
Posts: 1012
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are you doing here? why are you worried about our tension breakers? do you not have anything better to do?
sorry, i just needed to vent my frustration.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Do you guys have life?
Sorry Ronnie - not everyone has such sophisticated forms of entertainment as you enjoy.
 
Greg Harris
Ranch Hand
Posts: 1012
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
busted!
did you notice that your ip is showing "onlooker"... i think jim just exposed you.
 
Ronnie Johnson
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Woah, guys, chill out, I did not post this, some girl named Neha at a camp i was just at saw me on the forum, and posted it, not I I happen to like mathematical puzzels, as for the Greg, you just look like a moron now, "Oh no!, They exposed me now!" I bet if you look at my IP now, you can find some more cool stuff on me, say for instance IT IS NOT THE SAME ONE. Greg, get a brain.

[This message has been edited by Ronnie Johnson (edited July 31, 2001).]
 
Greg Harris
Ranch Hand
Posts: 1012
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, ronnie, i guess i need to go see the wizard and ask to have my brain back... follow the yellow brick road, follow the yellow brick road, follow, follow, follow, follow, follow the yellow brick road... we're off to see the wizard, the wonderful wizard of oz!
(sorry, i removed the pic of the scarecrow)...
[This message has been edited by Greg Harris (edited August 14, 2001).]
 
Ronnie Johnson
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hehe
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic