Alec Mihailovs

Dr. Aleksandrs Mihailovs

4415 Reputation

20 Badges

17 years, 32 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 replies submitted by Alec Mihailovs

Nice!

Here is what I got using RealDomain,

use RealDomain in simplify(z) end;

                              undefined

It works also without map,

simplify(simplify(evalc(z)),size);

               n / 1/2               n Pi             n Pi \
         -1/3 2  |3    (C1 - C2) sin(----) - 3 C1 cos(----)|
                 \                    3                3   /

Works also with the inner simplify replaced with expand,

simplify(expand(evalc(z)),size);

               n / 1/2               n Pi             n Pi \
         -1/3 2  |3    (C1 - C2) sin(----) - 3 C1 cos(----)|
                 \                    3                3   /

and without factoring out 2^n as

collect(expand(evalc(z)),sin,factor);

                n  1/2               n Pi        n     n Pi
          -1/3 2  3    (C1 - C2) sin(----) + C1 2  cos(----)
                                      3                 3

Alec

Nice!

Here is what I got using RealDomain,

use RealDomain in simplify(z) end;

                              undefined

It works also without map,

simplify(simplify(evalc(z)),size);

               n / 1/2               n Pi             n Pi \
         -1/3 2  |3    (C1 - C2) sin(----) - 3 C1 cos(----)|
                 \                    3                3   /

Works also with the inner simplify replaced with expand,

simplify(expand(evalc(z)),size);

               n / 1/2               n Pi             n Pi \
         -1/3 2  |3    (C1 - C2) sin(----) - 3 C1 cos(----)|
                 \                    3                3   /

and without factoring out 2^n as

collect(expand(evalc(z)),sin,factor);

                n  1/2               n Pi        n     n Pi
          -1/3 2  3    (C1 - C2) sin(----) + C1 2  cos(----)
                                      3                 3

Alec

10% more efficient version of MinPolyGF can be written as

MinPolyGF1:=proc(x,y:=_X)
local A, i;
A:=Matrix(100,[seq([op(modp1(Rem(Shift(x,i),F:-extension),2))],i=0..99)],datatype=integer[4]);
(Sqrfree(LinearAlgebra:-Modular:-CharacteristicPolynomial(2,A,y)) mod 2)[2,1,1]
end:

CodeTools:-Usage(seq(MinPolyGF(F:-`^`(z,k),x),k=1..1000)):
memory used=0.57GiB, alloc change=0 bytes, cpu time=17.38s, real time=17.48s

Alec

It is much faster in Sage,

sage: k=GF(2^100,'a')
sage: L=[k.random_element() for i in range(1000)]
sage: time M=[i.minpoly() for i in L]
CPU times: user 0.62 s, sys: 0.00 s, total: 0.62 s

This timing is for (my custom build of) Sage running in cygwin on Windows. It might be faster on Linux, but Maple is faster there, too.

Maple could use NTL library though through external calling for that. That may give comparable timing. On the other hand, it is GPLed and it is a part of Sage (also GPLed), so why not to use Sage directly?

Alec

@AlwaysLearning 

As I said, you shouldn't make the multiplication implicit (using a space). It's much better to use a dot instead - then Maple won't interpret it as * which produces those errors.

In general, the best tutorials available are Maple manuals (available from the Help menu and for download from the Documentation Center.) Or posts on this site. Everything else (books etc.) is outdated.

Alec

@AlwaysLearning 

As I said, you shouldn't make the multiplication implicit (using a space). It's much better to use a dot instead - then Maple won't interpret it as * which produces those errors.

In general, the best tutorials available are Maple manuals (available from the Help menu and for download from the Documentation Center.) Or posts on this site. Everything else (books etc.) is outdated.

Alec

@Kamel 

plot({f(t),
a[0]/2+add(eval(a[i],i=j)*cos(2*Pi*j*t/T),j=1..trunc((N-1)/2)),
a0/2+add(A[j]*cos(2*Pi*j*t/T),j=1..trunc((N-1)/2))},t=0..2);

In case of non-zero b[i], you should add corresponding terms in a similar manner, with b instead of a, sin instead of cos, and B instead of A (as I see you did).

Alec

@Kamel 

plot({f(t),
a[0]/2+add(eval(a[i],i=j)*cos(2*Pi*j*t/T),j=1..trunc((N-1)/2)),
a0/2+add(A[j]*cos(2*Pi*j*t/T),j=1..trunc((N-1)/2))},t=0..2);

In case of non-zero b[i], you should add corresponding terms in a similar manner, with b instead of a, sin instead of cos, and B instead of A (as I see you did).

