HP Forums

Full Version: free42 dm42 MVAR question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.
Maybe post the code here so we can take a look?
(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.
Reference URL's