aspose file tools*
The moose likes Meaningless Drivel and the fly likes Aaah, the beauty, the elegance... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "Aaah, the beauty, the elegance..." Watch "Aaah, the beauty, the elegance..." New topic
Author

Aaah, the beauty, the elegance...

Manku Thimma
Ranch Hand

Joined: Jul 18, 2001
Posts: 108
... 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).]


NN's new avatar.
Paul Ralph
Ranch Hand

Joined: Aug 10, 2000
Posts: 312
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

Joined: Dec 20, 2000
Posts: 782
The answer is:
8
Andy Ceponis
Ranch Hand

Joined: Dec 20, 2000
Posts: 782
or was it -4958390.328947234121?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I believe the canonical answer to this is:
42


"I'm not back." - Bill Harding, Twister
Manku Thimma
Ranch Hand

Joined: Jul 18, 2001
Posts: 108
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Apr 12, 2001
Posts: 1012
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.


what?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
> Do you guys have life?
Sorry Ronnie - not everyone has such sophisticated forms of entertainment as you enjoy.
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
busted!
did you notice that your ip is showing "onlooker"... i think jim just exposed you.
Ronnie Johnson
Ranch Hand

Joined: Jul 28, 2001
Posts: 106
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

Joined: Apr 12, 2001
Posts: 1012
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

Joined: Jul 28, 2001
Posts: 106
hehe
 
permaculture playing cards
 
subject: Aaah, the beauty, the elegance...
 
Similar Threads
interfaces and subclasses
assignment question doubt ??
Sorting question
JQuiz - Practice Questions for SCJP2 (10/19/2003)