tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,31 @@
INSTALL @lib$+"ARRAYLIB"
*FLOAT 64
@% = &F0F
PRINT "Resistance = "; FNresistormesh(10, 10, 1, 1, 7, 6) " ohms"
END
DEF FNresistormesh(ni%, nj%, ai%, aj%, bi%, bj%)
LOCAL c%, i%, j%, k%, n%, A(), B()
n% = ni% * nj%
DIM A(n%-1, n%-1), B(n%-1, 0)
FOR i% = 0 TO ni%-1
FOR j% = 0 TO nj%-1
k% = i% * nj% + j%
IF i% = ai% AND j% = aj% THEN
A(k%, k%) = 1
ELSE
c% = 0
IF (i% + 1) < ni% c% += 1 : A(k%, k% + nj%) = -1
IF i% > 0 c% += 1 : A(k%, k% - nj%) = -1
IF (j% + 1) < nj% c% += 1 : A(k%, k% + 1) = -1
IF j% > 0 c% += 1 : A(k%, k% - 1) = -1
A(k%, k%) = c%
ENDIF
NEXT
NEXT
k% = bi% * nj% + bj%
B(k%, 0) = 1
PROC_invert(A())
B() = A().B()
= B(k%, 0)