Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MSLV Problem

18 views
Skip to first unread message

Michael Kuyumcu

unread,
Aug 6, 2006, 3:47:42 PM8/6/06
to
Hi,

I want to solve the following system with MSLV and enter on the stack:

['X+Y=1' 'Z+R=1' 'X+Z+Y+R=2']
['X' 'Y' 'Z' 'R']
[0. 0. 0. 0.]

And go to the MSLV application in the NUM.SLV menu on the 49g+.

However, the hp49g+ complains:
"MSLV Error:
Bad Argument
Value"

Why/What is that? If I use only 2 equations and 2 variables (X and Y),
it works. I don't care whether the system above has a solution or not,
it's just a sample case for me to get to know the operating of the MSLV
command. Can it work with 2 equations only?

2) MSLV seems to work pretty slowly (when it works at all). Are there
faster solvers for large systems of non-linear equations for the hp49g+
available? (I know that the above system is linear).

Thank you very much for your time,
Michael Kuyumcu

Virgil

unread,
Aug 6, 2006, 6:16:18 PM8/6/06
to
In article <1154893662....@p79g2000cwp.googlegroups.com>,
"Michael Kuyumcu" <in...@noemanetz.de> wrote:

You have in your example, only 3 equations but 4 variables. Furthermore,
only two of your equations are "independent", as the last is merely the
sum of the first two. There is no way that one can solve for all
variables. Given X or Y one can find the other and given one of Z or R
one can find the other, but nothing else.

The calculator is quite right to object.

Bernard Parisse

unread,
Aug 7, 2006, 2:18:28 AM8/7/06
to
Michael Kuyumcu a écrit :

> Hi,
>
> I want to solve the following system with MSLV and enter on the stack:
>
> ['X+Y=1' 'Z+R=1' 'X+Z+Y+R=2']
> ['X' 'Y' 'Z' 'R']
> [0. 0. 0. 0.]
>
> And go to the MSLV application in the NUM.SLV menu on the 49g+.
>
> However, the hp49g+ complains:
> "MSLV Error:
> Bad Argument
> Value"
>
> Why/What is that?

it seems you have 3 equations and 4 unknowns, therefore
you can not find a numerical solution. MSLV is a numeric
solver using Newton method with prefactor.

> If I use only 2 equations and 2 variables (X and Y),
> it works. I don't care whether the system above has a solution or not,
> it's just a sample case for me to get to know the operating of the MSLV
> command. Can it work with 2 equations only?
>
> 2) MSLV seems to work pretty slowly (when it works at all). Are there
> faster solvers for large systems of non-linear equations for the hp49g+
> available? (I know that the above system is linear).
>

For polynomial systems, you can try SOLVE which will call
Groebner basis algorithm, but don't expect too much on
a calculator...

Michael Kuyumcu

unread,
Aug 7, 2006, 3:45:54 AM8/7/06
to
Thanks, I now see what the hp is trying to communicate. Anyhow, I feel
that the algorithms used by the hp should be able to deal with such
cases, over-determined as well as under-determined, and interdependent
equations. The hp could and should have eliminated the dependent
equation and solved the ones remaining. Providing one solution of the
many available would then be a first step, and giving parameterized
solutions an even better one. The system I entered does have a
solution, and the fact that the hp can't find any is quite
disconcerting. I just found on hpcalc.org a solver that handles all the
mentioned cases - and much faster than the limited (I'd almost like to
call it dysfunctional for many real-world cases) in-built program. It's
only around 3000 bytes, so that could and should have been squeezed
into the ROM.

Regards, and again, thanks for responding
Michael Kuyumcu

Michael Kuyumcu

unread,
Aug 7, 2006, 3:51:01 AM8/7/06
to
Thanks for this clue!

I just found a fast efficient solver application on hpcalc.org that
handles all imaginable cases, under- and over-determined. It seems it
also uses the Newton method. It works like a charm (solving for 49
unknows in a couple of seconds), the only problem is that it creates a
variable in the current directory for each of the unknows, containing
the calculated approximate or exact value while I rather need all these
values as a list.

Do you know of any method to assemble the contents of a directory (the
names of the stored variables stored there) in a list? I am new to the
hp, and just found that the DIR command does (with no arguments) not do
what I intended.

Thank you very much!
Regards,

Michael Kuyumcu

acl

unread,
Aug 7, 2006, 9:44:09 AM8/7/06
to

> Do you know of any method to assemble the contents of a directory (the
> names of the stored variables stored there) in a list? I am new to the
> hp, and just found that the DIR command does (with no arguments) not do
> what I intended.
>

Hello,

