acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Sure. But what you write about "fixed, local" locations is also true of libname and .mla Library archives. (BTW, one could also save the Maplet, inside a launching proc, to a Library archive, and then call from any new session.)

The request to attach, somehow, a maplet to the GUI menus without having it point at a fixed location (of either .maplet or .mla file) seems odd to me. What, precisely, would it be stored as/by/to?

acer

Sure. But what you write about "fixed, local" locations is also true of libname and .mla Library archives. (BTW, one could also save the Maplet, inside a launching proc, to a Library archive, and then call from any new session.)

The request to attach, somehow, a maplet to the GUI menus without having it point at a fixed location (of either .maplet or .mla file) seems odd to me. What, precisely, would it be stored as/by/to?

acer

The ?comment help-page read from the Standard GUI of Maple 13 mentions the use of multi-line comments. The ?comment help-page available in the commandline (and Classic?) interfaces does not mention it.

Setting up one's Maple prompt to be the empty comment (**) in the commandline interface is neat. It allows one to copy the entire text of input including the prompt and then insert it as runnable code.

As noted in ?comment, the pasting will only work properly in 1D Maple input mode. It works handlily for inserting into the commandline interface, or into a Worksheet with 1D Maple input mode in Standard.

My Linux ~/.mapleinit file now contains,

interface(prompt=" (**) "):

One could also put that inside a conditional using IsWorksheetInterface(), to get it in commandline but not in Standard.

Someone pointed out to me that it is also documented in ?include in Maple 12, where it also appears to work. (Your mileage may vary.)

acer

Doug, do you mean the ability to insert such a Button programmatically?

In general, there is no functionality at present to insert any kind of Component programmatically, for any purpose, AFAIK. There would be a great deal of usefulness to such functionality, and I believe that it's been discussed here before.

But you should be able to insert a Button Component "by hand" (using the mouse pointer and palette) and then edit the "Action when Clicked" to issue read "foo.maplet". You likely already realize this. Redirecting results returned by the Maplet would be more work, of course.

What happens on Windows if you File->Open a foo.maplet file? On Linux, where there is no MapletViewer, it simpply inserts the file's contents.  On Windows, can you Open or Launch from the File menu?  The File->Open manager does allow filtering by .maplet filename extension.

If there were a way to get a context-sentive menu action to run a Maplet (and behave nicely when returning NULL) when right-clicking on the "empty region" (where the cursor lies), then one could write code to automatically add reading file foo.maplet to the context-menus. I haven't really tried this. I've had difficulty getting a context-menu action to %CANCEL and insert nothing (not even NULL) after launching say a Worksheet/Help.

acer

Doug, do you mean the ability to insert such a Button programmatically?

In general, there is no functionality at present to insert any kind of Component programmatically, for any purpose, AFAIK. There would be a great deal of usefulness to such functionality, and I believe that it's been discussed here before.

But you should be able to insert a Button Component "by hand" (using the mouse pointer and palette) and then edit the "Action when Clicked" to issue read "foo.maplet". You likely already realize this. Redirecting results returned by the Maplet would be more work, of course.

What happens on Windows if you File->Open a foo.maplet file? On Linux, where there is no MapletViewer, it simpply inserts the file's contents.  On Windows, can you Open or Launch from the File menu?  The File->Open manager does allow filtering by .maplet filename extension.

If there were a way to get a context-sentive menu action to run a Maplet (and behave nicely when returning NULL) when right-clicking on the "empty region" (where the cursor lies), then one could write code to automatically add reading file foo.maplet to the context-menus. I haven't really tried this. I've had difficulty getting a context-menu action to %CANCEL and insert nothing (not even NULL) after launching say a Worksheet/Help.

acer

I doubt that you'd want "all" possible computations done modulo 26. There's a lot more to "all" than you might at first imagine.

Maybe you mean interactive arithmetic, or something like that. You should be able to extend this simplistic example code below to cover other arithmetic operators (as described in the ?mod help-page).

> modenv := module() export `+`,`-`,use_p;
>    option package;
>    local p;
>    use_p := proc(x::posint) p:=x; end proc;
>    `+` := proc(a,b) (a+b) mod p; end proc;
>    `-` := proc(a) :-`-`(a) mod p; end proc;
> end module:

> with(modenv):
> use_p(26):

> 7+24;
                                       5
 
> -24;
                                       2
 
