Post Reply 
Combine Export and Local variables?
03-28-2022, 10:20 AM
Post: #2
RE: Combine Export and Local variables?
(03-28-2022 09:47 AM)Amer7 Wrote:  Hello,

I have this matrix program.
Idea:
1.) I will use default calculator matrix editor to input values into Matrix M1,M2,M3

2.) At the beginning of the program I want to use Input command to input a 2 variables. Their values are later used in the calculation in few places.

Issue:
I want to Export new Matrices ( N1,U1,Q1,D1,V1,L1, K1,K2, F1,S0,X1,K3,C1,C2,Q2,C3,Q3,Q4) so I could easily view their values in default calculator matrix editor.

In past I have used this idea that you suggested, and it worked great.
Code:

//PROGRAM START
EXPORT A1,A2;


EXPORT function1 ()
BEGIN
A1:=M1+M1;
A2:=M1-M1;

END;

But now I don't know how to combine these two. Everything I've tried i get an error.


Program that I want local to be exported

Code:

EXPORT TST()
BEGIN
LOCAL w1,w2;
INPUT({w1,w2},"Prekobrojnost", {"Unesi prekobrojnost u","Unesi srednju vrijednost xo"});

LOCAL N1,U1,Q1,D1,V1,L1;

//N1- matica normalnih jednacina
//U1, Q1 - kofaktor matrica
//D1- vektor popravaka nepoznatih parametara
//V1-Vektor popravaka mjerenja

N1:=TRN(M1)*M2*M1;
U1:=TRN(M1)*M2*M3;
Q1:=inv(N1);
D1:=-(Q1*U1);
V1:=(M1*D1)+M3;
L1:=TRN(V1)*M2*V1;

LOCAL K1,K2;
//K1 - kontrola 1.) popravaka treba biti =0
K1:=TRN(M1)*M2*V1;
//K2 - Kontrola 2.) izjedacenja treba biti = lambdi
K2:=TRN(M3)*M2*V1;

LOCAL F1,S0,X1,K3;
F1:=(1/w1)*L1;
S0:=SQRT(F1(1,1));
X1=w2+D1;

// Popravljena mjerenja su pojedinacna l1,l2,l3...+ matrica V1;
K3:=M1*X1;


///Stohasticki dio

LOCAL C1,C2,Q2,C3;

C1:=F1*Q1;

// Deviacija mjerenja tako sto uzmemo korjen od Cx
C2:=F1*inv(M2);
//C2 - tacnost mjerenja

// srednje greske izvucem iz cl matrice korjen(dijagonalnih)
Q2:=M1*Q1*TRN(M1);

C3:=Q2*F1(1,1);
///Srednje greške popravljenih korjen dijagonale clanova C3

LOCAL Q3,Q4;
Q3:=inv(M2)-Q2;
Q4:=F1(1,1)*Q3;

PRINT("Kontrola K1 =0"+K1);
IF (K2=L1) THEN PRINT ("Kontrola 2 OK!");
END;
END;


And is there any way I could highlight In color this IF (K2==L1) THEN PRINT ("Kontrola 2 OK!"); If the K2 is equal to L1, and in red it it's not. ( printout in terminal) ?

How does it know those local variables (N1,U1, etc.) are matrices unless you reserve space for them with MAKEMAT or MAKELIST?

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Combine Export and Local variables? - toml_12953 - 03-28-2022 10:20 AM



User(s) browsing this thread: 1 Guest(s)