Jump to content

Matrix operations


aloy

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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))))

Link to comment
Share on other sites

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 ?.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 by aloy
Link to comment
Share on other sites

  • 1 month later...

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 by aloy
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...