Anthrazit

885 Reputation

13 Badges

5 years, 317 days

MaplePrimes Activity


These are replies submitted by Anthrazit

Here's the Maple Workbook in question.

Tre_Materialegenskaper.maple

I think the answer might be to save the file as a Maple Workbook.

At least I am getting the same errors as in the Maple Cloud when working with the workbook format.

The question is - how do I use an attached Maple repository file (.mla) in the workbook?

The repository path is "this:///NODETre.mla" - so how I attach that?

libname := "this://", libname

gives a Maple Error regarding Kernel connection

@tomleslie 

Try to read once again what I have written.

The differences in rounding of halv integers - and that is really the only thing where implementations are different - are more or less known.

When I wrote that one can't always trust the last digit, that doesn't mean I don't trust the implementation of the rounding in the different software packages. It means that I don't actually know which kind of rounding (up or down) the different software packages use.

I could even extend that further to human languages. In German we have two words for that - "aufrunden" (round up) and "abrunden" (round down). In Norwegian we usually just use "avrunde" which doesn't give any indications about which way it is done.

So in my personal point of view we still stand where we started.

  • Maple does at the moment not have any function to round numbers to a specific number of digits.
  • It should have one. There are situations where simply defining how many digits are shown in a result is not enough (see using numbers for indexing of tables, or output to Math Containers, etc.)

@acer

Apparently it is possible if the code is run during startup or through "Execute entire worksheet".

Startupcode.mw

@acer 

No, not that I am aware of.

Tre_Materialegenskaper.mw

@acer 

Thanks a lot, that was very helpful.

@tomleslie 

Yes, the rnd2 function seems to work as I would expect from a rounding function, and like it is implemented in the software I named previously.

@tomleslie 

The question regarding halv-integers is indeed a bit strange, and the rounding behaviour of Python is indeed a bit unexpected I have to admit.

But that is common knowledge, the last digit is the one you can't always trust.

As my teacher in steel at university said.

In steel you calculate 3 digits and hope that 2 are correct. In concrete you calculate 2 digits and hope that 1 is correct. And in soil mechanics you calculate 1 digit and hope that the sign is correct.

@Christopher2222 

Well, I've filed that as a product suggestion - and it would be nice if Maplesoft took it on their list for future implementation.

For the time being we'll go around the issue somehow.

@Kitonum 

That just fixes the way things are displayed in specific portions of the sheet.

Unfortunatly this is not enough sometimes.

I've got at least 2 things where that doesn't work.

  • When using numbers as index for tables
  • For text fields

@Christopher2222 

I'm a structural engineer, and I can tell you that this is something we never would have any use for.

Excel btw. does it exactly the same way as Python, as well as Visual Basic. Rounding does give an indication about how many digits are correct. If a measurement is in meters, and you show 3 digits, than the measurement is correct in millimeters. Regardless if the figures show local coordinates (typically 1 to 3 digits before the delimiter) or real coordinates (might be 10 digits before the delimiter).

And no - this isn't anything any engineer would get used to.

.

 

Why would I need to implement that in a code?

Rounding is a basic functionality which is available in every software package I know.

https://www.w3schools.com/python/ref_func_round.asp

round(123456,2) returns 123456 in the Python example which is correct.
(but I could live with 123456.00 as well.)

evalf[2](123456) in Maple on the other hand gives 120000 (actually "12000 0.") which is complete nonsense.

@acer 

In that case the data is complete, so it's not so large.

I have a different example with material data, where seq is used instead. The code however is much more difficult to read in my opinion, that's one thing I have to admit I struggle with at the moment.

In Maple you can do very many thing in one line.

https://www.mapleprimes.com/questions/228884-Getting-List-Of-Properties-And-Items-Of-A-Library

@dharr 

Thank you very much - round(x) is exactly what I needed.

I've modified the code now, and it looks very promising so far.

@acer 

Sure, no problem, here's the actual data.

Trelast_dimensjoner.xlsx

Some quick explanations:

The spreadsheet contains information about available profile dimensions for timber posts in Norway. The first row has information about type (glulam or sawn timber), the second column the width (mm) and the third the height (mm).

What I have done is to sort the list into type, and then width and height. The types are put into a list, so in the end the list includes 2 types.

The width is stored in a table, indexed by timber type.

The height is also stored in a table, indexed by timber type and width.

Source code attached.Create_NODEtverrsnittTrelast.mw

First 15 16 17 18 19 Page 17 of 19