pagan

5147 Reputation

23 Badges

17 years, 122 days

 

 

"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway

 

MaplePrimes Activity


These are replies submitted by pagan

In a Worksheet you do not have to enter Ctl-M (or F5) at each input line, if you mostly to use 1D Maple input mode.

You can instead set it as a preference, toggling the "Input display" drop-down menu to "Maple Notation" in the "Display" tab of the pop=up window that opens using Tools-Options from the menubar.

In a Worksheet you do not have to enter Ctl-M (or F5) at each input line, if you mostly to use 1D Maple input mode.

You can instead set it as a preference, toggling the "Input display" drop-down menu to "Maple Notation" in the "Display" tab of the pop=up window that opens using Tools-Options from the menubar.

Does anyone else ever imagine that the Mapleprimes logo contains grawlixes?

It's not clear (yet) whether you intend to create AnotherPackage before or after you create MyLib, and whether you intend on savelib'ing AnotherPackage so as to access it in a new session or recreate it on the fly. Is this code sample below enough to get you going?

Notice that I never issue the command with(AnotherPackage).

> restart;  
> try
>  FileTools:-Remove("c:/tmp/MyLib.lib"):
>  FileTools:-Remove("c:/tmp/MyLib.ind"):
> catch:
> end try:
> march('create', "c:/tmp/MyLib.lib"):

> MyLib:= module()
> export f1;
> local g1, g2; 
> option package;
>  f1 := proc(x)
>         AnotherPackage:-h(x);
>        end proc: 
> end module:

> savelibname:="c:/tmp":
> savelib( `MyLib` );

> AnotherPackage := module()
> export h;
>  h := proc(x)
>        x^2+sin(x);
>       end proc:
> end module:

>MyLib:-f1(z);
                           2         
                          z  + sin(z)

>restart:

>libname:=libname,"c:/tmp":
> MyLib:-f1(z); # expect an error here
Error, (in MyLib:-f1) `AnotherPackage` does not evaluate to a module

> AnotherPackage := module()
>  export h;
>  h := proc(x)
>        x^2+sin(x);
>       end proc:
> end module:

> MyLib:-f1(z);
                           2         
                          z  + sin(z)

> savelibname:="c:/tmp":
> savelib( `AnotherPackage` );

> restart:
> libname:=libname,"c:/tmp":
> MyLib:-f1(z);
                           2         
                          z  + sin(z)

It's not clear (yet) whether you intend to create AnotherPackage before or after you create MyLib, and whether you intend on savelib'ing AnotherPackage so as to access it in a new session or recreate it on the fly. Is this code sample below enough to get you going?

Notice that I never issue the command with(AnotherPackage).

> restart;  
> try
>  FileTools:-Remove("c:/tmp/MyLib.lib"):
>  FileTools:-Remove("c:/tmp/MyLib.ind"):
> catch:
> end try:
> march('create', "c:/tmp/MyLib.lib"):

> MyLib:= module()
> export f1;
> local g1, g2; 
> option package;
>  f1 := proc(x)
>         AnotherPackage:-h(x);
>        end proc: 
> end module:

> savelibname:="c:/tmp":
> savelib( `MyLib` );

> AnotherPackage := module()
> export h;
>  h := proc(x)
>        x^2+sin(x);
>       end proc:
> end module:

>MyLib:-f1(z);
                           2         
                          z  + sin(z)

>restart:

>libname:=libname,"c:/tmp":
> MyLib:-f1(z); # expect an error here
Error, (in MyLib:-f1) `AnotherPackage` does not evaluate to a module

> AnotherPackage := module()
>  export h;
>  h := proc(x)
>        x^2+sin(x);
>       end proc:
> end module:

> MyLib:-f1(z);
                           2         
                          z  + sin(z)

> savelibname:="c:/tmp":
> savelib( `AnotherPackage` );

> restart:
> libname:=libname,"c:/tmp":
> MyLib:-f1(z);
                           2         
                          z  + sin(z)

What do you mean?

Procedures are called. What do you mean, when you write of "calling" a value (whether it be a "procedure value" or indeed any value)? And what is a "procedure value"?

What do you mean by "inside a string"? The contents of a string are characters. Being "inside" a string is not a place you can "call" anything.

Maybe you could provide several different examples showing both input and desired output, and with as much specific detail as you can.

That site also reports www.mapleprimes.com as having the same iconic size as www.maplesoft.com (48X48). And apparently mapleprimes is a fully distinct item instead of being just a subordinate of the maplesoft site. So, that's interesting.

But mapleprimes doesn't seem to have a favicon, so no image was shown for it.

I couldn't figure out why mathworld didn't get a valid result and placement.

@Christopher2222 I had trouble figuring out if your post was mostly a repeat of this one of yours from January of this year (which got discussion). Or are you also remarking on something else, like "where is 14.01?"

The only way that I can understand the current behaviour of printlevel in a Worksheet is if there are actually two distinct quantities. One of them is the kernel's record of printlevel, and the other is the GUI's. If that was the situation then I could envision the kernel's value being used inside a proc (when it runs), and the GUI's version being used at the "top level".

Also, the GUI may use different values of printlevel per execution group. That aspect is not clear. The help page for printlevel mentions in an offhand way that it is an environment variable, so presumably its value gets the usual scoped evaluation rules for regular environment variables (see ?environment ).

But I don't see how printlevel being an environment variable would explain all the behaviour seen in a Worksheet. Here is an example, of a Worksheet, in Maple 14.


fubar.mw

The only way that I can understand the current behaviour of printlevel in a Worksheet is if there are actually two distinct quantities. One of them is the kernel's record of printlevel, and the other is the GUI's. If that was the situation then I could envision the kernel's value being used inside a proc (when it runs), and the GUI's version being used at the "top level".

