aloy Posted August 3, 2014 Share Posted August 3, 2014 Hi Everybody, Is it possible to carry out matrix operations in Alisp/Vlisp (say 50x50)?. If not is it possible to import such a thing from excel as a table and then access individual values (elements) in the table?. This is for some engineering calculations involving finite element analysis (as a hobby). Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Tyke Posted August 3, 2014 Share Posted August 3, 2014 Have a look at these links http://stackoverflow.com/questions/11449657/writing-a-simple-matrix-class-in-common-lisp-for-practice http://phase.hpcc.jp/mirrors/stat/sapaclisp/matrix.lisp http://rosettacode.org/wiki/Matrix_multiplication http://common-lisp.net/project/lisplab/ They are for common LISP and I'm not sure if they will work in LISP or VLISP. Quote Link to comment Share on other sites More sharing options...
aloy Posted August 3, 2014 Author Share Posted August 3, 2014 Thanks Tyke. I like to do it in Alisp as it is easier to do the design of the structure and draw it with a macro. Therefore common-lisp will not do. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 3, 2014 Share Posted August 3, 2014 Not sure what the limits are on a list but you can attemp to create a 50x50 "Matrix" as a list then you can get any row/column by using nth in a double loop. In my old R12 lisp book there is a specific section on matrix's so maybe check Help as well. You could also use a table as well similar method of row/column to retrieve data ;row 25 col 32 (setq val (nth 32 (nth 25 mylist))) ;a 3x3 (setq mylist (((1 2 3)(4 5 6)(7 8 9))((1 2 3)(4 5 6)(7 8 9))((1 2 3)(4 5 6)(7 8 9)))) Quote Link to comment Share on other sites More sharing options...
aloy Posted August 4, 2014 Author Share Posted August 4, 2014 Thanks Bigal, I believe this a way of representing three matrices, each a 3x3 one. Is there an easy way to access each item, say 2nd row (i) and third column (j) of a matrix we can assign it to variable K23 ( or Kij) and use it elsewhere ?. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 5, 2014 Share Posted August 5, 2014 Re read my post i put an example (setq k23 (nth 2 (nth 3 mylist))) Quote Link to comment Share on other sites More sharing options...
aloy Posted August 5, 2014 Author Share Posted August 5, 2014 I am using 2013 and it takes your list with a quote ('). However (setq k23 (nth 2 (nth 3 mylist))) gives an error. My version has a 'vlax-safearray-put-element' and '......-get-element' functionality which can construct and then extract elements one at a time from a matrix. I believe it is more useful than excel which is limited to 52x52 at present ?. I am not trying something that contains slabs and beams with several hundreds elements at this time (like the expensive commercial software); an 80x80 matrix would do. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 6, 2014 Share Posted August 6, 2014 The mylist is an example would need to make a list of lists your correct it will give errors (setq mylist (list (list (list 1 2 3)(list 4 5 6)(list 7 8 9))(list (list 1 2 3)(list 4 5 6)(list 7 8 9))(list (list 1 2 3)(list 4 5 6)(list 7 8 9)))) ;oops forgot nth starts at 0 (setq k23 (nth 1 (nth 2 mylist))) ; returns ( 4 5 6) Quote Link to comment Share on other sites More sharing options...
aloy Posted August 6, 2014 Author Share Posted August 6, 2014 (edited) Yes, it works Bigal. Thanks. I will try safearrays too and come back later. I have uploaded some files showing samples. Unfortunately I could not upload the last two which shows the adding of all elements to one single matrix called global matrix. I have given the link to a video from a commercial software in this regard. IMG_0001.pdf IMG_0002.pdf IMG_0003.pdf Edited August 6, 2014 by aloy Quote Link to comment Share on other sites More sharing options...
aloy Posted September 11, 2014 Author Share Posted September 11, 2014 (edited) BIGAL, This is a belated reply. I have realized that there are a large number of software written in Fortran and these can be run via ObjectARX in AutoCAD if one were to make use of them to design something (say a multiple box culvert) and draw the sections etc. I already have hundreds of them (f95& f03)that do the matrix multiplication (up to million by million matrices) process data and form stiffness matrix etc required in structural calculations. I have given some samples above. So, I believe the best option is to make use of ObjectARX facility. Thanks for replying. Aloy Edited September 11, 2014 by aloy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.