Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

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

Considering that as a projective transformation with matrix

A:=<1,1;0,1>;

                                 [1    1]
                            A := [      ]
                                 [0    1]

in the sence that

A.<x, 1>;

                               [x + 1]
                               [     ]
                               [  1  ]

it's n-th power can be found as

LinearAlgebra:-MatrixPower(A,n);

                               [1    n]
                               [      ]
                               [0    1]

%.<x, 1>;

                               [x + n]
                               [     ]
                               [  1  ]

Alec

Works with r*~X+(1-r)*~Y in Maple 13.

Alec

SurfaceInt from the VectorCalculus package can be used. With your new variables u and v that can be done as

solve({u=x*y,v=x/y},{x,y},Explicit);

                            1/2                              1/2
              1/2      (v u)                 1/2        (v u)
    {x = (v u)   , y = --------}, {x = -(v u)   , y = - --------}
                          v                                v

VectorCalculus:-SurfaceInt(1,[x,y,z]=
    Surface(<sqrt(u*v),sqrt(u/v),0>,u=1..2,v=1/2..1));

                              1/2 ln(2)

Alec

Just tried that in Wolfram Alpha, out of curiosity, using the Mathematica's syntax,

BaseForm[N[Sqrt[2],1000],12]

Worked out OK,

Alec

 

A similar thing can be done with using fscanf directly,

fd:="foo.txt":
assign(seq('p[i],n[i]',i=1..3)=('fscanf(fd,"%{3}dc")[]'$6));
close(fd);
seq('p[i],n[i]',i=1..3);

                    [1]  [4]  [2]  [ 8]  [3]  [12]
                    [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                    [2], [5], [4], [10], [6], [15]
                    [ ]  [ ]  [ ]  [  ]  [ ]  [  ]
                    [3]  [6]  [6]  [12]  [9]  [18]

Alec

Probably, it is easier to use spreadsheets for such things instead of tables. Tables, in general, serve for the worksheet layout (as in html), and not for the data.

Alec

The integral from -infinity to infinity equals 2*Pi*I*sum of residues in the upper half-plane. The integrand in this example is an even function, so the integral of it from 0 to infinity is equal to the half of the integral from -infinity to infinity. 

Yes, some simplifications like that are possible, but the usual ones, such as conversion to sincos etc., don't seem to work.

Alec

It can be done with residues,

singular(cosh(a*x)/cosh(x));

                  {a = a, x = 1/2 I Pi + Pi _Z1~ I}

residue(cosh(a*x)/cosh(x),x=I*Pi/2*n) assuming n::odd;

                                 a Pi n
                             cos(------)
                                   2
                             -----------
                                  (n/2)
                              (-1)

Pi*sum((-1)^n*cos(a*Pi*(2*n+1)/2),n=0..infinity);

                          Pi exp(1/2 I a Pi)
                          ------------------
                           1 + exp(a Pi I)

That's the same answer, which can be easily seen by dividing the numerator and the denominator by exp(Pi*a*I/2) and using the Euler's formula for the cosine (in the denominator). It doesn't seem to be easily done in Maple though.

Alec

That can be also done using Laplace transform,

inttrans[laplace](sech(x),x,a)/2+inttrans[laplace](sech(x),x,-a)/2;

  1/4 Psi(3/4 + a/4) - 1/4 Psi(a/4 + 1/4) + 1/4 Psi(3/4 - a/4)

         - 1/4 Psi(- a/4 + 1/4)

simplify(%);

                                   Pi
          1/4 ---------------------------------------------
              sin(1/4 Pi a + 1/4 Pi) cos(1/4 Pi a + 1/4 Pi)

combine(%);

                                   Pi
                            1/2 ---------
                                    Pi a
                                cos(----)
                                     2

Alec

Assuming that your list is short, that can be done, for example, as having the following Button action,

use DocumentTools in 
r:=rand(); 
if not assigned(L) then L:=[r] else L:=[op(L),r] fi;
Do(%MathContainer0=r)
end use;

For longer lists - if you are going to press the button hundreds times, it is better to create list first, and then access it consequently.

Alec

G.A.Edgar,

Your guess is certainly better than mine. But could you make it without looking at the worksheet?

What I mean is that if somebody wants help, it is much better to post example in plain text here - that would significantly simplify the access to it, especially in the current situation with MapleNet not working.

Alec

Since I already showed how that works in Sage in 2 other posts, I'll post how this problem can be solved in Sage as well.

G=Graph({'a':['a','b','b','b','e'],'b':['c','d','e'],
    'c':['c','d','d','d'],'d':['e']})

G.show(pos={'a':[0,1],'b':[1,1],'c':[2,0],'d':[1,0],'e':[0,0]})

 

G.num_verts()
                        5
G.num_edges()
                       13

[(i,G.degree(i)) for i in G.vertices()]

    [('a', 6), ('b', 6), ('c', 6), ('d', 5), ('e', 3)]

Alec Mihailovs

Yes, parametric curves (and parametric surfaces) usually produce better plots and use less data for their construction, so it is always a good idea to use them if possible. In addition to Dr. Meade's example above, that could be also done in this example by chosing y as a parameter,

plots:-spacecurve([sqrt(9-y^2), y, y*sqrt(9-y^2),
    y=-3..3], axes=box);

Alec Mihailovs

MapleNet gave an error, and I don't usually download worksheets (for security reasons). My guess is that you use if in a normal form and it didn't work. It should work in the operator  `if` form, something like

seq(`if`(i::even,-i,i),i=1..5);

                           1, -2, 3, -4, 5

Alec Mihailovs

Here is a simple procedure modified from Alex Potapchik's procedure by adding a replicated mean vector to the result,

MultivariateNormalSample := proc(Sigma, V, N)
    local d;
    uses LinearAlgebra, ArrayTools, Statistics;
    d := Dimension(V);
    LUDecomposition(Matrix(Sigma, datatype=float[8]), 
            'method' = 'Cholesky').
        Alias(Sample(Normal(0, 1), d*N),[d,N])+
        Replicate(Vector[column](V,datatype=float[8]),1,N)
end proc:

For example,

S:=MultivariateNormalSample(<<1|2>,<2|5>>, <2,3>, 1000);

                         [ 2 x 1000 Matrix      ]
                    S := [ Data Type: float[8]  ]
                         [ Storage: rectangular ]
                         [ Order: Fortran_order ]

Statistics:-CovarianceMatrix(S^%T);

                     [1.009271420    2.000307848]
                     [                          ]
                     [2.000307848    4.920761019]

map(Statistics:-Mean,[S[1],S[2]]);

                      [1.983797563, 3.000736856]

Alec Mihailovs

First 28 29 30 31 32 33 34 Last Page 30 of 76