Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jan 6th, 2005, 12:04 AM   #1
Irhaha
Newbie
 
Join Date: Jan 2005
Posts: 3
Rep Power: 0 Irhaha is on a distinguished road
Hi everyone. I am a newbie in programming. Here comes a simple question, and please kindly help.

I am going to write a programme for a mathematical recurrence relation involving matrices, say
{X}_i = {X}_i-1 + {X}_i-2, where {X}_i is a 2x2 matrix, and {X}_0 and {X}_1 are known.

Should I declare {X}_i first before everything start? I just think of using a for loop to declare i matrices, but I don't know how to change the variable,i, in {X}_i in the declaration. Would anyone please kindly help answer this question?
Irhaha is offline   Reply With Quote
Old Jan 6th, 2005, 3:11 PM   #2
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
you could make a doubly-linked list of 2x2 arrays. that way you can make a cursor that can navigate through the list. The list elements would have to hold the 'i' and the array ex.
[{X}, 0]<=>[{X},1]<=>...<=>[{X},i-1]<=>[{X},i]
then your cursor can go through the list and find any array it needs, and also could easily go back and forth. Hope this helps you getting to where you're going. Let me know if you need more help.

-JSS
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Jan 6th, 2005, 11:56 PM   #3
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Instead of making a doubly linked list, just use the std::list class, much easier.
__________________
Clifford Matthew Roche &lt;geek@cliffordroche.com&gt;
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu 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 4:29 AM.

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