VARS will return a list with all the variable names in the directory. If
you only want the names of vars with real numbers only, use this:

<< VARS DUP 1 <<RCL TYPE>> DOLIST
{} SWAP DUP SIZE 1 DUP ROT
FOR j GETI 0 ==
<< ROT 4 PICK j GET + UNROT >>
IFT
NEXT DROP2 NIP
>>

which should leave a list with all the names in the current directory
which contain real numbers (this is checked by comparing their TYPE to
0, which is the type for reals) and nothing else.

Warning: I have not checked this (I ran it once on my calculator);
furhtermore, I have not written a single program for about a year, so
this is possibly buggy and certainly kludgy.

If someone could streamline it, I'd appreciate it.

Message has been deleted

acl

unread,
Aug 7, 2006, 11:24:46 AM8/7/06
to


Somewhat less idiotic:

<< VARS LIST-> {} 1 ROT
START SWAP DUP RCL TYPE 0 ==
<< + >>
<< DROP >> IFTE
NEXT
>>

Warning: I have not tested this at all, but it should work.

acl

unread,
Aug 7, 2006, 11:25:56 AM8/7/06
to
CR wrote:
> Try also 0. TVARS for vars containing reals.
>
> Chuck
>
>

Ah, but where's the fun in that? :)

Thanks for the tip...

Michael Kuyumcu

unread,
Aug 7, 2006, 12:35:57 PM8/7/06
to
Thank you very much! VARS will surely come in handy!
Michael Kuyumcu

Michael Kuyumcu

unread,
Aug 7, 2006, 12:36:52 PM8/7/06
to
Thanks, that's quite lean! :)
Michael Kuyumcu


CR wrote:


> "acl" wrote:
> >
> > << VARS DUP 1 <<RCL TYPE>> DOLIST
> > {} SWAP DUP SIZE 1 DUP ROT
> > FOR j GETI 0 ==
> > << ROT 4 PICK j GET + UNROT >>
> > IFT
> > NEXT DROP2 NIP
> > >>
> >
> > which should leave a list with all the names in the current directory
> > which contain real numbers (this is checked by comparing their TYPE to 0,
> > which is the type for reals) and nothing else.

> snipped


> > If someone could streamline it, I'd appreciate it.
>

John H Meyers

unread,
Aug 7, 2006, 1:32:32 PM8/7/06
to
On Mon, 07 Aug 2006 09:55:24 -0500, CR wrote:

> Try also 0. TVARS for vars containing reals.

Or { 0 28 } TVARS for vars containing real or integer, etc.

[r->] [OFF]

Michael Kuyumcu

unread,
Aug 7, 2006, 6:23:53 PM8/7/06
to
Thanks, TVARS is very versatile, it seems!
Michael Kuyumcu

John H Meyers

unread,
Aug 8, 2006, 3:18:55 AM8/8/06
to
On Sun, 06 Aug 2006 14:47:42 -0500, Michael Kuyumcu wrote:

> I want to solve the following system with MSLV and enter on the stack:
>
> ['X+Y=1' 'Z+R=1' 'X+Z+Y+R=2']
> ['X' 'Y' 'Z' 'R']
> [0. 0. 0. 0.]
>
> And go to the MSLV application in the NUM.SLV menu on the 49g+.
>
> However, the hp49g+ complains: "MSLV Error: Bad Argument Value"


On Mon, 07 Aug 2006 02:45:54 -0500, Michael Kuyumcu wrote:

> Thanks, I now see what the hp is trying to communicate. Anyhow, I feel
> that the algorithms used by the hp should be able to deal with such
> cases, over-determined as well as under-determined, and interdependent
> equations. The hp could and should have eliminated the dependent
> equation and solved the ones remaining. Providing one solution of the
> many available would then be a first step, and giving parameterized
> solutions an even better one. The system I entered does have a
> solution, and the fact that the hp can't find any is quite
> disconcerting. I just found on hpcalc.org a solver that handles all the
> mentioned cases - and much faster than the limited (I'd almost like to
> call it dysfunctional for many real-world cases) in-built program. It's
> only around 3000 bytes, so that could and should have been squeezed
> into the ROM.

It's already in the ROM! (and has been there for 13 years!)

Forget the 49G[+]/50G; try the old-fashioned 48G[X] way:

Think A*X=B and put on the stack:

:B: [ 1. 1. 2. ]

:A: [ [1. 1. 0. 0.] [0. 0. 1. 1.] [1. 1. 1. 1.] ]

Now type LSQ, see answer:

[ .5 .5 .5 .5 ]

The "Solve linear system" built-in application
will give the same result.

