## 19 Badges

10 years, 326 days

## CPU time...

With the code written as above (and default settings), you'll get a whole bunch of "x:= ..." output filling up the worksheet.  To avoid that, use colon ":" instead of semicolon ";" after the "end do".  All those nuisance outputs can also impact measured timing.

Even with ":", your results will still vary slightly.  One reason is garbage collection, which takes place at unpredictable times. The more junk there already is in memory, the more often this will be needed.  On the other hand, some functions place values in remember tables, and this can reduce computation time the second time around.

Finally, typical modern computers are multi-tasking with lots of other things going on in the background, and this can have its effects on timing.

## Primed...

Or this:

`PDEtools:-declare(y(t), prime=t);`

y(t) will now be displayed as y
derivatives with respect to t of functions of one variable will  now be displayed with '

`di;`

y'' - 4 y' + 5 y = et

## sinc...

The mathematical definition of sinc(x) is:

piecewise(x=0, 1, sin(x)/x)

The Sinc function in DynamicSystems is set up rather strangely (for someone used to ordinary Maple functions).  To get the value of sinc(0), you can use

Sinc(discrete=true,samplecount=1);

[ 1. ]

## Another approximation...

A really good approximation to the integrand ifor s >= 0 s obtained by using the Maclaurin series

Thus your integral becomes

where each term can be evaluated explicitly.  Thus using terms up to k = 20:

F20:= add((-1)^k/(k+1)*int(exp(-(k+2)*s)*s^(k+1),s=0..t), k=0..20):

which will have error less than

for all t > 0.

## sum...

This is a "feature", not a bug.  See the help page ?sum,details.

If m > n+1 are integers, the value returned is -sum(f, k=n+1..m-1). With these conventions, the following holds for all integers l,m,n.

## dsolve...

It's hard to tell without looking at your actual equation, but if h is a function of one variable and only evaluated at y^2 - k^2*x^2, you are likely to have an ordinary differential equation if you have anything at all.  Suppose your  equation is of the form
A(k,x,y)*D(h)(y^2 - k^2*x^2) + B(k,x,y)*h(y^2-k^2*x^2) + C(k,x,y) = 0.  Let t = y^2 - k^2*x^2.  In the region where y > 0, say,  we can express y in terms of t and get

a(k,x,t)*D(h)(t) + b(k,x,t)*h(t) + c(k,x,t) = 0

Fixing k and x, this is an ordinary differential equation in h(t), and can be solved by dsolve.  However, since you want h to be a function of t alone, the solution must be independent of the other variables k and x.  That may or may not be true: if there is no solution that is independent of k and x, your equation can't be solved.

## Sound...

There's nothing in Maple's GUI that can produce a sound, but an external program can be launched to do it.  See http://www.mapleprimes.com/questions/125062-Play-Audio-File-From-Maple

## Symbolic solution in general...

Your system corresponds to a 4 x 4 homogeneous linear first-order system X' = A X, X(0) = X0, where A is a matrix of constants.  When (as is generically the case) A has distinct eigenvalues r1,...,r4, the solution  can be written as

where vj is the eigenvector corresponding to eigenvalue rj, and cj = wj X0 where wj is a left eigenvector for rj, normalized so wj vj = 1.

Now unfortunately the "closed form" solution in radicals of a quartic polynomial is a very complicated thing, and that's where dsolve runs into time and memory problems.  If it would
use RootOf here, a manageable solution could be found.

`> ode := m[r]*(diff(x[r](t), `\$`(t, 2)))+c[r]*(diff(x[r](t), t)-(diff(x[g](t), t)))+k[r]*(x[r](t)-x[g](t)) = 0, m[g]*(diff(x[g](t), `\$`(t, 2)))+c[g]*(diff(x[g](t), t))+c[r]*(diff(x[r](t), t)-(diff(x[g](t), t)))+k[g]*x[g](t)+k[r]*(x[r](t)-x[g](t)) = 0; subs(diff(x[g](t),t)=v[g](t),diff(x[r](t),t)=v[r](t),{ode}); solve(%,[diff(v[g](t),t),diff(v[r](t),t)]); sys:= [op(op(%)),diff(x[g](t),t)=v[g](t),diff(x[r](t),t)=v[r](t)];`

