Anthrazit

365 Reputation

8 Badges

2 years, 36 days

MaplePrimes Activity


These are replies submitted by Anthrazit

@dharr 

I tried to find what a single "Do" statement does, but the only reference to "do" was in a for...while clause.

@acer 

Thanks a lot for the explanation and the solution.

Probably interesting why I came up with the way I did that.

As far as I can remember, it was a copy paste operation from document mode. While a direct definition gets what you have (Unit('kN'*'m')), the result of a product of a force and a length keeps the units apart. But that does just apply to when you don't use the Units package. If you use the Units package, it will give you Joule as a unit.

Still not done with the problem, I'm opening a new thread.

https://www.mapleprimes.com/questions/230284-Units-again?sq=230284

@Carl Love

I think I've fixed it.

And the reason is connected to the problem you have described - though in the oppositve way. And I think actually your first sentence is wrong.

The main problem was that I loaded the Units package by using "with Units" - which loads the Units:-Simple package. The units Simple package apparently does NOT replace the basic arithmetic operations, or it doesn't do it good enough.

But when I changed the init procedure by using "with Units[Standard]" the error suddenly disappears and it seems to work now.

Somehow Maple thinks that there are still units in the matrix, even if i dropped them - but that will be something for Maplesoft to have a look into. I've filed a case on that issue. 

@Carl Love 

The reason why I switched to the unitless matrix was because of the error. Originally the matrix to be compared with comes with units. In addition it is just in the init of the loop that one of the matrices is zero.

I have so far not been able to recreate the problem with a simplified worksheet, so for now it needs to be fixed in the current workbook.

If you need to have a look at the code, open the lib/Main code in the workbook, and go to the end of the file. The 2 very last lines of the code in this file are the problem, I have put in comments there.

@Carl Love 

No, that gives the same error.

Here's the workbook in question, execute the entire workbook and go to the end of it.

Koyaanisqatsi.zip

@acer 

This is brilliant - though I didn't got it to work directly (store the variable in the matrix).

What I however managed to do was to do it indirectly - storing the contents of the variable in the matrix. Thus I can reread the values in the startup script to the variable.

storebetweensessions.mw

@acer

One of things I'm struggling with are tables, like...

S := table([2 = 45, 4 = 61])

They can't be shown with datatables as far as I can see. Btw., I am usually working with Workbooks nowadays, so if it's easier with workbooks that would do. 

Upon reboot of the PC the problem seems to have disappeared.

Strange, as I have tried multiple times yesterday, closing and starting Maple again, and the other component boxes worked without any problems.

@acer 

Thanks again for the thorough explanation.

From me as an user it is not important how things are done internally in the program, as long as I get what I want in the end. I've played around a bit more, and I think I finally found what I need.

The clue was to do a little bit more fiddling with the results in the end.

SumLoadcase[1 .. (), 1] := evalf(convert~(SumLoadcase[1 .. (), 1], 'units', Unit('m')));                # position on beam
SumLoadcase[1 .. (), 2] := evalf(convert~(SumLoadcase[1 .. (), 2], 'units', Unit('kN')*Unit('m')));        # M
SumLoadcase[1 .. (), 3] := evalf(convert~(SumLoadcase[1 .. (), 3], 'units', Unit('kN')));                # Q
SumLoadcase[1 .. (), 4] := evalf(convert~(SumLoadcase[1 .. (), 4], 'units', Unit('kN')));                # Qi
SumLoadcase[1 .. (), 5] := evalf(convert~(SumLoadcase[1 .. (), 5], 'units', Unit('kN')));                # Qk
SumLoadcase[1 .. (), 6] := evalf(convert~(SumLoadcase[1 .. (), 6], 'units', Unit('kN')/Unit('m')));        # load / m
  • the convert function not only makes consistent units across a cell, but also calculates the cells
  • the evalf function calculates the rest
  • the rest of the code is unchanged.

@Carl Love 

I do neither have the technical background nor the experience in Maple to comment on that, but Units are source of most of the problems we have had with Maple so far.

@acer

First of all, thanks again for your patience and efforts.

 I've gone through your input and they apparently fix the problem of the first column (with unit [m]). However they do not fix the problems in the other columns.

Running your example the result of the second column is [kN/m*m2]. In my example I get a mishmash of similar units (most likely because of different input, but who knows).

According to the definition on top it should be [kN*m].

@acer 

Any help appreciated!

I'm uploading a new workbook, which is getting really useful already. I'm going to post it on Maple cloud when it's finished.

Koyaanisqatsi.zip

@acer 

Thanks for the input.

Are there any examples which I could have a look at that implement those techniques, or and Maple page that describes common good programming practices?

3 4 5 6 7 8 9 Page 5 of 10