Anthrazit

750 Reputation

11 Badges

5 years, 289 days

MaplePrimes Activity


These are replies submitted by Anthrazit

@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

I've played around a bit more with that and did some more more tests.

Your reply regarding DataFrame explains what Maple does with Excel files during conversion. But that just applies to the data table itself, not the cells within.

I've tried to apply text functions to an imported numeric datacell of the Excel file, and it clearly shows that it is not a text, but a number. The "SearchText" function wasn't working, while a simple multiplication did.

When using this number however as a table index, something is different, as the number of decimals has influence on the content.

Just did a quick test with a matrix as well. In that case Maple doesn't allow any decimals at all, even if they are 0.

So apparently it comes down that that problem again.

I need to convert the input from Excel - which is a number with decimals (all .0) - to a whole number. Those can then be to index the table.

I have to add that both indexes I am using are from an Excel table. The first item is a text, the other item a whole number.

As it is read into Maple, the whole number is converted to a real number with a decimal.

So what I would like to have is to convert that real number to a whole number during or after the input process.

Uploading the material library didn't work...trying once more in new post.

NODEMaterial.mla

I'd just like to thank everyone for the help, and would like to share my first program which you helped me to get done.

Materialdata_Tre.mw

NODEMaterial.mla

Just wanted to add a link to Maple help which I found very useful.

https://www.maplesoft.com/support/help/Maple/view.aspx?path=quotes

First of all, I am very grateful for all of your comments, really appreciate that.

All comments are very helpful, just need to go through all the problems on my own first. Learning by doing...

Anyway, I have finally managed to put together my first Maple program, and am very glad to put it in public for review. Shortly explained, it reads material values from a library, and gives the users a choice to pick a material and shows the corresponding results.

Materialdata_Tre.mw

I've played around a bit more with the digits settings, but this is a bit strange.

  • First setting I have tried is Format - Numeric format, which I set to Fixed - 1 decimal place, thousands seperator.
  • Second setting I have tried is defining a User profile.

In the first run, nothing worked related to the Mathcontainer.

But funnily there was one change when I upgraded to Maple 2020. Suddenly the Mathcontainers did behave like expected.

That was until I copied the table and did some changes. For the second table the original behaviour is back again, ignoring the wish to just show one digit.

So somehow there seems to be a way to define decimal settings, but I don't know where that should be done.

Materialdata_Tre.mw

Thanks guys, these answers are very interesting, though I am not sure if I do understand everything. I'll try to sum up in my own words.

The first answer "the value assigned to b is the entry in m[a,1], not a reference to its location" shows that Maple clearly does thing a bit different than Mathcad. It's just that one has to know that.

In the second answer, using ' ' the assignment is not to the value, but to the expression. In that case, only when the expression is evaluated, then the result is given.

Interesting...

@dharr 

The use of math container is something I have seen in an example as well, probably it's the best way for showing values with units (which I am doing here).

Any idea how I could format the output? Right now it looks like that, however I'd like to have just 1 digit after the decimal delimiter.

Just wanted to add one more thing.

Originally my problem was that I first entered a 2D math expression, and when running the program this was evaluated. As I just wanted the text, I thought I'd need a text area or label to do that. Found out that I can change a 2D math expression to not be evaluated, so I am going for that one.

First 14 15 16 17 Page 16 of 17