Carl Love

Carl Love

24688 Reputation

25 Badges

10 years, 59 days
Natick, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity

These are answers submitted by Carl Love

I've never a practical (useful) case of a nonsingular matrix with symbolic entries whose Moore-Penrose pseudoinverse could be calculated in a reasonable amount of time. 

The analog of "gradient" for a vector field is called jacobian. It is a matrix. It is available as command Jacobian in the VectorCalculus and Student:-VectorCalculus packages.

If the animation is produced with the Explore command, as shown below, the frames are displayed "on the fly" (i.e., as they are produced). So, unlike Maple's other animation commands, this has the benefit of starting play immediately. The memory used by the kernel for this is trivial, under 50 Mb; however, the memory used by the GUI grows unboundedly. I killed the below (just by pressing the stop button under the animation) when my GUI was using about 8 Gb. Still, it displayed a few thousand frames. (If you delete the Explore window after stopping it, those Gigs of memory will soon be garbage collected and returned to the O/S.)

The trick that I show in the code below---using ArrayTools:-Alias to create a direct memory link to the animation frame---can only work if the frames are displayed on the fly.

#Build unit sphere as static background for the animation. The back half is
#opaque, and the front half is wire mesh, so we can see inside.
Sphere:= plots:-display(
        1, [-Pi..0, 0..Pi], 0..Pi, coords= spherical, style=~ [patch, wireframe],
        lightmodel= light1, grid= [100$2], axes= normal, orientation= [60,80,10]
N:= 5000: #number of points and animation frames
#Construct matrix each column of which is a random point on unit sphere:
Pts:= rtable(1..3, 1..N, frandom(-1..1), datatype= hfloat, subtype= Matrix):
Pts[3]:= csgn~(Pts[3])*~(1 -~ Pts[1]^~2 -~ Pts[2]^~2)^~(1/2):
Z:= Vector(3, 0, datatype= hfloat): #the origin
Frame:= plots:-display( #Construct one animation frame 
    Sphere, plots:-pointplot3d(<Z | Pts[.., 1]>, style= pointline, color= red)
#Create a direct memory link to the 2x3 matrix inside the pointplot3d structure.
#Thus, we can change the frame simply by changing the matrix.
A:= ArrayTools:-Alias(indets(Frame, Matrix)[]):
#Procedure that changes the frame:
P:= k-> 
    if k::posint then :-A[2]:= :-Pts[..,k]^+; :-Frame
    else 'procname'(k)
    P(k), parameters= [[k= 1..N, shown= false, animate]], autorun, numframes= N,
    initialvalues= [k= 1]

One frame: