HP Forums
free42 dm42 MVAR question - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: free42 dm42 MVAR question (/thread-21208.html)



free42 dm42 MVAR question - kladit - 01-26-2024 02:58 PM

I wrote two simple solver programs XL and XC. Both use a MVAR F (frequency).
After I gave an input for F to one of these and ran one the content of F has changed
when I run the the other.
Neither of both does change the content of F.
Why does it change?
As far as I know all MVARs are global, a MVAR of name X used in one prgrm is accessible to
a MVAR X used in another prgrm. Is this correct?


RE: free42 dm42 MVAR question - Thomas Okken - 01-28-2024 12:56 AM

MVAR doesn't make a variable global or local. The only thing MVAR does is to declare which names should be listed in the VARMENU, solver, and integrator menus, when the LBL preceding the MVARs is selected.


RE: free42 dm42 MVAR question - dm319 - 01-28-2024 05:19 PM

Maybe post the code here so we can take a look?


RE: free42 dm42 MVAR question - Thomas Klemm - 01-28-2024 05:24 PM

(01-26-2024 02:58 PM)kladit Wrote:  Is this correct?

I assume that your programs are similar to these:
Code:
00 { 34-Byte Prgm }
01▸LBL "XC"
02 MVAR "XC"
03 MVAR "f"
04 MVAR "C"
05 RCL "XC"
06 RCL× "f"
07 RCL× "C"
08 PI
09 ×
10 2
11 ×
12 1
13 -
14 END

Code:
00 { 31-Byte Prgm }
01▸LBL "XL"
02 MVAR "XL"
03 MVAR "f"
04 MVAR "L"
05 RCL "f"
06 RCL× "L"
07 PI
08 ×
09 2
10 ×
11 RCL- "XL"
12 END

I use the first one with:
SOLVER and select XC.

I then entered \(f=60\) and \(C=1E-6\) and calculated \(X_C\):

XC=2652.5824

I use the second one with:
SOLVER and select XL.

Now the variable f still contains 60.
This can be verified with:

RCL "f"

Only when you just hit "f" the frequency might get recalculated based on the values of "L" and "XL".

If that doesn't help let us know what exactly you are doing.