Stephen Forrest

Mr. Stephen Forrest

466 Reputation

14 Badges

20 years, 361 days
Maplesoft
Software Architect

Social Networks and Content at Maplesoft.com

Maple Application Center

MaplePrimes Activity


These are replies submitted by Stephen Forrest

It should be noted that Maple in its current incarnation contains code from many different copyright holders, as you can see by looking at the help page ?copyrights. Some of these, like CLAPACK, GMP, ImageMagick, are free/open source software (FOSS). Other code, such as that from NAG (the Numerical Algorithms Group) is proprietary. Thus even in the unlikely event that "Maple" was released under a free licence, it would probably differ markedly from the current commercial Maple since much of the proprietary code which Maple uses could not be so released.
Par exemple, si je voulais modeler (en utilisant une animation) le force d'un ressort, j'entrerais le commande suivante en Maple: Ws := (-1/2)kx^2; Quand on ecrit quelques commandes de Maple ici (à MaplePrimes) que quelqu'un peut copier et coller, il faut employer l'astérisque pour dénoter la multiplication. Par example: Ws := (-1/2)*k*x^2;
Par exemple, si je voulais modeler (en utilisant une animation) le force d'un ressort, j'entrerais le commande suivante en Maple: Ws := (-1/2)kx^2; Quand on ecrit quelques commandes de Maple ici (à MaplePrimes) que quelqu'un peut copier et coller, il faut employer l'astérisque pour dénoter la multiplication. Par example: Ws := (-1/2)*k*x^2;
This particular trick — dynamically building a table then converting to a list at the end — is something I've used before in a number of places: it's really all you can do when you have to return a list of possibly arbitrary size. However, this particular formalization is particularly nice. I was curious to see how it scaled: since there is a bit of overhead to tables, would adding an element actually be linear with a very small coefficient? It seems not, or at least this coefficient is very small indeed.
N := 100000:
A := Array(1..N):
lb := ListBuffer():
for i from 1 to N do A[i] := time(lb:-append(i)): end do:
plots[pointplot]( [seq([j,A[j]], j=1..N]) );
The outliers in the plot are probably gc-related.
unfortunately, at this time there is no feature locking sections or subsections. This is something that users have requested and is being considered for a future release. I would imagine that the combination of locked subsections with autoexecuting code would be controversial. Of course, there's also the question of how locking would work: it's one thing to set a bit in the section header to tell Maple not to allow expanding it, but then the code is still readable in XML.
unfortunately, at this time there is no feature locking sections or subsections. This is something that users have requested and is being considered for a future release. I would imagine that the combination of locked subsections with autoexecuting code would be controversial. Of course, there's also the question of how locking would work: it's one thing to set a bit in the section header to tell Maple not to allow expanding it, but then the code is still readable in XML.
Variables with underscores appearing in solutions are generally parameters in the output, or dummy variables needed for implicitly-defined things. Sometimes they have assumptions on them, e.g. _Z in the output below has an assumption of 'integer'
_EnvAllSolutions := true:
solve( sin(x), x );
                         Pi _Z2~
Sometimes they have no assumptions, and are simply dummy variables:
RootOf(x^2=2, x, -1.41);
                                  2
                         RootOf(_Z  - 2, -1.41)
In order to explain what your _X means, I would need to be able to reproduce the output. What inputs did you provide to SolveTools:-PolynomialSystem? I tried the giving complete set of unknowns for the variable list, and when that didn't work tried a few obvious subsets; none of these generated any solutions. Incidentally, is there a reason you're not simply using solve? (It does return a solution to this system immediately.)
I dug through some online Mathcad manual. genvecs is defined in terms of another function genvals. Given M,N real-valued square matrices of the same size, genvals(M,N) returns a vector v of eigenvalues, each of which satisfies the generalized eigenvalue equation M x = v_j N x for nonzero eigenvectors x. genvecs(M,N) returns the matrix of eigenvectors corresponding to genvals(M,N), so the jth column of genvecs(M,N) is the eigenvector x satisfying M x = v_j N x, where j = genvals(M, N). As far as I can tell, the equivalent Maple command is simply the two-argument form of LinearAlgebra:-Eigenvectors, with the output=vectors option. The equivalent of genvals is the two-argument form of LinearAlgebra:-Eigenvalues, or LinearAlgebra:-Eigenvectors with the output=values option. Here is an example (stolen from the help page ?LinearAlgebra,Eigenvectors):
> M := Matrix([[6.,8.,5.],[8.,8.,9.],[5.,9.,6.]], datatype = float):
> N := Matrix([[6.,3.,3.],[3.,8.,8.],[3.,8.,9.]], datatype = float):
> LinearAlgebra:-Eigenvectors(M, N, output=vectors);
   [0.102604389547461192 + 0. I     0.657926936009840757 + 0. I     -0.722787575511656067 + 0. I]
   [                                                                                            ]
   [-0.735167353706277727 + 0. I    0.699410581470925828 + 0. I     0.0525410432222221321 + 0. I]
   [                                                                                            ]
   [0.670075593713203022 + 0. I     -0.279207781766920516 + 0. I    0.689070068616467024 + 0. I ]

