[Jprogramming] Creating a matrix (some polish required)
Richard Hill
hillrj at melbpc.org.au
Mon Aug 23 12:13:56 HKT 2010
Alex,
At the risk of going off-topic it would be good to know how you solved the
multi-level problem using linear algebra in J.
(ie multi-level with common subassy)
A ref to the appropriate wiki or J phrase would be enough.
-----Original Message-----
From: programming-bounces at jsoftware.com
[mailto:programming-bounces at jsoftware.com] On Behalf Of Alex Rufon
Sent: Monday, 23 August 2010 12:10
To: Programming forum
Subject: Re: [Jprogramming] Creating a matrix (some polish required)
I remember identity matrix taught in my linear algebra class and wondering
how to use it in "real life" situation.
Because of J, I actually used this concept to compute for Raw Material
Consumption and Material Requirement Planning for Shoes and Apparel
manufacturing (and soon for the Fishing Industry). I remember doing RMC and
MRP in VB+PL/SQL when I was still working in the Paper Industry and the code
was mind boggling. I remember being confused where an IF-ENDIF block ends
because of the multi-leveling. Learning J to implement identity matrix and
matrix math is totally worth it.
-----Original Message-----
From: programming-bounces at jsoftware.com
[mailto:programming-bounces at jsoftware.com] On Behalf Of Roger Hui
Sent: Friday, August 20, 2010 9:55 PM
To: Programming forum
Subject: Re: [Jprogramming] Creating a matrix (some polish required)
http://www.jsoftware.com/jwiki/Essays/Identity%20Matrix
34 ways to create the identity matrix. Adapt one to create the
anti-diagonal matrix. e.g. method 23:
a23=: |.D.1 at i.
a23 5
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 1 0 0 0
1 0 0 0 0
----- Original Message -----
From: Alex Gian <alexgian at blueyonder.co.uk>
Date: Friday, August 20, 2010 3:42
Subject: [Jprogramming] Creating a matrix (some polish required)
To: Programming forum <programming at jsoftware.com>
> The "flipped" identity matrix is quite interesting. (Basically it's
> the identity matrix flipped or mirrored about either the vertical or
> horizontal axis. IOW, for a 3x3:
> 0 0 1
> 0 1 0
> 1 0 0
> I don't know if it has any special name, I stumbled on it by chance
> while messing around with a simple FSA for a puzzle game.
> Pre-multiplying by this matrix flips any same size matrix vertically,
> post-multiplying flips it horizontally. Its square is obviously the
> identity matrix.
>
> Now, I have created this matrix on various systems, (e.g. HP/RPL,
> Scheme, TI-Basic), usually - if an id matrix is provided - just by
> reversing its rows, otherwise just by starting off with the vector,
> say,
> 0 0 0 1, and then rotating the "1" each time and appending that vector
> to a string, which is eventually converted to a matrix.
>
> I can do this using loops and explicit coding, but am looking for any
> suggestions to make it into a J one-liner, such that:
> flipidm 4
> 0 0 0 1
> 0 0 1 0
> 0 1 0 0
> 1 0 0 0
>
> Hope my explanation was clear enough, TIA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.851 / Virus Database: 271.1.1/3084 - Release Date: 08/21/10
04:35:00
More information about the Programming
mailing list