Also, the GUI may use different values of printlevel per execution group. That aspect is not clear. The help page for printlevel mentions in an offhand way that it is an environment variable, so presumably its value gets the usual scoped evaluation rules for regular environment variables (see ?environment ).

But I don't see how printlevel being an environment variable would explain all the behaviour seen in a Worksheet. Here is an example, of a Worksheet, in Maple 14.


fubar.mw

You guys are all taking the same course, yes? This is the second or third time in a day or so that essentially duplicated (modulo solve vs fsolve) questions have been asked by two or three new members. You could try reading the answers to each others' posts. For example.

That is nice and simple. It can lead to some extra points being used for the second plot, but likely only when "necessary" (to get the smoothness, adaptively, that plot() demands). So it seems ideal, as both plots are automatically as smooth as plot() would make them usually.

A small thing: the OP appeared to be asking about two separate plots, not overlaid.

restart:

f:=proc(t)
global count;
count :=count+1;
[exp(10*t),10^10*exp(10*(6-t))];
end proc:

F:=proc(t)
global T;
local res;
res := f(t);
T[t]:=res[2];
res[1];
end proc:

count:=0:
plot(F,0..6);
count;

plots:-pointplot(map([lhs,rhs],sort(op(eval(T)),(a,b)->lhs(a)<lhs(b))),connect,color=red);
count;

restart:

f:=proc(t)
option remember;
global count;
count :=count+1;
[exp(10*t),10^10*exp(10*(6-t))];
end proc:

count:=0:
plot(t->f(t)[1],0..6);
count;

plot(t->f(t)[2],0..6);
count;

That is nice and simple. It can lead to some extra points being used for the second plot, but likely only when "necessary" (to get the smoothness, adaptively, that plot() demands). So it seems ideal, as both plots are automatically as smooth as plot() would make them usually.

A small thing: the OP appeared to be asking about two separate plots, not overlaid.

restart:

f:=proc(t)
global count;
count :=count+1;
[exp(10*t),10^10*exp(10*(6-t))];
end proc:

F:=proc(t)
global T;
local res;
res := f(t);
T[t]:=res[2];
res[1];
end proc:

count:=0:
plot(F,0..6);
count;

plots:-pointplot(map([lhs,rhs],sort(op(eval(T)),(a,b)->lhs(a)<lhs(b))),connect,color=red);
count;

restart:

f:=proc(t)
option remember;
global count;
count :=count+1;
[exp(10*t),10^10*exp(10*(6-t))];
end proc:

count:=0:
plot(t->f(t)[1],0..6);
count;

plot(t->f(t)[2],0..6);
count;

@marvin Why couldn't it be due to the second and fourth bullet points? The second one says that only one Maple Thread can call MKL at any given time, so if you have OMP_NUM_THREADS=1 then you have no effective parallel calculation. And the fourth says that, even if you did have concurrent Thread access to MKL, the Matrix-Vector approach could be caused lots more cache misses and hence ruin any cache tuning in MKL.

@erik10 Erik, you asked why I didn't split up my calculation more finely. It was very deliberate, in that I wanted especially to consider only a single multiplication of two floats. I took evalf[20] of Pi and evalf[20] of 4*(1391000/2)^2 to get a pair of floats. I did this specifically because I wanted to examine a single "elementary" or "atomic" floating-point operation, for which given accuracy in terms of Digits could be expected.

Where is the concept of elementary or atomic floating-point operations discussed in the Help system? I'm not sure. But it is my belief that single arithmetic operations, on actual floats themselves, fall into this category. I suspect that certain elementary functions applied to float arguments, such as sin(1.23) also fit the definition. For these operations one might expect a level of relative acccuracy in the result. For example, relative accuracy to less than 1 ulp.

For compound operations, such as evalf(4*Pi*(1391000/2)^2) no such accuracy is promised. That is partly because any 1 ulp error in any intermediate atomic float operation during that computation can get magnified during the subsequent operations, with a final error that is larger. In fact, for an arbitrary compound expression this numeric model can lead to an arbitrarily large relative error. My understanding is that this is simply part of the Maple model of numeric computation.

So, I wanted to test only a specific elementary operation. I wanted to test a muliplication of just two floats. What I showed was that when the working precision (Digits) is less than 4 the result can have a relative error of more than 1 ulp (at that precision). I didn't need to show any more of the elementary steps, since I found a single elementary step which produced insufficient accuracy.

In general, Maple uses guard digits to ensure 1 ulp or better accuracy for elementary floating-point operations. You can see evidence this by examining various bits of Library code, although it must be inferred for builtin kernel operatons like arithmetic (`+`, `*`, etc). But when the working precision (Digits) is less than 4 or 5 or so the guard digits mechanisms seem to fall down sometimes. That's what I was showing with my code above. At more usual Digits settings (eg. >8) the accuracy of elementary operations is very good.

I agree that Maple's numeric computation model should be much more clearly documented. It is important to understand all this stuff, if you are going to reliably program numerics in Maple.

@Axel. It's important to understand that Maple has a working precision setting (Digits) but no accuracy setting (unlike Mathematica, which has both). See this comment of interest.

Here's an interesting paper which touches incidentally on some of this. That paper mentions 0.6 ulps as a promised part of some Maple standard (of elementary float operations, presumably). But I don't know where that might be in the Help system (unless it is by extension, as part of the IEEE 754 spec.)

And, of course, read ?numerics and ?evalf and ?numericrefs and Goldberg.

First 37 38 39 40 41 42 43 Last Page 39 of 81