> LinearAlgebra:-Eigenvalues(M, N);
           [-4.55651173111531005 + 0. I]
           [                           ]
           [1.56423606281299010 + 0. I ]
           [                           ]
           [0.223044899071558001 + 0. I]
You can get both results simultaneously by calling LinearAlgebra:-Eigenvectors with the option output=[values, vectors] (which is also the default).
I dug through some online Mathcad manual. genvecs is defined in terms of another function genvals. Given M,N real-valued square matrices of the same size, genvals(M,N) returns a vector v of eigenvalues, each of which satisfies the generalized eigenvalue equation M x = v_j N x for nonzero eigenvectors x. genvecs(M,N) returns the matrix of eigenvectors corresponding to genvals(M,N), so the jth column of genvecs(M,N) is the eigenvector x satisfying M x = v_j N x, where j = genvals(M, N). As far as I can tell, the equivalent Maple command is simply the two-argument form of LinearAlgebra:-Eigenvectors, with the output=vectors option. The equivalent of genvals is the two-argument form of LinearAlgebra:-Eigenvalues, or LinearAlgebra:-Eigenvectors with the output=values option. Here is an example (stolen from the help page ?LinearAlgebra,Eigenvectors):
> M := Matrix([[6.,8.,5.],[8.,8.,9.],[5.,9.,6.]], datatype = float):
> N := Matrix([[6.,3.,3.],[3.,8.,8.],[3.,8.,9.]], datatype = float):
> LinearAlgebra:-Eigenvectors(M, N, output=vectors);
   [0.102604389547461192 + 0. I     0.657926936009840757 + 0. I     -0.722787575511656067 + 0. I]
   [                                                                                            ]
   [-0.735167353706277727 + 0. I    0.699410581470925828 + 0. I     0.0525410432222221321 + 0. I]
   [                                                                                            ]
   [0.670075593713203022 + 0. I     -0.279207781766920516 + 0. I    0.689070068616467024 + 0. I ]

> LinearAlgebra:-Eigenvalues(M, N);
           [-4.55651173111531005 + 0. I]
           [                           ]
           [1.56423606281299010 + 0. I ]
           [                           ]
           [0.223044899071558001 + 0. I]
You can get both results simultaneously by calling LinearAlgebra:-Eigenvectors with the option output=[values, vectors] (which is also the default).
The preferable thing to do would be to first check if the number is within the 10000 precomputed digits of Pi that Maple stores, and only to an evalf for more digits if necessary. A bit of messing around with LibraryTools shows the Maple constant _bigPi contains the precomputed 10000 digits. We can implement a cheap lookup routine as the following:
BirthdayPi := proc(b)
   local s, n;
   s := convert( op(1,_bigPi), 'string'):
   n := StringTools:-Search( convert(b, 'string'), s );
   if n=0 then FAIL else n-1 end if;
end proc:
So, some hypothetical person born on March 14, 1592 (a truly random date, if ever there were one) is there:
> BirthdayPi(3141592);
                      0
But, alas, my birthday is not. Indeed, the only years present in the first 10000 digits of Pi from 1900 to now are these: 1907, 1909, 1927, 1931, 1932, 1938, 1941, 1949, 1953, 1957, 1959, 1960, 1964, 1971, 1995, 2000 and even if you're lucky enough to be born in one of these years, chances are small that your birthday will be present. (BTW, I see your birthday is coming up; happy birthday in advance! I'll say it now because we Christmas babies always get end up getting neglected in the rush.)
Well, though I am a fan of his work, I don't really think you're allowed to count Bourbaki. :)
Well, though I am a fan of his work, I don't really think you're allowed to count Bourbaki. :)
In addition to the comments made about the original problem, I should point out that there is nothing wrong with this example either. f is assigned a table, g is pointed at the name f, f is assigned a copy of the table which g ultimately evaluates to. At this point, f points at a table, and g still points at the name f, as you can see by doing
> g;
                f
So assigning g[1] := 2 is equivalent to assigning f[1] := 2, so the last statement is not surprising. The primary weirdness here is that the assignment g := f; resulted in g being pointed at the name f, not its value. This is because Maple tables have last name evaluation, and objects suffering from LNED ("last name evaluation disease") are responsible for many of Maple's strange semantics.
Interesting idea, though I do wonder how far it would scale. One could write, for example:    ∀ ε>0 ∃ δ . |x-a|< δ ⇒ |f(a)-L| < ε but it would be hard to express, say, Cantor's diagonal argument showing that the cardinality of the reals is different from that of the integers without resorting to English (or the language of your choice). I guess one problem is that it's hard to simply sit and comtemplate the beauty of mathematics as one can do with art. One has to actually do it — compute things, prove theorems, make conjectures — to get a feel for its power. Trying to explain, for example, how amazing it is that Euler's formula relates the five most important constants in mathematics is impossible before your listener has appreciated the importance of pi (through geometry), e (through calculus), and the complex numbers (through the fundamental theorem of algebra).
It can't be applied to real x though. Nor to purely imaginary x either.
2 3 4 5 6 7 Page 4 of 7