`> X0:= <1,1,0,0>;   with(LinearAlgebra):   A:= GenerateMatrix(map(rhs,sys),[v[g](t),v[r](t),x[g](t),x[r](t)])[1]; `

`> P := CharacteristicPolynomial(A,lambda);`

`> B:= A - lambda*IdentityMatrix(4);   V:= op(NullSpace(B[2..4,1..4]));`

`> W:= op(NullSpace((B^%T)[2..4,1..4]))^%T;`

`> a:= W . X0 /(W . V);`

`> sol:= Sum(a*exp(-lambda*t)*V,lambda=RootOf(P,lambda));`

## Isolate...

You might try Isolate in the RootFinding package.

## New engine...

Make sure under Tools, Options, General that you have Mathematical Engine set to
"Create a new engine for each document".  Then it should be possible (under any version of Windows) to have two worksheets operating independently.

Ah: I think I see the problem.  Pressing the !!! button on one worksheet disables that button for the other worksheet.   I think that's a bug.  However, what you can do in the second worksheet is, in the Edit menu,  Select All, then Execute, Selection.

## PDE with boundary conditions...

pdsolve can sometimes find "symbolic" solutions for certain types of PDE's with boundary conditions, but it's rather hit-or-miss, and mostly miss.  In any case, boundary conditions involving a limit are certainly much too subtle for pdsolve.  You might try pdsolve without the boundary conditions at x=0 and x -> infinity to get ingredients for a separation-of-variables solution.

> pdsolve({diff(V(x,y),x\$2)+diff(V(x,y),y\$2)=0, V(x,0)=0,V(x,Pi)=0}, HINT=X(x)*Y(y));

Since you want the solution to go to 0 as x -> infinity, you'd want to take only exponentials of negative coefficients times x: in general

where the coefficients a[n] are found by expanding V(0,y) in a sine Fourier series.

In your case V(0,y) = sin(y), so you just need one term in this series:

## Gigapoints...

10 billion points?  Yes, that's rather a lot.  Somewhat better if you use combinations rather than permutations (assuming "649" is a reference to the 6/49 lottery, the order of selected numbers is immaterial).  So there are only binomial(49,6) = 13983816 choices.  Now

combinat:-choose(49,6)

produces an "object too large" error.  So we'll have to be cleverer.

`> with(ImageTools):     M:= 1000; N:= 1000;   # image width and height    R:= Create(M, N,1);     xmax:= binomial(49,6); ymax:= 444546474849;    x:= 1;    for a from 1 to 44 do       for b from a+1 to 45 do          for c from b+1 to 46 do             for d from c+1 to 47 do                for e from d+1 to 48 do                   for f from e+1 to 49 do                     y:= parse(cat(a,b,c,d,e,f));                     i:= round(1 + (x-1)/(xmax-1)*(M-1));                     j:= round(1 + (y-1)/(ymax-1)*(N-1));                     R[i,j]:= 1;                     x:=x+1od od od od od od:Write("649.jpg",R);`

## bug...

Yes, it's a bug, probably related to difficulties solve has with trig functions.  The simplest thing to do is to express the CDF for Y "by hand" using the CDF for X:

`> CDFY:= unapply( CDF(X,arctan(t)),t);`

and then differentiate that to get the PDF.

`> PDFY:= D(CDFY);`

## casesplit...

The functionality you're looking for is provided by casesplit in the PDEtools package.

For example,

`> PDEtools[casesplit]([ diff(a(x)^2*b(x), x) = a(x)^2, diff(a(x)*b(x),x) = b(x)], [a(x), b(x)]);`

It would have been better if you could have uploaded a Maple worksheet, so I could have tried this with your equations, rather than a .doc file.  I really don't feel like trying to input your complicated formulas into Maple by hand.

## sphere...

implicitplot3d is a very resource-intensive way to plot a sphere.  You might use sphere in the plottools package.  So e.g. something like:

> with(plots): with(plottools):
f:= t -> display(sphere([0,0,0],0.5, grid=[15,10]),
seq(sphere([i*cos(t/i),i*sin(t/i),0],0.3, grid=[10,6]),i=1..9));
animate(f,[t],t=0..20, scaling=constrained);

 1 2 3 4 5 6 7 Last Page 1 of 138
﻿