Post Reply 
Solving linear equations systems with > 9 variables accurately?
06-05-2015, 06:28 PM (This post was last modified: 06-05-2015 06:30 PM by Dieter.)
Post: #1
Solving linear equations systems with > 9 variables accurately?
I am currently designing two rational approximations for the Normal distribution's quantile function, with a working range from 0,5 to 1 E–99. The desired 10-digit accuracy (with a 13-digit implementation in HP41 MCODE) requires solving linear equation systems with 9...11 variables. I usually do this with Excel, but with 10-12 digit target accuracy of the solution this is simply not possible with Excel's 15 digit working precision.

So I did the 9-variable-case on a 34s. and the results came out accurately. Great, so this problem was solved. But 9 unknowns are the maximum the 34s can handle: it requires 81 registers for the matrix, 9 for the right hand side vector and another 9 for the solution, so 99 out of 100 registers are used.

But what can I do for the 10- or 11-variable case? I do not have access to Mathematica, Maple or other commercial math software, and I do not know a way to trick the 34s into handling larger matrices. Does anyone know of a (free) solution that runs on Windows XP/7? Or maybe there is a way using the 34s emulator...?-)

Dieter
Find all posts by this user
Quote this message in a reply
06-05-2015, 08:11 PM
Post: #2
RE: Solving linear equations systems with > 9 variables accurately?
The Answer to Everything: (Free)42 !
34 digits, builtin matrix support, even 100x100 matrices are no problem.
Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
06-05-2015, 08:36 PM (This post was last modified: 06-06-2015 07:46 AM by Marcio.)
Post: #3
RE: Solving linear equations systems with > 9 variables accurately?
Scilab - open source is quite similar to Matlab and can handle any kind of system you need. Linear, non-linear, complex... Name it!

This is how to enter data:

x = [1 2; 0 4];

y = [4 5; 9 1];

Type x/y on the command line and you'll get the result. How sweet is that? You could also store the data to any var you want:

z = x/y

EDIT: If dealing with large amounts of data, you could import them from excel or type them using the variable editor. If that is the case, create 'x' first, ie x=[] on the command line, and then double click it on the variables browser to start keying in data using a spreadsheet that is automatically created for that particular variable.
After getting the results on the screen, you'll want to format them, do so like this:

format('v',3+12)

Hope it helps!
Find all posts by this user
Quote this message in a reply
06-06-2015, 07:19 PM
Post: #4
RE: Solving linear equations systems with > 9 variables accurately?
(06-05-2015 08:11 PM)Werner Wrote:  The Answer to Everything: (Free)42 !
(06-05-2015 08:36 PM)Marcio Wrote:  Scilab - open source is quite similar to Matlab and can handle any kind of system you need. Linear, non-linear, complex... Name it!

Werner and Marcio, thank you very much. I was not aware of Scilab as a powerful free numeric math package. I also did not know that the later releases of Free 42 use the decimal64 library for 34-digit precision without the well-known problems of binary encoded numbers. I think Free 42 should be able to calculate the matrix coefficents and then solve the resulting equation system. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
06-08-2015, 11:51 AM
Post: #5
RE: Solving linear equations systems with > 9 variables accurately?
Hello Dieter,
There are even more free open source alternatives:
Numeric calculations: OCTAVE (a MATLAB clone), Python with numpy and scipy modules.
Symbolic/numeric calculations: MAXIMA.

Regards
Bernd
Find all posts by this user
Quote this message in a reply
06-08-2015, 12:20 PM (This post was last modified: 06-08-2015 12:21 PM by Marcio.)
Post: #6
RE: Solving linear equations systems with > 9 variables accurately?
(06-08-2015 11:51 AM)Bernd Grubert Wrote:  Hello Dieter,
There are even more free open source alternatives:
Numeric calculations: OCTAVE (a MATLAB clone), Python with numpy and scipy modules.
Symbolic/numeric calculations: MAXIMA.

Regards
Bernd

Last time I used Octave was 3 years ago. It seems things improved considerably since then. There was not even a stable version for windows. I had to install cygwin (Unix-like environment and command-line interface for windows) to get it run to my satisfaction.
Octave now has a beautiful UI. Congrats to the development team!!
Find all posts by this user
Quote this message in a reply
06-08-2015, 09:47 PM
Post: #7
RE: Solving linear equations systems with > 9 variables accurately?
Dieter,

I believe we allowed matrices to occupy local registers on the 34S which would give you the space you require.


Pauli
Find all posts by this user
Quote this message in a reply
06-09-2015, 08:22 PM
Post: #8
RE: Solving linear equations systems with > 9 variables accurately?
(06-08-2015 09:47 PM)Paul Dale Wrote:  I believe we allowed matrices to occupy local registers on the 34S which would give you the space you require.

If I understand the manual correctly, the local registers correspond to addresses ≥ 112. So the 10x10 matrix would occupy R00...R99 and the right-hand side as well as the solution vector is stored in the local register area (≥ 112). Is this correct?

In the meantime I did the mentioned calculations on Free42 (decimal version). Works great.

Dieter
Find all posts by this user
Quote this message in a reply
06-09-2015, 10:01 PM
Post: #9
RE: Solving linear equations systems with > 9 variables accurately?
(06-09-2015 08:22 PM)Dieter Wrote:  If I understand the manual correctly, the local registers correspond to addresses ≥ 112. So the 10x10 matrix would occupy R00...R99 and the right-hand side as well as the solution vector is stored in the local register area (≥ 112). Is this correct?

Yep. It should also be possible to fit the 10x10 matrix in the locals depending on RAM allocation.


- Pauli
Find all posts by this user
Quote this message in a reply
06-11-2015, 10:54 AM
Post: #10
RE: Solving linear equations systems with > 9 variables accurately?
(06-09-2015 10:01 PM)Paul Dale Wrote:  Yep. It should also be possible to fit the 10x10 matrix in the locals depending on RAM allocation.

OK. But there's still one problem: AFAIK all local registers are lost as soon as the program terminates (RTN). So all calculations would have to be done in one single program run. My program however first calculates the matrix coefficients (get user input #i => calculate coefficients ai,1...ai,9 and bi) and afterwards the equation system is solved.

Dieter
Find all posts by this user
Quote this message in a reply
06-14-2015, 05:40 AM
Post: #11
RE: Solving linear equations systems with > 9 variables accurately?
(06-08-2015 11:51 AM)Bernd Grubert Wrote:  Hello Dieter,
There are even more free open source alternatives:
Numeric calculations: OCTAVE (a MATLAB clone), Python with numpy and scipy modules.
Symbolic/numeric calculations: MAXIMA.

Regards
Bernd

The J programming language, which has extended precision rationals, might also be of interest. (J was developed by Ken Iverson and Roger Hui as a successor to APL, so it's definitely focused on matrix manipulation.)
Find all posts by this user
Quote this message in a reply
Post Reply 




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