LSQ for an under-determined system
minimizes the solutions' Frobenius/Euclidean norm
http://mathworld.wolfram.com/FrobeniusNorm.html

For an over-determined system,
LSQ minimizes the norm of the residual A*X-B

[r->] [OFF]

Steen Schmidt

unread,
Aug 8, 2006, 8:00:52 AM8/8/06
to
Michael Kuyumcu wrote:

> I want to solve the following system with MSLV and enter on the stack:
>
> ['X+Y=1' 'Z+R=1' 'X+Z+Y+R=2']
> ['X' 'Y' 'Z' 'R']

Which one of the infinite number of solutions do you want?

Regards
Steen

Michael Kuyumcu

unread,
Aug 8, 2006, 1:17:28 PM8/8/06
to
One would be enough. Am I asking too much? Just one lousy little
solution out of the infinite many. The hp cannot even give you that.

Regards,
Michael Kuyumcu

John H Meyers

unread,
Aug 8, 2006, 1:59:19 PM8/8/06
to
>> Which one of the infinite number of solutions do you want?

On Tue, 08 Aug 2006 12:17:28 -0500, Michael Kuyumcu wrote:

> One would be enough. Am I asking too much? Just one lousy little
> solution out of the infinite many. The hp cannot even give you that.

Tried LSQ or "Solve linear sys" yet? (previous post this morning).

All HP48G[X]/HP49/HP50 have it built-in.

[r->] [OFF]

Michael Kuyumcu

unread,
Aug 9, 2006, 9:52:38 AM8/9/06
to
John,

thanks for the tip. Actually, I am trying to solve a system of
non-linear equations. I have several dozens of equations of the type
A11*A12*A21*A22=0, where A11, A12, etc. are the unknows. Moreover, I
have only 49 vars but 449 equations (441 of the mentioned non-linear
type and additional 8 purely linear equations). I just posted the
example since I wondered if maybe MSLV couldn't handle non-linear
systems, so I tried a linear one. Do you think LSQ will handle
non-linear systems, too?

Apart from this, on hpcalc.org I found the program solvesys which
handles all cases (regular, over- and underdetermined) quite nicely and
quickly. It's quite comfortable, too, and I am very satisfied with it.
I will now try and figure out the algorithms behind the software (the
program documentation mentioned two books) and try to improve the
program. I would, for instance, like to program to be able to deal with
bounded systems of nonlinear equations as well, meaning: having lower
and upper boundaries for the unknows, like 0 = A11 = 1. That would
help my particular problem a lot.

Again, thank you for your help!
Regards,

Michael Kuyumcu

John H Meyers

unread,
Aug 9, 2006, 1:00:15 PM8/9/06
to
On Wed, 09 Aug 2006 08:52:38 -0500, Michael Kuyumcu wrote:

> Do you think LSQ will handle non-linear systems, too?

No.

> Apart from this, on hpcalc.org I found the program solvesys

> [well-recommended program by Sune Bredahl, in use long time for 48/49]


> which handles all cases (regular, over- and underdetermined)
> quite nicely and quickly. It's quite comfortable, too,
> and I am very satisfied with it.

> I will now try and figure out the algorithms behind the software (the
> program documentation mentioned two books) and try to improve the
> program. I would, for instance, like to program to be able to deal with
> bounded systems of nonlinear equations as well, meaning: having lower

> and upper boundaries for the unknowns, like 0 < A11 < 1. That would


> help my particular problem a lot.

If you could just generalize that to have bounded functions
of several variables, and if you could select that solution
which simultaneously maximizes or minimizes any non-linear function
of all the variables, then I believe this would be
yet another great feature ;-)

[r->] [OFF]

Michael Kuyumcu

unread,
Aug 10, 2006, 3:33:29 AM8/10/06
to
That sounds quite sophisticated. I think I can't do that with my
present knowledge, and from my research on the internet I have so far
won the impression that what I am trying to achieve is quite a
complicated matter on its own if you want to have guaranteed global
convergence. Anyway, thanks for the suggestions! :)

Regards,
Michael Kuyumcu

John H Meyers

unread,
Aug 10, 2006, 4:00:30 AM8/10/06
to
On Thu, 10 Aug 2006 02:33:29 -0500, Michael Kuyumcu wrote:

> That sounds quite sophisticated.

I was just trying to have you take on the task of making
a completely generalized "non-linear programming" package
to run on a calculator :)

When I was employed at a major oil company some decades ago,
they dedicated two room-sized state-of the art high-end IBM mainframes
to do just "linear programming" to optimize all their refineries :)

[r->] [OFF]

0 new messages