Alec Mihailovs

Dr. Aleksandrs Mihailovs

4475 Reputation

21 Badges

20 years, 39 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

Without ICs, Maple produces the following,

ans := pdsolve([PDE,BCs],u(x,t));

                                      2     Pi x
                                     l  sin(----)
                                             l
                    ans := u(x, t) = ------------
                                           2
                                         Pi

and this doesn't satisfy the ICs. Perhaps, that explains the warning.

Alec

In addition to Christopher2222's suggestion, partial sums can be plotted as in the following example for B, using ListTools:-PartialSums.

b:=[seq((-1)^n*(3*n^2+7*n-1)/(3*n^5+4*n+1),n=1..50)]:
plot([$1..50],ListTools:-PartialSums(b));

135_b.png

Alec

Still, I don't understand the question. They are not functions - they are series. What do you want to plot?

B converges, and the sum can be calculated similarly to A. The sum is just a number, not a function.

C diverges, and D diverges almost for all values of \phi, with the exception of \phi=0 and \phi=(2*k-1)*Pi with integer k.

Alec

map2(map,parse,a);

                [[14, 34, 12.1, 4.5], [2, 4, 6, 1.5]]

You have a typo in a - it should be "12.1".

Another way of doing that is

evalindets(a,string,parse);

                [[14, 34, 12.1, 4.5], [2, 4, 6, 1.5]]

Alec

As it was mentioned there, you didn't submit 10 functions - you submitted 8 sums and 2 integrals with unknown integration variable and unknown limits. 

Some of the sums converge, others - don't, and it is not clear what you want to plot. Perhaps, partial sums, but maybe not.

It would be helpful if you submitted the original questions as they were formulated in your take-home test, or whatever they came from.

Alec

Yes, it's hard to believe that such small timings, with 10-19, 10-16, and even 10-8 in Mathematica are real. Anyway, it seems as if the Partition doesn't change the array itself, but instead just changes its dimensions - something like ArrayTools:-Alias in Maple.

The translated to Maple Partition procedure also looks "translated" from some other language, with stacks instead of lists - in which case, in the original language, pop-pop from a stack works very fast and doesn't increase memory - Maple lists don't work like that, as we know.

Alec

The original question also could be done as

MmaTranslator:-Mma:-Partition(a,2);

but

showstat(MmaTranslator:-Mma:-Partition);

looks quite inefficient compare to other examples in this thread.

a:=[$1..100000]:
time([seq([a[i],a[i+1]], i=1..nops(a)-1, 2)]);

                                0.046

time([ListTools:-LengthSplit(a,2)]);

                                0.078

time(MmaTranslator:-Mma:-Partition(a,2));

                               120.869

Not even talking about memory...

In Mathematica, it works much faster,

In[1]:= a = Range[100000];
In[2]:= Timing[Partition[a, 2];]

Out[2]= {3.25261*10-19, Null}

Alec

For the RGB color, you need a list with 3 expressions (or 3 procedures if the function is given in the procedural form). In particular, the following should work,

plot3d(0, x = 0 .. 1, y = 0 .. 1, 
color = [farbe3(x, y)[1], farbe3(x, y)[2], farbe3(x, y)[3]]);

While farbe3(x,y) produces a list with 3 elements, it is just one expression itself, and not a list of 3 expressions.

By the way, this particular plot could be done as

plot3d(0, x = 0 .. 1, y = 0 .. 1, 
color=[x<0.5,0,0], Optionen);

Alec

Times and heights could be added as the third and the 4th coordinate to the points - something like

with(Statistics); 
X := RandomVariable(Triangular(-1, 1, 0)); 
f := p-> p[3]*PDF(X, t-p(4))*PDF(X, (x-p[1])^2+(y-p[2])^2); 
L := {seq(Vector(4, RandomTools:-Generate(integer(range = 0 .. 10), 
    makeproc = true)), i = 1 .. 100)};
plots:-animate(plot3d, [max(f~(L)), x = -1 .. 11, y = -1 .. 11, 
    view = 0 .. 100, style = patchnogrid, shading = zhue], 
    t = -1 .. 11, title = "");

Alec

If you need just a nice picture, and not necessary in Maple, such things could be done quite easily using SVG and JavaScript, as there, for example.

Alec

Also, pointplot3d can be used - something like

with(plots);
display(seq(pointplot3d({[1, 1, 1], [3, 3, 3]}, 
symbol = solidsphere, symbolsize = 401-trunc(400*(t-1)^2), 
shading = z, lightmodel = light4), t = 0 .. 2, 0.05), 
insequence = true);

Alec

Robert Israel's suggestion works faster,

S1,S2:=1,FAIL;

time(seq(min(select(type, [S1,S2], numeric)),i=1..1000000));

                                2.433

time(seq(min(remove(`=`, [S1,S2], FAIL)),i=1..1000000));

                                3.432

Alec

Using Triangular Distribution and the plot setup similar to Robert Israel's example, that could be done as

with(Statistics); 
X := RandomVariable(Triangular(-1, 1, 0)); 
f := p-> PDF(X, t)*PDF(X, (x-p[1])^2+(y-p[2])^2); 
L := {[1, 2], [3, 3], [4, 1]}; 
plots:-animate(plot3d, [f~(L), x = -4..8, y = -4 .. 8, 
    view = 0..5, style = patchnogrid, shading = zhue], 
    t = -1..1, title = "")

135_bubbles.gif

Or something like convert(f~(L), `+`) or max(f~(L)) can be used instead of f~(L) in the plotting command.

Alec

Looks more like professor chatter :)

Alec

It might be easier to help if you posted your equations. 

Alec

First 12 13 14 15 16 17 18 Last Page 14 of 76