Robert Israel

6582 Reputation

21 Badges

19 years, 50 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

1000. and 1e+4 are floats, 1000 is an integer.  These are two of the basic data types in Maple (and, with some variations, in most other computer languages). 

Here's an "exact" (and much faster) way to do the cone projection.

ConeProj2:= proc(r,h,A,B,C)
 uses LinearAlgebra;
 local V,P,M,d;
 V:= evalf(GramSchmidt([<A,B,C>,<1,0,0>,<0,1,0>,<0,0,1>], conjugate=false,normalized=true));
 P:= Matrix(<V[2]^%T,V[3]^%T>);
 M:= r * P[1..2,1..2];
 d:= Norm(M^(-1).P.<0,0,h>,2);
 if d <= 1 then evalf(Pi*abs(Determinant(M)))
 else evalf((sqrt(d^2-1) + Pi - arcsin(sqrt(d^2-1)/d))*abs(Determinant(M)));
 end if
end proc;

Here's an "exact" (and much faster) way to do the cone projection.

ConeProj2:= proc(r,h,A,B,C)
 uses LinearAlgebra;
 local V,P,M,d;
 V:= evalf(GramSchmidt([<A,B,C>,<1,0,0>,<0,1,0>,<0,0,1>], conjugate=false,normalized=true));
 P:= Matrix(<V[2]^%T,V[3]^%T>);
 M:= r * P[1..2,1..2];
 d:= Norm(M^(-1).P.<0,0,h>,2);
 if d <= 1 then evalf(Pi*abs(Determinant(M)))
 else evalf((sqrt(d^2-1) + Pi - arcsin(sqrt(d^2-1)/d))*abs(Determinant(M)));
 end if
end proc;

@hirnyk : Ah, it seems to need another evalf.

ConeProj:= proc(r,h,A,B,C)
    uses LinearAlgebra;
    local V,verts;
    V:= evalf(GramSchmidt([<A,B,C>,<1,0,0>,<0,1,0>,<0,0,1>], conjugate=false,normalized=true));
    verts:= map(v -> [DotProduct(v,V[2],conjugate=false),
                               DotProduct(v,V[3],conjugate=false)],
       evalf([<0,0,h>,seq(<r*cos(2*Pi*t),r*sin(2*Pi*t),0>,t=0 .. 0.999,.001)]));
    simplex[convexhull](verts, output=area);
  end proc;

@hirnyk : Ah, it seems to need another evalf.

ConeProj:= proc(r,h,A,B,C)
    uses LinearAlgebra;
    local V,verts;
    V:= evalf(GramSchmidt([<A,B,C>,<1,0,0>,<0,1,0>,<0,0,1>], conjugate=false,normalized=true));
    verts:= map(v -> [DotProduct(v,V[2],conjugate=false),
                               DotProduct(v,V[3],conjugate=false)],
       evalf([<0,0,h>,seq(<r*cos(2*Pi*t),r*sin(2*Pi*t),0>,t=0 .. 0.999,.001)]));
    simplex[convexhull](verts, output=area);
  end proc;

It's really hard to guess what's going wrong without seeing your equations and the command you're using.  Please post them (or upload a worksheet).

@tatan2501 :
<http://books.google.ca/books?id=BsSwAAAAIAAJ>

@tatan2501 :
<http://books.google.ca/books?id=BsSwAAAAIAAJ>

@Christopher2222 : unfortunately I didn't keep the code for many of those animations; those I do have are not pretty, as they were just intended as "one-off" jobs for my own use only.  Here's a worksheet for one of the "predator-prey" animations.

ppreyn.mws

Oh, and how could I leave out the all-time classic? W. Feller, "An Introduction to Probability Theory and Its Applications", volumes I and II.

Oh, and how could I leave out the all-time classic? W. Feller, "An Introduction to Probability Theory and Its Applications", volumes I and II.

@tatan2501 : Yes, they were made with Maple (in Maple versions going back as far as Maple V Release 3).   In some cases I think I may have made individual .gif files with Maple and put them together into an animation using ImageMagick.

You really need some context to make sense of typical Maple mathematical animations.  FWIW, here's an old web page of mine on the Double Pendulum, including two animations made with Maple.

<http://www.math.ubc.ca/~israel/m215/doublpen/doublpen.html>

And, from the same course, some more pages with Maple animations,

The Snowplow Problem: <http://www.math.ubc.ca/~israel/m215/plows/plows.html>

Forced Vibrations: <http://www.math.ubc.ca/~israel/m215/forced/forced.html>

Phase Portraits of Linear Systems: <http://www.math.ubc.ca/~israel/m215/linphase/linphase.html>

Predator and Prey: <http://www.math.ubc.ca/~israel/m215/predprey/predprey.html>

See the help page ?Optimization,General,Methods.

If the method option is not provided, the method is chosen by NLPSolve according to the following rules.  If the optimization problem is univariate and unconstrained except for finite bounds, quadratic interpolation is used.  If the problem is unconstrained and the gradient of the objective function is available, the PCG method is used.  Otherwise, the SQP method is used.

See the help page ?Optimization,General,Methods.

If the method option is not provided, the method is chosen by NLPSolve according to the following rules.  If the optimization problem is univariate and unconstrained except for finite bounds, quadratic interpolation is used.  If the problem is unconstrained and the gradient of the objective function is available, the PCG method is used.  Otherwise, the SQP method is used.

First 16 17 18 19 20 21 22 Last Page 18 of 187