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

To plot that, I found so called first integral, i.e. such function F(x,y) that the curves in the phase portrait can be written as F(x,y)=C with constant C (that varies for different curves). I did it by finding solution of the equation dy/dx = (dy/dt) / (dx/dt) in form y=f(x,C) and then finding C from there as C=F(x,y). That could be done also in more traditional form.

After differentiating F(x,y) = C over t we get (using chain rule) partial differential equation

dF/dx * dx/dt + dF/dy * dy/dt =0,

and it can be solved in Maple in one step,

pde:=diff(F(x,y),x)*(x+y)+diff(F(x,y),y)*(4*x+y):
pdsolve(pde);

                                         1
                 F(x, y) = _F1(---------------------)
                                         3
                               (-y + 2 x)  (y + 2 x)

Now, _F1 is any function and the most appropriate choice seems to be F(x,y) = (2x-y)^3 (2x+y).

That means that the phase curves are given by equations (2x-y)^3(2x+y) = C which can be plotted in 3d with coordinates x,y,C.

 Alec

It should be built with correct switches for using 100% of both cores. If it is not, the scheduler just distributes one processor job between 2 processors - they don't work both simultaneously for Maple.

That's another advantage of open source systems - when you build such a system yourself, you can correctly set the configuration for your system, whether it is a dual core or a quad core etc.

Alec

sol:=dsolve(diff(y(x),x)=(4*x+y(x))/(x+y(x)));
solve(sol,_C1);
                                  1
                      --------------------------
                                  3
                      (y(x) - 2 x)  (y(x) + 2 x)

plot3d((y-2*x)^3*(y+2*x),x=-5..5,y=-5..5);

Alec

AFAICT, there are no such limitations, and it can't be set using kernelopts.

You might try to set it to High priority in Task Manager - click Ctrl+Alt+Delete, that starts Task Manager. Under Processes, click right button on mserver.exe, then Set Priority and select High.

Alec

I couldn't find anything looking especially nice in 3d, but you could play with following,

sys:={diff(x(t),t)=x(t)+y(t),diff(y(t),t)=4*x(t)+y(t),x(0)=x0,y(0)=y0}:
sol:=dsolve(sys);
assign(sol);
X,Y:=map(unapply,[x(t),y(t)],[x0,y0])[];
plot3d([X(x0,2*x0),Y(x0,2*x0),t],t=-0.5..0.5,x0=-5..5, 
       axes=boxed,labels=[x,y,t],orientation=[-30,60]);
with(plots):
animate(plot3d,[[X(x0,c*x0),Y(x0,c*x0),t],t=-0.3..0.3,x0=-5..5, 
       axes=boxed,labels=[x,y,t],orientation=[-45,45]],c=-10..20);

The last plot is an animation, so to see it, one should first click on it and then push the "play" button at the top of the window.

Alec

Solutions, whether for differential equation system, or for difference equation system, can be easily found if you give also some initial values, such as x(0) and y(0). And then they can be plotted. Usually it is done in 2D with coordinates x and y, but it can be, certainly, done in 3D with coordinates t, x, y.

See examples in ?DEplot and ?DEplot3d

At the end of ?dsolve is an example of solving a system of differential equations.

Alec

So you have not differential equations, but difference equations and use notation

f'(t) = f(t) - f(t-1) ?

Alec

Some problems seem to be caused by evaluating types, such as

'Matrix'(storage=rectangular,datatype=float[8],order=Fortran_order)

as actual Matrices and not types. 

That seems to be a design flaw.

In general, it seems as if using strings for types instead of symbols would simplify coding in many situations.

That, probably, can't be changed now because of the backward compatibility issues, but still...

Alec

A random sample of length n drawn from Bernoulli distribution with probability of success prob, that has a correlation c with itself shifted back lag steps, can be generated using following procedure,

SampleWithCorr:=proc(prob::And(numeric,satisfies(c->c>=0 and c<=1)),
lag::posint,c::And(numeric,satisfies(c->c<=1 and c>=-1)),n::posint)
local X,B,S,C,s,i;
uses Statistics;
X:=RandomVariable(Bernoulli(prob));
S:=Sample(X,n);
if n<=lag or s=0 then S else
s:=signum(c);
B:=RandomVariable(Bernoulli(abs(c)));
C:=Sample(B,n-lag);
if s=1 then 
for i from lag+1 to n do
if C[i-lag]=1 then S[i]:=S[i-lag] fi od;
else for i from lag+1 to n do
if C[i-lag]=1 then S[i]:=1-S[i-lag] fi od
fi fi; S end:

For example,

S:=SampleWithCorr(1/2,1,-0.7,10000);

                       [ 10000 Element Row Vector ]
                  S := [ Data Type: float[8]      ]
                       [ Storage: rectangular     ]
                       [ Order: Fortran_order     ]

Statistics:-Correlation(S[1..9999],S[2..10000]);

                            -.6973705688

I've made it into a blog entry.

Alec

For example,

randomize():
coin:=rand(0..1):
c10:=rand(1..10):
x1:=['coin()'$10];

                 x1 := [1, 1, 1, 0, 1, 0, 0, 0, 1, 1]

x2:=['c10()'$10];

                x2 := [3, 10, 4, 9, 6, 6, 1, 1, 5, 3]

x3:=[seq](`if`(x2[i]<7,coin(),x1[i]),i=1..10);

                 x3 := [0, 1, 1, 0, 0, 1, 0, 0, 1, 0]

Alec

AFAICT, there are no tools in Maple for simulating time series with given autocorrelation. You have to enter formulas yourself. Choosing any specific distribution won't help - they don't depend on previous results.

Alec

 

1. The problem with gy is not that it is complicated, but because it contains undefined variable h. If you assigned h to something, there won't be a problem with it.

2. Tx1 and Ty1 can be defined as unapply(gx, x1) and unapply(gy, y1). You don't have to type them manually.

3. For exporting to Excel, instead of for cycle, you can put your data into a Matrix (see an example at the end of that thread), and then either move your mouse over the Matrix, click right button, select Export As and then Tab Delimited, or use ExportMatrix command, see ?ExportMatrix help page.

Alec

Here is a definition of a permutation from Wikipedia,

In combinatorics, a permutation is usually understood to be a sequence containing each element from a finite set once, and only once.

Considering a permutation in Maple being a list containing such a sequence of set elements, it seems to be correct using term "permutation of a set" even in Maple.

Alec

This, by the way, was one of such questions that could be easily answered just by doing a Google search. I just searched it for "next permutation in Maple" (without quotes) and get about 113,000 results. For instance, from

Google Code Search produces about 56,300 results.

Besides. the help page ?nextstruct has an example of doing that using combstruct package.

Alec

Thus far, one thing that I can say, is that it works with anything instead of [anything].

Alec

First 59 60 61 62 63 64 65 Last Page 61 of 76