Nigel Rivett

5 Reputation

One Badge

3 years, 352 days

MaplePrimes Activity


These are replies submitted by

@tomleslie Thanks.

After some more playing I wasn't sure about 1D and 2D.

It seemed to give different results when I converted the input to 1D then changed again when I changed the global settings created a new worksheet then went back to the original. And I couldn't get back to the original behaviour.

I have a feeling it is getting into the realm of a bug.

I can see why you were keen on getting a worksheet uploaded - sorry I didn't understand what you meant, it would have saved you (and me) a lot of time.

Anyway thanks for your help. I've learnt a lot about Maple - although I suspect I'll never need it again :).

Consider this

Take your dig2.mw. Convert the first command to 1D input then it considers it text and gives 5 digits. Then convert to 2D - Math 2D input - still gives 5 digits.

Change to Maple input - still 5 digits

Delete and retype all the commands - back to 10 digits.

 

@tomleslie Sorry, I understand what you mean.

Loading your worksheet works fine.

I am set to 2D input rather than Maple input - is that something to do with it.

If I set it to Maple input then copy the commands from your worksheet it seems ok.

If I just set to Maple input the type in the commands it doesn't work.

Here's a worksheet with a selection - the one's that work are all set to Maple input then copied from your worksheet.

Is there some option or default I need to set?

Thanks for your help. I hope the upload works.


 

Download Test01.mw

Moved following posts to this post

If I right click on the command group and select convert to 1D Math then it works.

Should I set this to a default somehow?

I've found a post about how to do this. Is it recommended? The way 2D acts seems a bit od but I don't know what that's meant to be for.

Just checked and we use Maple Notation Input which seems to be 1D so I've changed it to that.

Would be nice to know wht 2D acts the way it does though.

@ Also

restart;
Digits := 1;
Digits := 5;
1.0/3;

Always gives me the default 10 digits

@tomleslie Don't know what you mean by big green up-arrow in the Mapleprimes toolbar.

When I copy that in and evaluate the worksheet I do get 8 digits - but only if Digits is set to 8 from a previous execution.

If I execute

Digits := 1

Then execute

 Digits:=1;
  Digits:=8;1.0/3;

It gives me a single digit

If I then execute it again it gives me 8 digits - because it's set from the previous execution?

Previusly I was executing by just pressing enter (necessary to execute the Digits:=1 separately first) - I'm doing it now by Evaluate, Execute Worksheet and get the same result.

Which version are you using?

It's worthwhile checking if I'm not doing something very stupid as this is my first attempt.

@tomleslie Thanks

That's very odd but maybe it's why the previous replies didn't seem relevent.

# OP *claims* that this evaluates to 1 digit
# which is obviously untrue

I just tried that again and I get one digit.

Also you need to execute the Digits:=1 first to set the value then the next statement so you should end up with the result (at least this is what I get).Digits := 1;
                          Digits := 1

Digits := 8; 1.0/3;
                          Digits := 8

                              0.3

If it's not a problem with the way you are executing it the maybe there is a problem/difference with my setup.

I downloaded yesterday so v2021 I think on windows 10. I don't know if anything else could affect things.

Thanks for trying it.

The point about using evalf was to try and set from Digits using multiple commands on a single line. Using a literal means that the value of Digits is overridden. 

@tomleslie Thanks for the response.

>> this change is undone when the procedure exits

Yes that's why I repaeat the set outside the procedure. The question was about the difference between the command and the same thing in the procedure. A commands in a procedure are executed differently.

Yes, Digits is used for the precision if it's not overridden but it can be set to a different value. The question is about when that takes effect.

So 

Digits:=1

Digits :-=8;

1.0/3;

Gives 8 digits

Digits:=1

Digits :=8;1.0/3;

Gives 1 digit

Digits := 1;

a := Digits; a := a + 7; evalf[a](1.0/3);

Gives

a := 1

a := 8

0.3

So even with a variable a it says that the a:=8 but still uses the initial value of Digits = 1.

Edit: Oops sorry - I see what you mean about evalf now.

@vv Thanks but that isn't using the value of Digits in the evalf - it is using a literal. The problem is concerning using the value of Digits.

Page 1 of 1