Alec

@hirnyk 

It worked in my Maple 14. Perhaps, there were some problems with that in Maple 13?

The formulas that I've just added at the end don't include Re and Im, so they should work even if Re and/or Im don't work.

Alec

Edit: Yes, I've just checked that in Maple 13 -

Im(<I>);
Error, invalid input: simpl/Im expects its 1st argument, x, to be of type {boolean, algebraic},
but received Vector(1, [...], datatype = anything)

while in Maple 14

Im(<I>);
                                 [1]

Well, the easiest is just to add ~ to Im - that works in both Maple 13 and Maple 14,

Im~(<I>);
                                 [1]

Alec

@hirnyk 

It worked in my Maple 14. Perhaps, there were some problems with that in Maple 13?

The formulas that I've just added at the end don't include Re and Im, so they should work even if Re and/or Im don't work.

Alec

Edit: Yes, I've just checked that in Maple 13 -

Im(<I>);
Error, invalid input: simpl/Im expects its 1st argument, x, to be of type {boolean, algebraic},
but received Vector(1, [...], datatype = anything)

while in Maple 14

Im(<I>);
                                 [1]

Well, the easiest is just to add ~ to Im - that works in both Maple 13 and Maple 14,

Im~(<I>);
                                 [1]

Alec

@DuncanA 

minpol(15);

                               x - 1[1]

Alec

@DuncanA 

minpol(15);

                               x - 1[1]

Alec

@Alejandro Jakubi : Another one,

sum(1/(k^5+1),k=1..infinity);

                               /   -----          \
                               |    \             |
  -infinity signum(- 1/5 + 1/5 |     )      _alpha|)
                               |    /             |
                               |   -----          |
                               \_alpha = %1       /

               /   -----                          \
               |    \                             |         gamma
         + 1/5 |     )      _alpha Psi(1 - _alpha)| - 1/5 + -----
               |    /                             |           5
               |   -----                          |
               \_alpha = %1                       /

                 4     3     2
  %1 := RootOf(_Z  - _Z  + _Z  - _Z + 1)

evalf(%);

                Float(undefined) + Float(undefined) I

evalf(Sum(1/(k^5+1),k=1..infinity));

                             0.5359628432

Without the first term, the first result would be correct. In the first term, the sum of roots is 1, so it can be simplified to  -infinity*signum(0), which is still wrong - it should be just 0 there.

Alec

@Alejandro Jakubi : Another one,

sum(1/(k^5+1),k=1..infinity);

                               /   -----          \
                               |    \             |
  -infinity signum(- 1/5 + 1/5 |     )      _alpha|)
                               |    /             |
                               |   -----          |
                               \_alpha = %1       /

               /   -----                          \
               |    \                             |         gamma
         + 1/5 |     )      _alpha Psi(1 - _alpha)| - 1/5 + -----
               |    /                             |           5
               |   -----                          |
               \_alpha = %1                       /

                 4     3     2
  %1 := RootOf(_Z  - _Z  + _Z  - _Z + 1)

evalf(%);

                Float(undefined) + Float(undefined) I

evalf(Sum(1/(k^5+1),k=1..infinity));

                             0.5359628432

Without the first term, the first result would be correct. In the first term, the sum of roots is 1, so it can be simplified to  -infinity*signum(0), which is still wrong - it should be just 0 there.

Alec

@Alejandro Jakubi 

I think that's strange because it works with an assigned n, say n=11,

infolevel[sum]:=3:
sum((-1)^(k+1)/k^11,k=1..infinity);
sum:   "process the input arguments"
sum:   "definite sum"
ClosedForm:   simple definite summations
ClosedForm:   infinite summation
Indefinite:   "process the input arguments"
ClosedForm:   "handle floats"
ClosedForm:   "indefinite summation"
ClosedForm:   "indefinite summation failed"
ClosedForm:   definite summation using hypergeometric functions
ClosedForm:   definite summation using hypergeometric functions
sum/hypergeom:   Function    -1/(x+1)^11*(-1)^(x+1)    satisfies the criteria

                            1023
                            ---- Zeta(11)
                            1024

If the definite summation using hypergeometric functions works for n=11 (and other n), it should work with an unassigned name n assuming n>1.

Another humorous thing is that the summation works after changing a sign,

sum((-1)^k/k^n,k=1..infinity) assuming n>1;

                          (1 - n)
                        (2        - 1) Zeta(n)

Even without assumptions,

sum((-1)^k/k^n,k=1..infinity);

                            polylog(n, -1)

Alec

4 5 6 7 8 9 10 Last Page 6 of 180