Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

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

Another example,

is(x->sin(x),continuous);
                                false

Alec

You might try to either replace Maple's jre with the recent one from Sun, or, if you have 2 GB or more memory, add something like maxheap=700m to the launch.ini file in the bin.win folder in Maple installation folder.

Alec

From my experience, Maple is good for short procedures. If one feels a need for larger procedures, it is, probably, better to use another interpreter, such as Python, for instance, which has many good editors and extensive libraries for, practically, everything. Plus much wider community wishing to help.

Alec

The properties were added at some time of Maple development, but their integration with other Maple parts is still only partial. In particular, AFAICT such things as continuous, or monotonic, are not used by simplify (or other procedures).

Alec

plottools:-transform can be used.

In this example,

plot(1+x*(2*x^2 +3) ^ (1/2),x=-2..2);

plottools:-transform((x,y)->[x^2, ((y-1)/x)^2])(%);

Alec

PS Sorry, Georgios, but that parametric plot only looks like a straight line, but it is not a straight line - try it, for example, for x=0..0.5 -Alec

For example,

z:=x+I*y:
plots:-implicitplot(abs(z-1)/abs(z+1) < 2, 
    x=-3.3..0,y=-1.6..1.6,
    scaling=constrained,
    filledregions);

Alec

Also, one can click on A-bar symbol in the Accents palette and type x (and then right arrow).  

Alec

Axel,

I don't know the reference, but the following seems to be working for small n :

f:=(n,k)->if n>k or (n-k) mod 2 = 1 then 0 
elif n=0 and k=0 then 1 
else -(2*n+1)*k*pochhammer((k-n+2)/2,n-1)/8/pochhammer((k-n-1)/2,n+2) fi;

A:=convert(Array(0..10,0..10,f),Matrix);

This is for n=10. Check it,

c:=add((i+1)*x^i,i=0..10);
cheb:=OrthogonalSeries:-ChangeBasis(c,ChebyshevT(n,x));
v:= < seq(OrthogonalSeries:-Coefficients(cheb,i),i=0..10) >;
leg:=OrthogonalSeries:-ChangeBasis(c,LegendreP(n,x));
w:= < seq(OrthogonalSeries:-Coefficients(leg,i),i=0..10) > ;
A.v-w;

results in 0, as it should.

However, for larger n Maple expresses the value of f through Γ so it is better, probably, to replace pochhammer in f to mul to get rational numbers. I didn't test whether that is feasible for n=512.

Alec

You could just use LagrangeMultipliers command, removing solutions that are not real,

with(Student[MultivariateCalculus]):

remove(has,
    [LagrangeMultipliers(x^3+y^3+3*x*y,[x^2+y^2-6*x-6*y+9.],
    [x,y],output=detailed)],I);

  [[x = 0.8786796564, y = 0.8786796564, lambda[1] = -1.167261890,

         3    3
        x  + y  + 3 x y = 3.673052172], [x = 5.121320344,

        y = 5.121320344, lambda[1] = 22.16726189,

         3    3
        x  + y  + 3 x y = 347.3269480]]

Alec

That also depends on _EnvLegendreCut, see ?LegendreQ. For example,

_EnvLegendreCut := 1..infinity:
simplify(LegendreQ(1,x));

                1/2 x ln(1 + x) - 1/2 x ln(1 - x) - 1

That doesn't affect the conversion to hypergeom though,

convert(LegendreQ(1,x),hypergeom);

                                                 1
                     hypergeom([1, 3/2], [5/2], ----)
                                                  2
                                                 x
                 1/3 --------------------------------
                                     2
                                    x

Alec

Also, Statistics package can be used. For example,

Statistics:-DataSummary(A, output=[maximum,minimum]);

Alec

Using Statistics package,

with(Statistics):
R10:=RandomVariable(Binomial(10,0.5)):
R100:=RandomVariable(Binomial(100,0.5)):

ProbabilityFunction(R10,5);
                             0.2460937500

ProbabilityFunction(R100,50);

                            0.07958923735

CDF(R10,5.55)-CDF(R10,4.45);

                             0.2460937500

CDF(R100,55.5)-CDF(R100,44.5);

                             0.7287469918

Alec

That can be also simplified,

simplify(S1);
                          (1/100)  (1/100)
             LambertW(10 2        5        exp(10 - 5 t))

combine(%,power);
                               (1/100)
                 LambertW(10 10        exp(10 - 5 t))

Alec

Also, that can be done another way, either

F:=(x,k)->iquo(x,10^(k-1)) mod 10;

or

G:=(x,k)->irem(iquo(x,10^(k-1)),10);

Now, compare timings,

n:=1000000!: 
k:=length(n); 
                 k := 5565709 
time(f(n,k)); 
                   0.998 
time(F(n,k)); 
                   0.327 
time(G(n,k)); 
                   0.327 
n:=10000000!: 
k:=length(n); 
               k := 65657060 
time(f(n,k)); 
                  16.052 
time(F(n,k)); 
                  5.335 
time(G(n,k)); 
                  5.304

In both cases about 3 times faster.

Alec

Very nice procedure pprintf in Robert Israel's post..

It can be also easily adjusted to printing text in roman instead of italics, just by replacing mi with mtext.

Alec

First 46 47 48 49 50 51 52 Last Page 48 of 76