Alec Mihailovs

Dr. Aleksandrs Mihailovs

4470 Reputation

21 Badges

19 years, 294 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at

Maple Application Center

I received my Ph.D. from the University of Pennsylvania in 1998 and I have been teaching since then at SUNY Oneonta for 1 year, at Shepherd University for 5 years, at Tennessee Tech for 2 years, at Lane College for 1 year, and this year I taught at the University of Massachusetts Lowell. My research interests include Representation Theory and Combinatorics.

MaplePrimes Activity

These are answers submitted by Alec Mihailovs

For example, you can write q instead of q(t), f:= q*sin(q); f := q sin(q) diff(f,q); sin(q) + q cos(q)
L:=[[3,2,5],[2,34,6]]: nops(L); 2
The values of the coloring function are scaled so that the minimum value gets HUE(0) color and the maximium value gets HUE(1) color, with other values between them. One can also use a list with 3 procedures, in which case RGB color is used for correspondingly scaled values. See examples in ?colorfunc help page. This rule has an exception - if values of the coloring function are between 0 and 1, they are not scaled. In your example, pictures with coloring functions x/20 and x/40 are different. For Mandelbrot set, see John Oprea's worksheet. Also, that can be done using densityplot command. In the example below I use mandelbrot from the cited above John Oprea's worksheet,
mandelbrot := proc(x, y) 
local c, z, m; 
c := evalf(x+y*I); z := c; 
for m to 50 while abs(z) < 2 do z := z^2+c od; 
m end;

plots[densityplot](mandelbrot,-2 .. 0.7, -1.35 .. 1.35,
One needs to replace s_tyle with style to make this working (there is a problem with using 'style' inside <pre>.) Changing 50 in the mandelbrot procedure to 30, 40, or other number, produces slightly different pictures. The picture also looks interesting in RGB,
plots[densityplot](mandelbrot,-2 .. 0.7, -1.35 .. 1.35,
For example, L:=[[1,2,3],[0,4,5],[3,8,1],[0,-1,2]]: select(x->x[1]=0,L); [[0, 4, 5], [0, -1, 2]]
Lagrange equations can be constructed using VariationalCalculus[EulerLagrange] command, see its help page for details. As far as I recall, Variational Calculus package was added in Maple 8.
Evalb doesn't test identities. You should use either is, or testeq instead, is(exp(I*x)=cos(x)+I*sin(x)); true testeq(exp(I*x)=cos(x)+I*sin(x)); true
I just tried to save B2 in a library in Maple 10 and it was saved in the original form, as well as included in a module, and worked after restarting without problems, either with specifying option package, or without. I didn't try that in Maple 8 or 9 (because I don't have them on this computer). I also didn't try an external procedure with 'MAPLE' parameter. Perhaps, that matters, too. The exports are protected if option package is specified.
You missed an assignment sign in splcurve. It should be splcurve:=Spline(points1,v): The problem with file attaching at this site is well known, I think.
Also, it can be done by adding known=k[1] in the dsolve command, i.e. changing the definition of sol2 in the original post to
numeric, output=listprocedure,known=k[1]):
One more workaround is in replacing k[1](t-1) in the same line with 'apply'(k[1],t-1), i.e. define sol2 as
numeric, output=listprocedure);
Here is a workaround,

numeric, output=listprocedure):




numeric, output=listprocedure):


See ?reduceOrder and ?reduce_order help pages.
evalhf doesn't support special functions. For example,
Error, remember tables are not supported in evalhf
?evalhf/fcnlist has the list of functions supported by evalhf.
For example, let  xa=1, y1=y(1), f(y(x),y1,x)=y(x)*y1*x, g(y0,y1)=sin(y0)*y1+y0*exp(y1)-2. Then the solution can be obtained as follows,
s := y(x) = y1/exp(1/2*y1)*exp(1/2*y1*x^2)
y0 := y1/exp(1/2*y1)
sol := y(x) = .5848618254*exp(.4660373602*x^2)
It is really easier to do such things in 1D mode. Many multiplication signs are missing. It is not exactly clear what you are trying to achieve. If you are trying to solve a differential equation, then dsolve should be used. Anyway, here is the simplification in 1D-mode. with(LinearAlgebra): T:=<||>; [ sin(l a) cos(l a) F exp(k a I) ] T := [ ] [l cos(l a) -l sin(l a) k F exp(k a I) I] LinearSolve(T); [F exp(k a I) (cos(l a) k I + l sin(l a))] [----------------------------------------] [ 2 2 ] [ l (cos(l a) + sin(l a) ) ] [ ] [F exp(k a I) (l cos(l a) - k sin(l a) I)] [----------------------------------------] [ 2 2 ] [ l (cos(l a) + sin(l a) ) ] simplify(%); [F exp(k a I) (cos(l a) k I + l sin(l a))] [----------------------------------------] [ l ] [ ] [F exp(k a I) (l cos(l a) - k sin(l a) I)] [----------------------------------------] [ l ] My guess is that it is not what you wanted.
Here is the simplest program,
It is not Eratosthenes Sieve though. The program ES below implements the Eratosthenes Sieve,
s := proc(n::integer[4], A::Array(datatype = integer[4]),
B::Array(datatype = integer[4]))::integer[4];
local k, j;
    for k from 2 to isqrt(n) do
        if A[k] = 0 then
            for j from k to iquo(n, k) do A[k*j] := 1 end do
        end if
    end do;
    j := 1;
    for k from 2 to n do
        if A[k] = 0 then B[j] := k; j := j + 1 end if
    end do
end proc:

cs := Compiler:-Compile(s):

ES := proc(n)
local A, B;
    A := Array(1 .. n, datatype = integer[4]);
    B := Array(1 .. numtheory:-pi(n), datatype = integer[4]);
    cs(n, A, B);
end proc:
ES is much faster than f. For example,
The prime numbers produced by both procedures, are the same,

First 72 73 74 75 76 Page 74 of 76