Hello thanks in advance for anyone who sheds light on this for me.
I'm working on a linear algebra problem which requires the computation of the following: M * (M' * M)^-1 * M' * Y
where M is a matrix, or array
M' is the transpose of that array
^-1 means MINVERSE()
Y is a column vector
and * stands for matrix multiplication
I have been calculating each part of this (M', then M'M, (M'M)^-1, M'Y, (M'M)^-1 M'Y, then the final result) individually and combining them in the end, but I'm seeking a more efficient approach.
I tried a few variations of this: =MMULT(Y;MINVERSE(MMULT(TRANSPOSE(Y);Y));TRANSPOSE(Y);X)
Where M is a matrix and Y is a column vector.
So far I've had no luck - is there some way of doing this or am I going to have to keep calculating these steps separately?
See attachment for an example. The purpose of this idea is to create a function that tries to mimic or match the vector Y. I wish to then use that function to do other things.
[Solved] How to create nested array functions
[Solved] How to create nested array functions
- Attachments
-
- forum_help1.ods
- (17.18 KiB) Downloaded 103 times
Last edited by middle on Wed Aug 23, 2017 7:19 am, edited 1 time in total.
OpenOffice 4.1.3 on Windows 8.1
Re: How to create nested array functions
It's been so long since I did anything like that I can hardly read your equation.
I am not sure that a spreadsheetit is the right tool for something like this. Have you had a look at something like Sage?
It seems to be an open-source alternative to Mathematica or Maple or Matlab and probably is a better application for your purpose.
I am not sure that a spreadsheet
It seems to be an open-source alternative to Mathematica or Maple or Matlab and probably is a better application for your purpose.
Last edited by jrkrideau on Tue Aug 22, 2017 2:36 pm, edited 1 time in total.
LibreOffice 7.3.7. 2; Ubuntu 22.04
Re: How to create nested array functions
I will check out Sage - thank you for the suggestion!
It does seem like Calc would benefit from more efficient matrix manipulation.
It does seem like Calc would benefit from more efficient matrix manipulation.
OpenOffice 4.1.3 on Windows 8.1
- MrProgrammer
- Moderator
- Posts: 4907
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: How to create nested array functions
Your attachment shows M in C3:I12 and Y in A3:A12, so:middle wrote:I'm working on a linear algebra problem which requires the computation of the following: M * (M' * M)^-1 * M' * Y
=MMULT(C3:I12;MMULT(MINVERSE(MMULT(TRANSPOSE(C3:I12);C3:I12));MMULT(TRANSPOSE(C3:I12);A3:A12)))
Do you understand that the test ISEVEN(x$2)="TRUE" is always false? You have a number (0 or 1) on the left side of the equal sign and four characters of text on the right side of the equal sign. Numbers are always less than text. You may benefit from reading [Tutorial] Ten concepts that every Calc user should know. if you intend to test whether D$2 is even, the correct formula would be =IF(ISEVEN(D$2);SIN($B3*D$2);COS($B3*D$2)) where I've removed some unneeded parentheses too.middle in cell D3 wrote:=IF(ISEVEN(D$2)="TRUE";SIN($B3*(D$2));COS($B3*(D$2)))
Currently, a*b*c*d must be written as =MMULT(a;MMULT(b;MMULT(c;d))) since =MMULT(a;b;c;d) is not supported.middle wrote:=MMULT(Y;MINVERSE(MMULT(TRANSPOSE(Y);Y));TRANSPOSE(Y);X)
Last edited by MrProgrammer on Thu Aug 24, 2017 12:58 am, edited 1 time in total.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: How to create nested array functions
MrProgrammer,
Thanks very much - you saved me a lot of time!
And thanks for the beginners tutorial; I probably should have searched for something like that before jumping right into my project.
Thanks very much - you saved me a lot of time!
And thanks for the beginners tutorial; I probably should have searched for something like that before jumping right into my project.
OpenOffice 4.1.3 on Windows 8.1