Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 313 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

Won't this make the Excel file too large to open in Excel? What do you want to do in Excel that can't be done in Maple?

How will multithreading help you on your single-processor computer?

@acer My interpretation of the OP's request was that they wanted an expression with Nabla expanded to diff or Diff but without the f expanded (to wit: "When f (specific expression) is very complicated, in order to write concisely"). My Answer does not attempt to give a workaround for %Nabla@@4 because even if that did work under value, the final result wouldn't be what the OP wants when f is complicated.

On the other hand, this does seem to me to produce what the OP wants:

restart:
with(Physics:-Vectors):
f:= (x,y,z)-> sin(x)*sin(y)*sin(z)*exp(-x^2-y^2-z^2):
(Nabla@@4)(%f(x,y,z));

diff(%f(x, y, z), x$4)+2*(diff(%f(x, y, z), x$2, y$2))+2*(diff(%f(x, y, z), x$2, z$2))+diff(%f(x, y, z), y$4)+2*(diff(%f(x, y, z), y$2, z$2))+diff(%f(x, y, z), z$4)

In short, my Answer doesn't address the Question's titular issue because doing so doesn't produce the actually desired result.

@Carl Love Here's an example of using Iterator. This uses all 3.6x10^5 permutations of $1..9 (the first 9 natural numbers). Just to have something to do with them, I took the first 9 primes, used the permutation as exponents for the primes, multiplied those, and added that for all the permutations.

restart:
n:= 9:
Pr:= Array(1..n, k-> ithprime(k), datatype= integer[8]):
CodeTools:-Usage(add(mul(Pr^~pm), pm= Iterator:-Permute(n, 'plain')));
memory used=0.56GiB, alloc change=34.00MiB, 
cpu time=2.20s, real time=2.22s, gc time=93.75ms

     17397348309628470393619091828889943584100122136329600

This uses no significant amount of memory. The report of  "memory used" is a misnomer. It should be labeled "memory used & recycled"---it doesn't represent the amount of memory in use at any one time.

The keyword plain makes the Iterator use the same array transposition algorithm that you coded in C++ in another thread. 

@lcz Like I said, you can replace f by %f instead of replacing Nabla by %Nabla. Then the Nablas will be expanded, but not the f, until you use value.

@Thomas385 Man, that's really lame of you. There's at least one more critical point to find.

@acer If I've read correctly (albeit very quickly), that help page says that name conflicts won't be a problem if the global name has last_name_eval. Well:

type(:-process, last_name_eval);
             true

So why the name conflict?

@acer Okay, I deleted my Reply so that the student can do that.

@acer [I deleted this comment to follow your pedagogy.]

@acer Thus, it follows that to guard against future changes to the namespace breaking one's code, one must always use the function:- or object:- prefix. Hopefully, Maplesoft's own programmers have been taking this into account.

@janhardo The Thomas's calculus textbook is great. He made millions of dollars from that.

@acer Thanks for the link. That was the best Maple help page that I ever read.

@nm Here's a workaround that avoids that redundancy and gets you close to the syntax that you prefer from other OOPLs:

`&.`:= proc(obj, meth) option inline; obj[meth](obj) end proc:

Usage:

my_car&.process;

@nm I agree, totally.

@janhardo The process of determining the radius of convergence is greatly simplified by this theorem:

For any algebraic function (see Wikipedia article linked) A(n) other than constant 0, 

limit(abs(A(n))^(1/n), n= infinity) = 1.

Thus, polynomial and polynomial-like factors do not change the radius; they can be crossed off and ignored as far as the radius is concerned.

@nm  Since you're using Array extension, this is a good place to bring up the new appending operator ,=. This allows you to append to the end of an Array without needing to keep track of the index of the last element:

restart:
A:= Array(1..0): #1 dimension, 0 elements
p:= 1: to 9 do A,= (p:= nextprime(p)) od:
A;

And if your final goal is a list or set rather than an Array, the new embedded-loop syntax is even more to the point:

restart:
p:= 1: [to 9 do p:= nextprime(p) od];
                [2, 3, 5, 7, 11, 13, 17, 19, 23]
First 185 186 187 188 189 190 191 Last Page 187 of 708