HP Forums
PLUS42 - Usage of UNITS functions in solver - 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: PLUS42 - Usage of UNITS functions in solver (/thread-18855.html)



PLUS42 - Usage of UNITS functions in solver - Marco Polo - 09-21-2022 01:38 PM

I am using Plus42 v.1.0.10 Decimal under Windows 10.

I am trying to use the Equation Solver to implement the following equation:

Code:
TEST:TimeH=L(K1:EXP(UBASE(U*A*(INV(W*C)-INV(w*c)))))*0+L(K2:(M*(G(K1)*w*c-W*C)/(W*w*c*(G(K1)-1))))*0+G(K2)*LN((UBASE(t1)-UBASE(T1))/(UBASE(t1)-UBASE(T2)))

All variables shall be with units.
The use of UBASE in K1 definition is necessary to reduce all UOM to their base definition, and the semplification of UOMs will reduce to a pure number.
The use of UBASE in LN argument has the same purpose of the above, plus the purpose of converting the temperatures to Kelvin degrees.
When solving, i get a "NONEXISTENT" error, just like UBASE is interpreted as a variable (see attached screenshot)

Such arrangement works properly on 48g/50g (of course keeping K1 and K2 definition outside the main equation and using MES)
Code:
{ 'K2=M*((K1*w*c-W*C)/(W*w*c*(K1-1.)))' 'K1=EXP(UBASE(U*A*(1./(W*C)-1./(w*c))))' 'Theat=K2*LN((UBASE(t1)-UBASE(T1))/(UBASE(t1)-UBASE(T2)))' }

What am i doing wrong?

Thanks in advance


RE: PLUS42 - Usage of UNITS functions in solver - Thomas Okken - 09-21-2022 04:54 PM

UBASE isn't defined as a built-in function in the equation language. (There is a complete list of built-in functions here, under the sub-heading Functions.)

I guess I should add it, but in the meantime, you can work around this problem by creating a function UBASE yourself, and implementing it using a program:

UBASE(X):XEQ(UB:X)

00 { 8-Byte Prgm }
01▸LBL "UB"
02 UBASE
03 END



RE: PLUS42 - Usage of UNITS functions in solver - Thomas Okken - 09-21-2022 06:23 PM

Should any other unit-related functions, apart from UBASE, be made available in the equation language as well?


RE: PLUS42 - Usage of UNITS functions in solver - Marco Polo - 09-21-2022 07:16 PM

(09-21-2022 06:23 PM)Thomas Okken Wrote:  Should any other unit-related functions, apart from UBASE, be made available in the equation language as well?
Yes, UVAL will be useful too.
Thank you for the quick answer and your effort.

By the way, any new about a multiple equation solver like MES?


RE: PLUS42 - Usage of UNITS functions in solver - Thomas Okken - 09-21-2022 09:46 PM

(09-21-2022 07:16 PM)Marco Polo Wrote:  By the way, any new about a multiple equation solver like MES?

I haven't really thought about it... it's not high on the list.
I would like to do it eventually, but for now, I don't even have an algorithm.


RE: PLUS42 - Usage of UNITS functions in solver - Marco Polo - 10-03-2022 01:17 PM

(09-21-2022 07:16 PM)Marco Polo Wrote:  
(09-21-2022 06:23 PM)Thomas Okken Wrote:  Should any other unit-related functions, apart from UBASE, be made available in the equation language as well?
Yes, UVAL will be useful too.
Thank you for the quick answer and your effort.

By the way, any new about a multiple equation solver like MES?
Just downloaded v. 1.0.11 for Windows 64bit.
UBASE and UVAL in EQN Solver works as expected.

Thank you!