gettingstarted
[Top] [All Lists]

Re: Invert an array

To: gettingstarted at lists dot realsoftware dot com
Subject: Re: Invert an array
From: GAmoore at aol dot com
Date: Sun, 21 Dec 2003 14:36:28 EST
Invert an array or invert a square matrix? 

If you want to go backward in an array you can just index it like this :   A( 
n-i)  instead of A(i).  
     i           =       0        1          2        3
A( i)          =    A(0)    A(1)    A(2)    A(3)
A( 3-i)      =    A(3)    A(2)    A(1)    A(0)

As for inverting an array, you would have to program that yourself. Thats a 
good programming exercise for a class project. Probably compute the determinant 
first, to see if its invertible. Then set up a n x 2n matrix (A + I), and do 
row ops. However, you will decimal entries unless you are lucky enough to have 
all integers. If you want actual fractions, you will need to double the 
array, and keep track of numerator and denominator separately.


>Is there a function in RB to invert an array, or do I have to do it 
>myself?  I just learned how to solve simultaneous equations using 
>matrices on our calculators in math class this week, and I thought I 
>could make a program in RB that goes just a little faster than the 
>version I made on my calculator.  My computer is only a few powers of 
>ten faster than my calculator...  :)

 - - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>