acer

32385 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Sorry to the audience, if it is obvious, but there is also the possibility to use a combination of `read` and .mla library archives.

The documented source code -- including comments, and structured with $include or related directives -- could be kept in a plaintext file. A simple shell script, or even a very short worksheet, could then be used to `read` the source and save it to library archive. But such a "rebuild" would only need to happen whenever the shared source code got changed. All other occasions that need to use the shared materials could simply pick it up at run time from the .mla library archive.

This is actually how I work with Maple most, by launching the commandline interface to rebuild my .mla, and launching the GUI from a terminal shell. For both of those I use the `-b` option to specify augmentation of libname (although I have several common actions and common libname amendments aliased in the shell, or in simple scripts).

I sometimes prototype procedures in the GUI. But if they become long or if I want to re-use them then I put them into plaintext files, which has yet another benefit of being very safe from corruption. And then I edit them with `vi`, which has Maple source syntax highlighting.

acer

Sorry to the audience, if it is obvious, but there is also the possibility to use a combination of `read` and .mla library archives.

The documented source code -- including comments, and structured with $include or related directives -- could be kept in a plaintext file. A simple shell script, or even a very short worksheet, could then be used to `read` the source and save it to library archive. But such a "rebuild" would only need to happen whenever the shared source code got changed. All other occasions that need to use the shared materials could simply pick it up at run time from the .mla library archive.

This is actually how I work with Maple most, by launching the commandline interface to rebuild my .mla, and launching the GUI from a terminal shell. For both of those I use the `-b` option to specify augmentation of libname (although I have several common actions and common libname amendments aliased in the shell, or in simple scripts).

I sometimes prototype procedures in the GUI. But if they become long or if I want to re-use them then I put them into plaintext files, which has yet another benefit of being very safe from corruption. And then I edit them with `vi`, which has Maple source syntax highlighting.

acer

@Markiyan Hirnyk The forward error of the purported solutions {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} are about 4e-6 and 2e-6, and these do not produce the minimal (absolute) value of the residuals. The exact solutions all produce the minimal absolute value of the residual -- which is zero.

@Markiyan Hirnyk The forward error of the purported solutions {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} are about 4e-6 and 2e-6, and these do not produce the minimal (absolute) value of the residuals. The exact solutions all produce the minimal absolute value of the residual -- which is zero.

@Markiyan Hirnyk Generating a collection of distinct exact solutions is also easily done with a triple do-loop (or it seems even a double loop, after a preliminary `solve` call).

As there are infinitely many integer-valued solutions then characterizing them in some kind of formulaic way seems like a nice goal.

I have x=1, y=-z-1 (and its symmetric equivalents follow, of course), true for all integer z except z=0 and z=-1.

But I don't see the characterization for all other "fixed" x. It might be nice to have a formulaic result giving y in terms of only z, as a (possibly infinite) union over all valid instances of x.

@Markiyan Hirnyk Generating a collection of distinct exact solutions is also easily done with a triple do-loop (or it seems even a double loop, after a preliminary `solve` call).

As there are infinitely many integer-valued solutions then characterizing them in some kind of formulaic way seems like a nice goal.

I have x=1, y=-z-1 (and its symmetric equivalents follow, of course), true for all integer z except z=0 and z=-1.

But I don't see the characterization for all other "fixed" x. It might be nice to have a formulaic result giving y in terms of only z, as a (possibly infinite) union over all valid instances of x.

@Markiyan Hirnyk It now reports {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} as solutions. But these are not exact solutions to (1+1/x)*(1+1/y)*(1+1/z)=2 as the stated equation to satisfy.

@Markiyan Hirnyk It now reports {x=1000000,y=1000000,z=1} and {x=1000000,y=3,z=2} as solutions. But these are not exact solutions to (1+1/x)*(1+1/y)*(1+1/z)=2 as the stated equation to satisfy.

@Markiyan Hirnyk Are some of the more solutions correct only up to floating-point evaluation at a limited precision?

@Markiyan Hirnyk Are some of the more solutions correct only up to floating-point evaluation at a limited precision?

@zook Sorry, I was looking at the bit of your Question where you made two stabs at `define` in order to get phi(x*sigma) to produce phi(x)*sigma. And then I had finger-brain malfunction when querying, and asked you about your intentions for phi(a+b) when I mean to ask about phi(a*b). Sorry.

Note that your followup's solution leaves phi(x*sigma) untouched, for unassigned `x`. It does not produce phi(x)*sigma. And also you mentioned that the following was inadequate for your needs:

restart:
define(phi,linear,phi(sigma)=sigma);
phi(4*sigma);

                                  4 sigma

Hence I took it that you really did want phi(x*sigma) to produce phi(x)*sigma (and not because sigma was stated to be constant... or so it seemed).

So, what I was trying to ask is: what you want from phi(a*b) and phi(a*4*sigma*z)?

@zook Sorry, I was looking at the bit of your Question where you made two stabs at `define` in order to get phi(x*sigma) to produce phi(x)*sigma. And then I had finger-brain malfunction when querying, and asked you about your intentions for phi(a+b) when I mean to ask about phi(a*b). Sorry.

Note that your followup's solution leaves phi(x*sigma) untouched, for unassigned `x`. It does not produce phi(x)*sigma. And also you mentioned that the following was inadequate for your needs:

restart:
define(phi,linear,phi(sigma)=sigma);
phi(4*sigma);

                                  4 sigma

Hence I took it that you really did want phi(x*sigma) to produce phi(x)*sigma (and not because sigma was stated to be constant... or so it seemed).

So, what I was trying to ask is: what you want from phi(a*b) and phi(a*4*sigma*z)?

@jscottelder There is also section 11.3 of the Maple 16 Programming Manual, entitled "Writing Maple Packages By Using Modules", and its paragraph titled, "Custom Libraries".

Note however that once a procedure or module definition is executed it no longer contains comments present in its source. That is to say, comments are stripped off by "execution". This can be seen by using the showstat command on the procedure (or eval or print or dismantle or ToInert). So, naturally, when savelib'ing a procedure or module to a library archive the comments have already been lost.

> f:=proc()
>    # my comment
>    4;
> end proc;

                            f := proc() 4 end proc

> showstat(f);

f := proc()
   1   4
end proc

> print(f);

                               proc() 4 end proc

Retaining comments in procedure bodies would be a useful enhancement of the product, and has been suggested before.

@jscottelder There is also section 11.3 of the Maple 16 Programming Manual, entitled "Writing Maple Packages By Using Modules", and its paragraph titled, "Custom Libraries".

Note however that once a procedure or module definition is executed it no longer contains comments present in its source. That is to say, comments are stripped off by "execution". This can be seen by using the showstat command on the procedure (or eval or print or dismantle or ToInert). So, naturally, when savelib'ing a procedure or module to a library archive the comments have already been lost.

> f:=proc()
>    # my comment
>    4;
> end proc;

                            f := proc() 4 end proc

> showstat(f);

f := proc()
   1   4
end proc

> print(f);

                               proc() 4 end proc

Retaining comments in procedure bodies would be a useful enhancement of the product, and has been suggested before.

@JAnd Raising to %T takes the transpose, just as if you'd wrapped it in a call to the LinearAlgebra:-Transpose command.

First 389 390 391 392 393 394 395 Last Page 391 of 592