acer

32313 Reputation

29 Badges

19 years, 313 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

A flexible tool for this is verify,list.

See a recent usage example by Joe here (including for float entries)

acer

Yes, look at the module help-page. That's what you should use to create a package.

Look also at the Advanced Programming Manual (available here) which has material on this in section 2.3 and chapter 2 in general.

This comment might also be of some (lesser) use.

acer

By default you cannot write to the Maple system archives, so that you cannot inadvertantly clobber their contents.

First create a writable personal archive of your own, using LibraryTools:-Create or march. Then either prepend its location to libname, or set savelibname, so that your subsequent calls to savelib will use that new, personal archive.

If you are having problems with a routine such as savelib, you can try both reading its help-page as well as following some of the cross-references in its See Also section.

acer

The square-bracket subindexing notation provides this for Vectors, Matrices, and Arrays.

> A:=<1,2,3,4,5>:

> A[1..3];
                                      [1]
                                      [ ]
                                      [2]
                                      [ ]
                                      [3]
 
> A[..3];
                                      [1]
                                      [ ]
                                      [2]
                                      [ ]
                                      [3]
 
> A[1..-3];
                                      [1]
                                      [ ]
                                      [2]
                                      [ ]
                                      [3]

> A[2..4];
                                      [2]
                                      [ ]
                                      [3]
                                      [ ]
                                      [4]

acer

In Maple 13, you can use ~ to modify the minus (-) operator.

`#msub(mi("x"),mi("coord"))` -~ `#msub(mi("y"),mi("bar"))`;

In Maple 12 and earlier, you can use map instead.

map(`-`, `#msub(mi("x"),mi("coord"))`, `#msub(mi("y"),mi("bar"))` );

acer

Do you mean that you want all computations to be done modulo 26? If that means linear algebra computations then you can use LinearAlgebra:-Generic. I don't know a convenient way to get it automatically for all scalar arithmetic except by creating your own package with exported/overloaded operators.

acer

You could start by reading this. Then, if you decide to go with alpha-beta pruning, you might try studying this. After that, you could work on a (static) position evaluator.

It is an interesting question: to what degree position heuristics matter in an effective Go position evaluator (relative, say, to how much they do in a chess position evaluator).

acer

See ?updates,Maple9,compatibility but look at that help-page in your actual Maple, in either the Classic or commandline (TTY) interfaces of Maple 13, or in any interface of Maple 9 through 12.

There it explains that x*x does not simplify to x^2 inside a procedure body because `x` might be a function call or something that returns a random result (and anyone who bothered to enter x*x presumably would want two distinct random results multiplied together, rather than a single result that gets squared).

In the Standard GUI of Maple 13 or the Online Help the input in that explanation is itself automatically simplified from x*x to x^2, so it reads as "x^2 does not automatically simplify to x^2". This is my favourite bug of the month. I will submit an SCR against it.

acer

> m := module() option package; export f;
> local ModuleLoad;
> ModuleLoad:=proc() print("You are proud user of the Foo-package!");
> end proc:
> end module:
> with(m);
                                      [f]
 
> LibraryTools:-Create("foo.mla");
> libname:="./foo.mla",libname:
> savelib(m);
> restart:
> libname:="./foo.mla",libname:
> with(m);
                   "You are proud user of the Foo-package!"
 
                                      [f]

acer

What sort of constraints do you have?

It sounds as if you wish to fit a curve to the data using a least squares approach. The curve to which you intend a fit might be linear. And you also wish to constrain the variables (though whether by simple bounds, or by complicated constraint equations remains to be seen).

To do least-squares fitting of data to a linear model, you can use CurveFitting:-LinearFit. See also Statistics,Regression. If you have arbitrary constraints then you should be able to set it up using Optimization:-LSSolve, where the objective would be the formula for the distance (ie. sum of squares) to the model function.

acer

The first link your gave is just a duplicate link to the second upload. Perhaps you meant the first link to point at H_Crear lib ITS90.mw? Mapleprimes isn't letting me view that. So I'll try to guess your problem.

Why are you saving the module to a .m file instead of a .mla archive file?

Consider these two examples,

> m := module() option package; export f;
> local A; A:=<<13>>: f:=proc(x) x*A[1,1]; end proc;
> end module:
> m:-f(3);
                                      39

> save(m,"foo.m");

> restart:
> read("foo.m");
> m:-f(3); # your situation?
                                   3 A[1, 1]

Now, saving the module to a Library archive (adjust locations for your OS. On Linux/UNIX I use "." to refer to the working directory in which I started the commandline interface. On Windows with the Standard GUI, you'd likely want to use "C://temp" or similar),

> restart:
> m := module() option package; export f;
> local A; A:=<<13>>: f:=proc(x) x*A[1,1]; end proc;
> end module:
> m:-f(3);
                                      39

> LibraryTools:-Create("bar.mla"):
> libname:=".",libname:
> savelib(m):

> restart:
> libname:=".",libname:
> m:-f(3);
                                      39

I'll submit an SCR that LibraryTools:-Create's help-page has Examples showing filenames with the older (deprecated?) .lib extension rather than the more modern .mla extension.

You might have also tried to make your module's exports reference the Matrix entries by depending on Maple's scoping functionality. That is, you might have defined the Matrix outside of the module altogether. For example,

> restart:
> m := module() option package; export f;
> f:=proc(x) x*A[1,1]; end proc;
> end module:
> m:-f(3);
                                   3 A[1, 1]

> A:=<<13>>:
> m:-f(3);
                                      39

In such a case I would suggest defining Matrix A explicitly as a local of the module m, as in the examples at top. Alternatively you could also savelib Matrix A to the .mla archive. But I find such approaches which rely on scoping to often cause more trouble than they are worth (unless there's something special which makes it more useful, such as using the Matix data in two distinct modules which must be kept separate for some strange reason.)

acer

Make sure you don't include a space between plot and the ( bracket, if you are entering the command as 2D Math (the default for new users). If the space is there, Maple treats it as `plot` multiplied by (....).

Next, the help-page shows various calling sequences. Be careful not to mix and match their purposes. The one with the form plot( [f(t), g(t), t=a..b] ) is for parameter-plots where f(t) and g(t) represent the formulae for the x and y coordinates evaluated at a particular t. The form plot( f(t), t=a..b ) is for plotting expressions of t. The form which you gave at top, plot( [f(t), t=a..b] ) doesn't match either of those two valid forms.

acer

Is this what you're after?

with(Statistics):

myPDF:=piecewise(x<-10,0,x=-10,CDF(Normal(0,20),-10),PDF(Normal(0,20),x)):

myCDF:=simplify(int(convert(myPDF,Heaviside),x)) assuming x::real;

Then you could plot myPDF and myCDF (with or without discont=true).

acer

It has previously worked for me on both an Intel quad-core Q6600 machine running Windows Vista, as well as an Intel dual-core Core2Duo running Windows XP.

I wonder if perhaps your Maple session was not completely fresh (not merely restarted, but relaunched) or did not pick it up. What happens if you issue these commands in Maple?

getenv(OMP_NUM_THREADS);

kernelopts(numcpus);

I suppose that there is a possibility that the Intel MKL BLAS is not properly recognizing your AMD quad-core Phenom as being multi-core.

acer

What were the other operations that you did before that?

Did you really mean that you assigned into a list at some prior point, or just that you last tried the assignment,

> a:=[1,2];

acer

First 292 293 294 295 296 297 298 Last Page 294 of 336