HP 48G PROGRAMS FOR SYSTEM THEORY

[Total: 1    Average: 4/5]
There are currently SWs able to perform symbolic calculations and get results in short time. However having the ability to have a programmable calculator is still important during the exams. One of the programmable calculators that had a great story was the HP 48G. Below all the codes I did when examining the Systems Theory.

MATRIX RANGE

RANGE

This cose is able to perform the matrix range

in equations form

1: MATRIX

[shell]
« TRN NUCLEO DROP
DUP
IF { } ==
THEN
"IL RANGE
RAPPRESENTA TUTTO
LO SPAZIO"
MSGBOX DROP
ELSE DUP SIZE
‘DIM’ STO
IF ‘DIM(2)==2’
THEN { x1 x2 }
‘vet’ STO
[ 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==3’
THEN { x1 x2 x3
} ‘vet’ STO
[ 0 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==4’
THEN { x1 x2 x3
x4 } ‘vet’ STO
[ 0 0 0 0 ]
‘NUL’ STO
END ROW DROP ‘
DIM(1)’ EVAL ‘DIM’
STO 0 ‘cont’ STO 1
DIM EVAL
FOR j DUP
IF NUL ==
THEN DROP DIM
1 – ‘DIM’ STO
ELSE HOME
HURWI UTILITY A~~L
HOME RANGE vet *
…LIST 0 = Q DIM
ROLLD cont 1 +
‘cont’ STO
END
NEXT cont LIST
{ cont NUL vet DIM
n } PURGE
END
»
[/shell]

MATRIX CORE

 

CORE

 

This code is able to perform the matrix core

in both vector form and equations

 

1: MATRIX

[shell]
« ‘Fr’ STO Fr Fr
SIZE ‘DIM’ STO { ‘
DIM(1)’ } 0 CON ‘
DIM(2)+1’ EVAL COL+
‘Fr’ STO
IF ‘DIM(2)==2’
THEN { x1 x2 }
‘vet’ STO
[ 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==3’
THEN { x1 x2 x3 }
‘vet’ STO
[ 0 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==4’
THEN { x1 x2 x3
x4 } ‘vet’ STO
[ 0 0 0 0 ]
‘NUL’ STO
END Fr RREF COL
SWAP DROP 1 – COL
ROW DROP ‘DIM(1)’
EVAL ‘DIM’ STO 1
DIM 0 ‘cont’ STO
FOR j DUP
IF NUL ==
THEN DROP DIM 1
– ‘DIM’ STO
ELSE DUP HOME
HURWI UTILITY A~~L
HOME RANGE vet *
…LIST 0 = Q DIM 1
+ ROLLD DIM 1 +
ROLLD cont 1 +
‘cont’ STO
END
NEXT cont LIST
‘eqz’ STO cont ROW
‘matr’ STO { NUL
vet cont Fr } PURGE
matr SIZE ‘DIM’ STO
‘DIM(2)-DIM(1)’
EVAL ‘DIM3’ STO
IF DIM3 0 >
THEN 0 ‘n’ STO
DO { DIM3 ‘DIM(
2)’ } 0 CON ‘matr2’
STO matr ROW DROP
IF n 0 ‹
THEN 1 DIM3
FOR q DROP
NEXT
END matr2
ROW DROP ‘DIM(2)’
EVAL ROW ‘matr’
STO n 1 + ‘n’ STO n
‘m’ STO ‘DIM(1)’
EVAL 1 + ‘DIM(2)’
EVAL
FOR j
IF ‘n>DIM(2)’ THEN
1 ‘n’ STO END
matr {j n } 1 PUT ‘matr’
STO n 1 + ‘n’ STO
NEXT m ‘n’
STO
UNTIL matr RANK
‘DIM(2)’ EVAL ==
END { matr2 m }
PURGE ‘DIM(1)’ EVAL
1 + ‘DIM(2)’ EVAL
FOR j { ‘DIM(2)
‘ } 0 CON { j } 1
PUT matr LSQ 4 RND
NEXT DIM3 ROW
ELSE { }
END eqz { DIM
DIM3 matr eqz n }
PURGE »
[/shell]

EIGENVECTORS GENERALIZED

 

AUTGEN

 

This cose is able to perform generalized eigenvectors

 

3: autovalore

2: autovettore generalizzato di

   ordine appena minore

1: matrice

[shell]
« ‘Fr’ STO ‘avt’
STO ‘avl’ STO Fr
SIZE ‘DIM’ STO DIM
HEAD IDN avl * Fr –
‘Fr’ STO Fr avt NEG
DIM HEAD 1 + COL+
‘Frplus’ STO
IF Fr RANK Frplus
RANK ==
THEN Frplus ‘Fr’
STO
IF ‘DIM(2)==2’
THEN
[ 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==3’
THEN
[ 0 0 0 ]
‘NUL’ STO
END
IF ‘DIM(2)==4’
THEN
[ 0 0 0 0 ]
‘NUL’ STO
END Fr RREF
COL SWAP ‘avt’ STO
1 – COL ROW DROP
‘DIM(1)’ EVAL ‘DIM’
STO 1 DIM
FOR j DUP
IF NUL ==
THEN DROP DIM
1 – ‘DIM’ STO avt
ROW SWAP DROP 1 –
ROW ‘avt’ STO
ELSE DIM
ROLLD avt ROW
‘nue’ STO DIM ROLLD
nue ROW ‘avt’ STO
END
NEXT DIM ROW
‘matr’ STO matr
SIZE ‘DIM’ STO ‘DIM
(2)-DIM(1)’ EVAL
‘DIM3’ STO
IF DIM3 0 >
THEN 0 ‘n’ STO
DO { DIM3 ‘
DIM(2)’ } 0 CON
‘matr2’ STO { DIM3
} 0 CON ‘avt2’ STO
matr ROW DROP
IF n 0 ‹
THEN 1 DIM3
FOR q
DROP
NEXT
END avt
ROW ‘nue’ STO
IF n 0 ‹
THEN 1 DIM3
FOR q
DROP nue 1 – ‘nue’
STO
NEXT
END nue
ROW ‘avt’ STO
matr2 ROW DROP ‘
DIM(2)’ EVAL ROW
‘matr’ STO avt ROW
DROP avt2 ROW DROP
‘DIM(2)’ EVAL ROW
‘avt’ STO n 1 + ‘n’
STO n ‘m’ STO ‘DIM(
1)’ EVAL 1 + ‘DIM(2
)’ EVAL
FOR j matr
{ j n } 1 PUT
‘matr’ STO n 1 +
‘n’ STO
NEXT m ‘n’
STO
UNTIL matr
RANK ‘DIM(2)’ EVAL
==
END ‘DIM(1)’
EVAL 1 + ‘DIM(2)’
EVAL
FOR j avt { j
} 1 PUT matr LSQ 4
RND
NEXT DIM3
ROW
ELSE { }
END
ELSE
" Non ci sono
altri
autovettori
generalizzati"
MSGBOX
END { DIM Fr avt2
nue Frplus avl
matr2 m NUL vet
cont DIM3 eqz n
matr avt } PURGE
»
[/shell]

La lista completa di tutti le funzioni create sono presenti nel seguente file: