Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

20 years, 312 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at Maplesoft.com

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,

plot3d([r*cos(t), r*sin(t), t], t = -4*Pi .. 4*Pi, r = 0 .. 1,
    numpoints = 6000, shading = zhue, style = patchnogrid);

By the way, just looked at the definition of helicoid in the Dictionary in Maple help:

helicoid,
n. any solid or surface shaped like a screw thread.

Brilliant!

Alec

 

That depends on the point of view what a path (or a route) is. Considering a path (or a route) from the end to the beginning being the same as the path (or a route) from the beginning to the end, the number of paths (or routes) would decrease twice.

Also, the original question may be understood as the problem of finding all connected subgraphs of the given type (with one vertex of type a, one vertex of type b, one vertex of type c, and one vertex of type d) - in this case, the "brute forse" approach could use IsConnected (and don't use permute).

For such small problems "brute forse" approach works well (and easy to write). If actual problem is much larger, then certainly, a more intelligent algorithm should be used (and, perhaps, a more intellegent CAS, too.)

Alec

For example,

edges:={seq({a2,b||j},j=1..4),seq({a2,c||m},m=1..4),
    seq({a3,d||n},n=1..4),seq({b3,c||m},m=1..4),
    seq({b3,d||n},n=1..4),seq({b4,a||i},i=1..4),
    seq({c1,b||j},j=1..4),seq({c4,a||i},i=1..4),
    seq({c4,d||n},n=1..4),seq({d1,a||i},i=1..4),
    seq({d1,b||j},j=1..4),seq({d2,c||m},m=1..4)}:
a,b,c,d:=[a1,a2,a3,a4],[b1,b2,b3,b4],
    [c1,c2,c3,c4],[d1,d2,d3,d4]:
for L in combinat[permute]([a,b,c,d]) do 
    T:=combinat[cartprod](L):
    while not T[finished] do path:=T[nextvalue](): 
        if {path[1],path[2]} in edges and 
           {path[2],path[3]} in edges and 
           {path[3],path[4]} in edges then 
        P[path]:=path fi od od:
p:=convert(P,list);

Alec

There are 2 problems here - automatic simplification, and evaluation.

The first one can be prevented using a module,

NoSimplification:=module() export `+`,`-`,`*`,`/`,`^`;
option package;
`+`:=()->:-`+`(args); `-`:=()->:-`-`(args); `*`:=()-:-`*`(args); 
`/`:=()->:-`/`(args); `^`:=()->:-`^`(args)
end:

with(NoSimplification):
'2*(2+x)';

                            *(2, +(2, x))

evalb('2*(2+x)' = '4+2*x');

                                false

Automatic simplification is prevented, but the expressions still have to be quoted to prevent their evaluation.

Alec

The closest, probably, is to copy 4 spaces and then paste them using Ctrl+V.

Tab is used for going to the next input line, so it, probably, won't be changed - for backward compatibility.

_______________
Alec Mihailovs
Maplesoft Member

The form of the answer in this case depends not on k, but on phi.

int(1/sqrt(1-k^2*sin(s)^2), s = 0 .. phi) assuming phi > 0, phi < Pi/2;

                           2 1/2
              (1 - sin(phi) )    EllipticF(sin(phi), k)
              -----------------------------------------
                              cos(phi)
simplify(%,symbolic);
                        EllipticF(sin(phi), k)

You can see other possible answers using

int(1/sqrt(1-k^2*sin(s)^2), s = 0 .. phi, AllSolutions);

I should also add that the followings warnings look dirty,

int(1/sqrt(1-k^2*sin(s)^2), s = 0 .. phi);

Warning, unable to determine if -1/2*Pi+2*Pi*_Z3 is 
between 0 and phi; try to use assumptions or set 
_EnvAllSolutions to true

Warning, unable to determine if 1/2*Pi+2*Pi*_Z4 is 
between 0 and phi; try to use assumptions or set 
_EnvAllSolutions to true

Warning, unable to determine if 1/2*Pi+Pi*_Z5 is 
between 0 and phi; try to use assumptions or set 
_EnvAllSolutions to true

_______________
Alec Mihailovs
Maplesoft Member

with(MmaTranslator):
MmaToMaple();

It doesn't do a very good job in this example, but you might try it on the .nb file.

Alec

It is described in

?worksheet,reference,initialization

Alec

Is there a multiplication (or other) sign in front of the last diff?

Alec

In some simple examples that I tested, the following works,

RealRanges:=module() export `union`, `intersect`, `subset`;
local c,u,x; option package;
c:=e->eval(
evalindets(e,'RealRange',z->convert(x::z,'relation')),[:-`union`='Or',:-`intersect`='And']);
u:=proc() :-`union`(select(type,[args],'RealRange')[],map(`{}`,remove(type,[args],'RealRange'))[]) end;
`union`:=proc() u(solve(simplify(piecewise(c(:-`union`(args)),1,0))=1)) end;
`intersect`:=proc() u(solve(simplify(piecewise(c(:-`intersect`(args)),1,0))=1)) end;
`subset`:=proc(a,b) if is((a intersect b)=a) then true else false fi end
end; 

For example,

with(RealRanges):
RealRange(2,5) union RealRange(3,6);

                           RealRange(2, 6)

That still needs to be improved, because now operations don't work normally with usual Maple sets :) There are some problems with RealRanges as well. I'll work on it more tomorrow.

Alec

What's so hard in doing what I suggested?

a:=A/tau;
e:=Eigenvectors(a);
E:=simplify([map(evalc,e[1])*tau,map(evalc,e[2])])[];
Ef:=evalf([E])[];

Or, if you need only floating point answers,

a:=Matrix(evalf[14](A/tau), datatype=float[8]);
e:=simplify([Eigenvectors(a)],zero)[];
E:=e[1]*tau,e[2];

Alec

In your example, A is homogeneous with respect to tau, so either divide it by tau, or substitute tau=1, then the eigenvectors will be the same, and eigenvalues of the original matrix can be obtained by multiplication by tau.

To get the real solutions of cubic equations, one can use evalc.

Alec

I think, that was answered many times. That depends on what you need and what you like. Time measurments in Matlab and Mathematica, taken at different times, are also different (as well as in any other programming system that I know.)

Alec

In general, I think that even the idea of 2D input is wrong. A normal process is 1D input - 2D output.

Alec

Not exactly that, but the answer can be found as

simplify(piecewise(Or(And(2 <= x,x <= 5),And(3 <= x,x <= 6)),1,0));

                          { 0        x < 2
                          {
                          { 1        x <= 6
                          {
                          { 0        6 < x

Alec

First 56 57 58 59 60 61 62 Last Page 58 of 76