> 3-24;
                                       5

There may well be some tricky syntax corners, possibly where the global operators like :-`+` would still be wanted.

acer

I doubt that you'd want "all" possible computations done modulo 26. There's a lot more to "all" than you might at first imagine.

Maybe you mean interactive arithmetic, or something like that. You should be able to extend this simplistic example code below to cover other arithmetic operators (as described in the ?mod help-page).

> modenv := module() export `+`,`-`,use_p;
>    option package;
>    local p;
>    use_p := proc(x::posint) p:=x; end proc;
>    `+` := proc(a,b) (a+b) mod p; end proc;
>    `-` := proc(a) :-`-`(a) mod p; end proc;
> end module:

> with(modenv):
> use_p(26):

> 7+24;
                                       5
 
> -24;
                                       2
 
> 3-24;
                                       5

There may well be some tricky syntax corners, possibly where the global operators like :-`+` would still be wanted.

acer

One calls CurveFitting:-Spline in order to get a continuous piecewise object. The continuous nature of the resulting piecewise object is not (currently) retained knowledge, and so the burden lies on the user to pass that on (as an option to int, say).

But what if CurveFitting:-Spline were to place 'continuous' as an attribute on the returned piecewise object. If that were so, then int or discont or evalf/Int might detect it and benefit.

That could take the burden off of the user to pass along the knowledge. It would be cheaper than having discont try and discover continuity, even if it did so by cleverly examining the conditions for overlap/touching and checking matched evaluated values.

acer

One calls CurveFitting:-Spline in order to get a continuous piecewise object. The continuous nature of the resulting piecewise object is not (currently) retained knowledge, and so the burden lies on the user to pass that on (as an option to int, say).

But what if CurveFitting:-Spline were to place 'continuous' as an attribute on the returned piecewise object. If that were so, then int or discont or evalf/Int might detect it and benefit.

That could take the burden off of the user to pass along the knowledge. It would be cheaper than having discont try and discover continuity, even if it did so by cleverly examining the conditions for overlap/touching and checking matched evaluated values.

acer

He might even mean that he pressed (entered) the <Return> or <Enter> key in the block that defined the proc. Right, that would be the moment when a quote-mismatch error message would get displayed.

acer

He might even mean that he pressed (entered) the <Return> or <Enter> key in the block that defined the proc. Right, that would be the moment when a quote-mismatch error message would get displayed.

acer

The leaf of the acer palmatum (irohamomiji) could inspire a refreshing change for a new logo for Maple.

The leaf of the acer palmatum (irohamomiji) could inspire a refreshing change for a new logo for Maple.

This comes up repeatedly. There have been earlier threads addressing it, here and here say.

I am not completely satisfied with Doug's suggestion above, where MyCos(50) would return the global cos(50) since that result would get interpreted in terms of radians if subsequently evalf'd.

It might be useful if someone with sufficient expertise could roll together a package that did as much as can be currently accomplished (filling in for all trig and inverse trig where possible, giving desirable output in both 1D and 2D even when returning unevaluated, etc, etc). Basically, a citable "final word" with current mechanisms. Such a package could be based on the best techniques already suggested in the related subthreads.

Accompanying such a package might be notes explaining that the package is for "interactive" use and is not a modal switch for all of Maple; trig calls returned from other Library routines would still be in terms of radians. Any other currently unresolvable issues could be noted.

Of course, Doug's comments about learning about and using radians -- as a recommended course of action -- might still apply.

acer

I advise not using Units[Natural]. Too many symbols are taken to be units, so that environment has practically no single-character symbols left for general use.

In your example, you probably intended `t` to be a free variable, while `deg` stood for Unit(degree). But under Units[Natural], `t` means tonne.

> with(Units[Natural]):

> t+kg;
                                   1001 [kg]

And that's why the exported `sin` routine choked, because it thought it was getting tonne*degree and not `t`*degree.

In the following solutions, _Z1 means "any integer".

> solve(sin(x*Pi/180)=0,AllSolutions);
                                   180 _Z1~

> restart:
> with(Units[Standard]):
> solve(sin(x*Unit(deg))=0,AllSolutions);
                                   180 _Z1~

> restart:
> with(Units[Natural]):
> solve(sin(tt*deg)=0,AllSolutions);
                                   180 _Z1~

acer

First 478 479 480 481 482 483 484 Last Page 480 of 592