MaplePrimes Posts

MaplePrimes Posts are for sharing your experiences, techniques and opinions about Maple, MapleSim and related products, as well as general interests in math and computing.

Latest Post
  • Latest Posts Feed
  • Exercises solved online with Maple exclusively in space. I attach the explanation links on my YouTube channel.

    Part # 01

    https://www.youtube.com/watch?v=8Aa2xzU8LwQ

    Part # 02

    https://www.youtube.com/watch?v=qyGT28CeSz4

    Part # 03

    https://www.youtube.com/watch?v=yf8rjSPbv5g

    Part # 04

    https://www.youtube.com/watch?v=FwHPW7ncZTg

    Part # 05

    https://www.youtube.com/watch?v=bm3frpukb0I

    Link for download the file:

    Vector_Exercises-Force_in_space.mw

    Lenin AC

    Ambassador of Maple

     

     

     

    @chandrashekhar 

    There are no efficient algorithms for this.
    How would you simplify by hand the expression

    512*b^9 + (2303*a + 2304)*b^8 + (4616*a^2 + 9216*a + 4608)*b^7 + (5348*a^3 + 16128*a^2 + 16128*a + 5376)*b^6
     + (4088*a^4 + 16128*a^3 + 24192*a^2 + 16128*a + 4032)*b^5 + (1946*a^5 + 10080*a^4 + 20160*a^3 + 20160*a^2 
    + 10080*a + 2016)*b^4 + (728*a^6 + 4032*a^5 + 10080*a^4 + 13440*a^3 + 10080*a^2 + 4032*a + 672)*b^3 
    + (116*a^7 + 1008*a^6 + 3024*a^5 + 5040*a^4 + 5040*a^3 + 3024*a^2 + 1008*a + 144)*b^2 
    + (26*a^8 + 144*a^7 + 504*a^6 + 1008*a^5 + 1260*a^4 + 1008*a^3 + 504*a^2 + 144*a + 18)*b + 9*a^8 
    + 36*a^7 + 84*a^6 + 126*a^5 + 126*a^4 + 84*a^3 + 36*a^2 + 9*a + 1

    to  (a+2*b+1)^9 - a*(a-b)^8   ?

     

    We occasionally get asked questions about methods of Perturbation Theory in Maple, including the Lindstedt-Poincaré Method. Presented here is the most famous application of this method.

    Introduction

    During the dawn of the 20th Century, one problem that bothered astronomers and astrophysicists was the precession of the perihelion of Mercury. Even when considering the gravity from other planets and objects in the solar system, the equations from Newtonian Mechanics could not account for the discrepancy between the observed and predicted precession.

    One of the early successes of Einstein's General Theory of Relativity was that the new model was able to capture the precession of Mercury, in addition to the orbits of all the other planets. The Einsteinian model, when applied to the orbit of Mercury, was in fact a non-negligible perturbation of the old model. In this post, we show how to use Maple to compute the perturbation, and derive the formula for calculating the precession.

    In polar coordinates, the Einsteinian model can be written in the following form, where u(theta)=a(1-e^2)/r(theta), with theta being the polar angle, r(theta) being the radial distance, a being the semi-major axis length, and e being the eccentricity of the orbit:
     

    # Original system.
    f := (u,epsilon) -> -1 - epsilon * u^2;
    omega := 1;
    u0, du0 := 1 + e, 0;
    de1 := diff( u(theta), theta, theta ) + omega^2 * u(theta) + f( u(theta), epsilon );
    ic1 := u(0) = u0, D(u)(0) = du0;
    


    The small parameter epsilon (along with the amount of precession) can be found in terms of the physical constants, but for now we leave it arbitrary:
     

    # Parameters.
    P := [
        a = 5.7909050e10 * Unit(m),
        c = 2.99792458e8 * Unit(m/s),
        e = 0.205630,
        G = 6.6740831e-11 * Unit(N*m^2/kg^2), 
        M = 1.9885e30 * Unit(kg), 
        alpha = 206264.8062, 
        beta = 415.2030758 
    ];
    epsilon = simplify( eval( 3 * G * M / a / ( 1 - e^2 ) / c^2, P ) ); # approximately 7.987552635e-8


    Note that c is the speed of light, G is the gravitational constant, M is the mass of the sun, alpha is the number of arcseconds per radian, and beta is the number of revolutions per century for Mercury.

    We will show that the radial distance, predicted by Einstein's model, is close to that for an ellipse, as predicted by Newton's model, but the perturbation accounts for the precession (42.98 arcseconds/century). During one revolution, the precession can be determined to be approximately
     

    sigma = simplify( eval( 6 * Pi * G * M / a / ( 1 - e^2 ) / c^2, P ) ); # approximately 5.018727337e-7


    and so, per century, it is alpha*beta*sigma, which is approximately 42.98 arcseconds/century.
    It is worth checking out this question on Stack Exchange, which includes an animation generated numerically using Maple for a similar problem that has a more pronounced precession.

    Lindstedt-Poincaré Method in Maple

    In order to obtain a perturbation solution to the perturbed differential equation u'+omega^2*u=1+epsilon*u^2 which is periodic, we need to write both u and omega as a series in the small parameter epsilon. This is because otherwise, the solution would have unbounded oscillatory terms ("secular terms"). Using this Lindstedt-Poincaré Method, we substitute arbitrary series in epsilon for u and omega into the initial value problem, and then choose the coefficient constants/functions so that both the initial value problem is satisfied and there are no secular terms. Note that a first-order approximation provides plenty of agreement with the measured precession, but higher-order approximations can be obtained.

    To perform this in Maple, we can do the following:
     

    # Transformed system, with the new independent variable being the original times a series in epsilon.
    de2 := op( PDEtools:-dchange( { theta = phi/b }, { de1 }, { phi }, params = { b, epsilon }, simplify = true ) );
    ic2 := ic1;
    
    # Order and series for the perturbation solutions of u(phi) and b. Here, n = 1 is sufficient.
    n := 1;
    U := unapply( add( p[k](phi) * epsilon^k, k = 0 .. n ), phi );
    B := omega + add( q[k] * epsilon^k, k = 1 .. n );
    
    # DE in terms of the series.
    de3 := series( eval( de2, [ u = U, b = B ] ), epsilon = 0, n + 1 );
    
    # Successively determine the coefficients p[k](phi) and q[k].
    for k from 0 to n do
    
        # Specify the initial conditions for the kth DE, which involves p[k](phi).
        # The original initial conditions appear only in the coefficient functions with index k = 0,
        # and those for k > 1 are all zero.
        if k = 0 then
            ic3 := op( expand( eval[recurse]( [ ic2 ], [ u = U, epsilon = 0 ] ) ) );
        else
            ic3 := p[k](0), D(p[k])(0);
        end if:
    
        # Solve kth DE, which can be found from the coefficients of the powers of epsilon in de3, for p[k](phi).
        # Then, update de3 with the new information.
        soln := dsolve( { simplify( coeff( de3, epsilon, k ) ), ic3 } );
        p[k] := unapply( rhs( soln ), phi );
        de3 := eval( de3 );
    
        # Choose q[k] to eliminate secular terms. To do this, use the frontend() command to keep only the terms in p[k](phi)
        # which have powers of t, and then solve for the value of q[k] which makes the expression zero. 
        # Note that frontend() masks the t-dependence within the sine and cosine terms.
        # Note also that this method may need to be amended, based on the form of the terms in p[k](phi).
        if k > 0 then
            q[1] := solve( frontend( select, [ has, p[k](phi), phi ] ) = 0, q[1] );
            de3 := eval( de3 );
        end if;
    
    end do:
    
    # Final perturbation solution.
    'u(theta)' = eval( eval( U(phi), phi = B * theta ) ) + O( epsilon^(n+1) );
    
    # Angular precession in one revolution.
    sigma := convert( series( 2 * Pi * (1/B-1), epsilon = 0, n + 1 ), polynom ):
    epsilon := 3 * G * M / a / ( 1 - e^2 ) / c^2;
    'sigma' = sigma;
    
    # Precession per century.
    xi := simplify( eval( sigma * alpha * beta, P ) ); # returns approximately 42.98


    Maple Worksheet: Lindstedt-Poincare_Method.mw


     

    Solving a Numbrix Puzzle with Logic

    Background

     

     

    Parade magazine, a filler in the local Sunday newspaper, contains a Numbrix puzzle, the object of which is to find a serpentine path of consecutive integers, 1 through 81, through a nine by nine grid.  The puzzle typically specifies the content of every other border cell.

     

    The Maple Logic  package has a procedure, Satisfy , that can be used to solve this puzzle.  Satisfy is a SAT-solver; given a boolean expression it attempts to find a set of equations of the form {x__1 = b__1, x__2 = b__2, () .. ()}, where x__i are the boolean variables in the given expression and b__i are boolean values (true or false) that satisfy the expression (cause it to evaluate true).

     

    A general technique to solve this and other puzzles with Satisfy is to select boolean-values variables that encode the state of the puzzle (a trial solution, whether valid or not), generate a boolean-expression of these variables that is satisfied (true) if and only if the variables are given values that correspond to a solution, pass this expression to Satisfy, then translate the returned set of boolean values (if any) to the puzzle solution.

    Setup

     

    Assign a matrix that defines the grid and the initial position.  Use zeros to indicate the cells that need values. To make it easy to inspect the expressions, a small 2 x 3 matrix is used for this demo---a full size example is given at the end.

    M := Matrix(2,3, {(1,1) = 1, (1,3) = 5});

    Matrix(2, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0})

    (2.1)

     

    Extract the dimensions of the Matrix

    (m,n) := upperbound(M);

    2, 3

    (2.2)

    Boolean Variables

     

    Let the boolean variable x[i,j,k] mean that cell (i,j) has value k. For example, x[2,3,6] is true when cell (2,3) contains 6, otherwise it is false. There are (m*n)^2 boolean variables.

    Initial Position

     

    The initial position can be expressed as the following and-clause.

    initial := &and(seq(seq(ifelse(M[i,j] = 0, NULL, x[i,j,M[i,j]]), i = 1..m), j = 1..n));

    `&and`(x[1, 1, 1], x[1, 3, 5])

    (4.1)

    Adjacent Cells

     

    The requirement that an interior cell with value k is adjacent to the cell with value k+1 can be expressed as the implication
       

       x[i,j,k] &implies &or(x[i-1,j,k+1], x[i+1,j,k+1], x[i,j-1,k+1], x[i,j+1,k+1])

     

    Extending this to handle all cells results in the following boolean expression.

    adjacent := &and(seq(seq(seq(
             x[i,j,k] &implies &or(NULL
                                   , ifelse(1<i, x[i-1, j, k+1], NULL)
                                   , ifelse(i<m, x[i+1, j, k+1], NULL)
                                   , ifelse(1<j, x[i, j-1, k+1], NULL)
                                   , ifelse(j<n, x[i, j+1, k+1], NULL)
                                   )
                                , i = 1..m)
                            , j = 1..n)
                        , k = 1 .. m*n-1));

    `&and`(`&implies`(x[1, 1, 1], `&or`(x[2, 1, 2], x[1, 2, 2])), `&implies`(x[2, 1, 1], `&or`(x[1, 1, 2], x[2, 2, 2])), `&implies`(x[1, 2, 1], `&or`(x[2, 2, 2], x[1, 1, 2], x[1, 3, 2])), `&implies`(x[2, 2, 1], `&or`(x[1, 2, 2], x[2, 1, 2], x[2, 3, 2])), `&implies`(x[1, 3, 1], `&or`(x[2, 3, 2], x[1, 2, 2])), `&implies`(x[2, 3, 1], `&or`(x[1, 3, 2], x[2, 2, 2])), `&implies`(x[1, 1, 2], `&or`(x[2, 1, 3], x[1, 2, 3])), `&implies`(x[2, 1, 2], `&or`(x[1, 1, 3], x[2, 2, 3])), `&implies`(x[1, 2, 2], `&or`(x[2, 2, 3], x[1, 1, 3], x[1, 3, 3])), `&implies`(x[2, 2, 2], `&or`(x[1, 2, 3], x[2, 1, 3], x[2, 3, 3])), `&implies`(x[1, 3, 2], `&or`(x[2, 3, 3], x[1, 2, 3])), `&implies`(x[2, 3, 2], `&or`(x[1, 3, 3], x[2, 2, 3])), `&implies`(x[1, 1, 3], `&or`(x[2, 1, 4], x[1, 2, 4])), `&implies`(x[2, 1, 3], `&or`(x[1, 1, 4], x[2, 2, 4])), `&implies`(x[1, 2, 3], `&or`(x[2, 2, 4], x[1, 1, 4], x[1, 3, 4])), `&implies`(x[2, 2, 3], `&or`(x[1, 2, 4], x[2, 1, 4], x[2, 3, 4])), `&implies`(x[1, 3, 3], `&or`(x[2, 3, 4], x[1, 2, 4])), `&implies`(x[2, 3, 3], `&or`(x[1, 3, 4], x[2, 2, 4])), `&implies`(x[1, 1, 4], `&or`(x[2, 1, 5], x[1, 2, 5])), `&implies`(x[2, 1, 4], `&or`(x[1, 1, 5], x[2, 2, 5])), `&implies`(x[1, 2, 4], `&or`(x[2, 2, 5], x[1, 1, 5], x[1, 3, 5])), `&implies`(x[2, 2, 4], `&or`(x[1, 2, 5], x[2, 1, 5], x[2, 3, 5])), `&implies`(x[1, 3, 4], `&or`(x[2, 3, 5], x[1, 2, 5])), `&implies`(x[2, 3, 4], `&or`(x[1, 3, 5], x[2, 2, 5])), `&implies`(x[1, 1, 5], `&or`(x[2, 1, 6], x[1, 2, 6])), `&implies`(x[2, 1, 5], `&or`(x[1, 1, 6], x[2, 2, 6])), `&implies`(x[1, 2, 5], `&or`(x[2, 2, 6], x[1, 1, 6], x[1, 3, 6])), `&implies`(x[2, 2, 5], `&or`(x[1, 2, 6], x[2, 1, 6], x[2, 3, 6])), `&implies`(x[1, 3, 5], `&or`(x[2, 3, 6], x[1, 2, 6])), `&implies`(x[2, 3, 5], `&or`(x[1, 3, 6], x[2, 2, 6])))

    (5.1)

     

    All Values Used

     

    The following expression is true when each integer k, from 1 to m*n, is assigned to one or more cells.

    allvals := &and(seq(seq(&or(seq(x[i,j,k], k=1..m*n)), i=1..m), j=1..n));

    `&and`(`&or`(x[1, 1, 1], x[1, 1, 2], x[1, 1, 3], x[1, 1, 4], x[1, 1, 5], x[1, 1, 6]), `&or`(x[2, 1, 1], x[2, 1, 2], x[2, 1, 3], x[2, 1, 4], x[2, 1, 5], x[2, 1, 6]), `&or`(x[1, 2, 1], x[1, 2, 2], x[1, 2, 3], x[1, 2, 4], x[1, 2, 5], x[1, 2, 6]), `&or`(x[2, 2, 1], x[2, 2, 2], x[2, 2, 3], x[2, 2, 4], x[2, 2, 5], x[2, 2, 6]), `&or`(x[1, 3, 1], x[1, 3, 2], x[1, 3, 3], x[1, 3, 4], x[1, 3, 5], x[1, 3, 6]), `&or`(x[2, 3, 1], x[2, 3, 2], x[2, 3, 3], x[2, 3, 4], x[2, 3, 5], x[2, 3, 6]))

    (6.1)

    Single Value

     

    The following expression is satisfied when each cell has no more than one value.

     single := &not &or(seq(seq(seq(seq(x[i,j,k] &and x[i,j,kk], kk = k+1..m*n), k = 1..m*n-1), i = 1..m), j = 1..n));

    `&not`(`&or`(`&and`(x[1, 1, 1], x[1, 1, 2]), `&and`(x[1, 1, 1], x[1, 1, 3]), `&and`(x[1, 1, 1], x[1, 1, 4]), `&and`(x[1, 1, 1], x[1, 1, 5]), `&and`(x[1, 1, 1], x[1, 1, 6]), `&and`(x[1, 1, 2], x[1, 1, 3]), `&and`(x[1, 1, 2], x[1, 1, 4]), `&and`(x[1, 1, 2], x[1, 1, 5]), `&and`(x[1, 1, 2], x[1, 1, 6]), `&and`(x[1, 1, 3], x[1, 1, 4]), `&and`(x[1, 1, 3], x[1, 1, 5]), `&and`(x[1, 1, 3], x[1, 1, 6]), `&and`(x[1, 1, 4], x[1, 1, 5]), `&and`(x[1, 1, 4], x[1, 1, 6]), `&and`(x[1, 1, 5], x[1, 1, 6]), `&and`(x[2, 1, 1], x[2, 1, 2]), `&and`(x[2, 1, 1], x[2, 1, 3]), `&and`(x[2, 1, 1], x[2, 1, 4]), `&and`(x[2, 1, 1], x[2, 1, 5]), `&and`(x[2, 1, 1], x[2, 1, 6]), `&and`(x[2, 1, 2], x[2, 1, 3]), `&and`(x[2, 1, 2], x[2, 1, 4]), `&and`(x[2, 1, 2], x[2, 1, 5]), `&and`(x[2, 1, 2], x[2, 1, 6]), `&and`(x[2, 1, 3], x[2, 1, 4]), `&and`(x[2, 1, 3], x[2, 1, 5]), `&and`(x[2, 1, 3], x[2, 1, 6]), `&and`(x[2, 1, 4], x[2, 1, 5]), `&and`(x[2, 1, 4], x[2, 1, 6]), `&and`(x[2, 1, 5], x[2, 1, 6]), `&and`(x[1, 2, 1], x[1, 2, 2]), `&and`(x[1, 2, 1], x[1, 2, 3]), `&and`(x[1, 2, 1], x[1, 2, 4]), `&and`(x[1, 2, 1], x[1, 2, 5]), `&and`(x[1, 2, 1], x[1, 2, 6]), `&and`(x[1, 2, 2], x[1, 2, 3]), `&and`(x[1, 2, 2], x[1, 2, 4]), `&and`(x[1, 2, 2], x[1, 2, 5]), `&and`(x[1, 2, 2], x[1, 2, 6]), `&and`(x[1, 2, 3], x[1, 2, 4]), `&and`(x[1, 2, 3], x[1, 2, 5]), `&and`(x[1, 2, 3], x[1, 2, 6]), `&and`(x[1, 2, 4], x[1, 2, 5]), `&and`(x[1, 2, 4], x[1, 2, 6]), `&and`(x[1, 2, 5], x[1, 2, 6]), `&and`(x[2, 2, 1], x[2, 2, 2]), `&and`(x[2, 2, 1], x[2, 2, 3]), `&and`(x[2, 2, 1], x[2, 2, 4]), `&and`(x[2, 2, 1], x[2, 2, 5]), `&and`(x[2, 2, 1], x[2, 2, 6]), `&and`(x[2, 2, 2], x[2, 2, 3]), `&and`(x[2, 2, 2], x[2, 2, 4]), `&and`(x[2, 2, 2], x[2, 2, 5]), `&and`(x[2, 2, 2], x[2, 2, 6]), `&and`(x[2, 2, 3], x[2, 2, 4]), `&and`(x[2, 2, 3], x[2, 2, 5]), `&and`(x[2, 2, 3], x[2, 2, 6]), `&and`(x[2, 2, 4], x[2, 2, 5]), `&and`(x[2, 2, 4], x[2, 2, 6]), `&and`(x[2, 2, 5], x[2, 2, 6]), `&and`(x[1, 3, 1], x[1, 3, 2]), `&and`(x[1, 3, 1], x[1, 3, 3]), `&and`(x[1, 3, 1], x[1, 3, 4]), `&and`(x[1, 3, 1], x[1, 3, 5]), `&and`(x[1, 3, 1], x[1, 3, 6]), `&and`(x[1, 3, 2], x[1, 3, 3]), `&and`(x[1, 3, 2], x[1, 3, 4]), `&and`(x[1, 3, 2], x[1, 3, 5]), `&and`(x[1, 3, 2], x[1, 3, 6]), `&and`(x[1, 3, 3], x[1, 3, 4]), `&and`(x[1, 3, 3], x[1, 3, 5]), `&and`(x[1, 3, 3], x[1, 3, 6]), `&and`(x[1, 3, 4], x[1, 3, 5]), `&and`(x[1, 3, 4], x[1, 3, 6]), `&and`(x[1, 3, 5], x[1, 3, 6]), `&and`(x[2, 3, 1], x[2, 3, 2]), `&and`(x[2, 3, 1], x[2, 3, 3]), `&and`(x[2, 3, 1], x[2, 3, 4]), `&and`(x[2, 3, 1], x[2, 3, 5]), `&and`(x[2, 3, 1], x[2, 3, 6]), `&and`(x[2, 3, 2], x[2, 3, 3]), `&and`(x[2, 3, 2], x[2, 3, 4]), `&and`(x[2, 3, 2], x[2, 3, 5]), `&and`(x[2, 3, 2], x[2, 3, 6]), `&and`(x[2, 3, 3], x[2, 3, 4]), `&and`(x[2, 3, 3], x[2, 3, 5]), `&and`(x[2, 3, 3], x[2, 3, 6]), `&and`(x[2, 3, 4], x[2, 3, 5]), `&and`(x[2, 3, 4], x[2, 3, 6]), `&and`(x[2, 3, 5], x[2, 3, 6])))

    (7.1)

    Solution

     

    Combine the boolean expressions into a a single and-clause and pass it to Satisfy.

    sol := Logic:-Satisfy(&and(initial, adjacent, allvals, single));

    {x[1, 1, 1] = true, x[1, 1, 2] = false, x[1, 1, 3] = false, x[1, 1, 4] = false, x[1, 1, 5] = false, x[1, 1, 6] = false, x[1, 2, 1] = false, x[1, 2, 2] = false, x[1, 2, 3] = false, x[1, 2, 4] = false, x[1, 2, 5] = false, x[1, 2, 6] = true, x[1, 3, 1] = false, x[1, 3, 2] = false, x[1, 3, 3] = false, x[1, 3, 4] = false, x[1, 3, 5] = true, x[1, 3, 6] = false, x[2, 1, 1] = false, x[2, 1, 2] = true, x[2, 1, 3] = false, x[2, 1, 4] = false, x[2, 1, 5] = false, x[2, 1, 6] = false, x[2, 2, 1] = false, x[2, 2, 2] = false, x[2, 2, 3] = true, x[2, 2, 4] = false, x[2, 2, 5] = false, x[2, 2, 6] = false, x[2, 3, 1] = false, x[2, 3, 2] = false, x[2, 3, 3] = false, x[2, 3, 4] = true, x[2, 3, 5] = false, x[2, 3, 6] = false}

    (8.1)

    Select the equations whose right size is true

    sol := select(rhs, sol);

    {x[1, 1, 1] = true, x[1, 2, 6] = true, x[1, 3, 5] = true, x[2, 1, 2] = true, x[2, 2, 3] = true, x[2, 3, 4] = true}

    (8.2)

    Extract the lhs of the true equations

    vars := map(lhs, sol);

    {x[1, 1, 1], x[1, 2, 6], x[1, 3, 5], x[2, 1, 2], x[2, 2, 3], x[2, 3, 4]}

    (8.3)

    Extract the result from the indices of the vars and assign to a new Matrix

    S := Matrix(m,n):

    for v in vars do S[op(1..2,v)] := op(3,v); end do:

    S;

    Matrix(2, 3, {(1, 1) = 1, (1, 2) = 6, (1, 3) = 5, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4})

    (8.4)

    Procedure

     

    We can now combine the manual steps into a procedure that takes an initialized Matrix and fills in a solution.

    Numbrix := proc( M :: ~Matrix, { inline :: truefalse := false } )

    Example

     

    Create the initial position for a 9 x 9 Numbrix and solve it.

    P := Matrix(9, {(1,1)=11, (1,3)=7, (1,5)=3, (1,7)=81, (1,9)=77, (3,9)=75, (5,9)=65, (7,9)=55, (9,9)=53
                   , (9,7)=47, (9,5)=41, (9,3)=39, (9,1)=37, (7,1)=21, (5,1)=17, (3,1)=13});

    Matrix(9, 9, {(1, 1) = 11, (1, 2) = 0, (1, 3) = 7, (1, 4) = 0, (1, 5) = 3, (1, 6) = 0, (1, 7) = 81, (1, 8) = 0, (1, 9) = 77, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = 0, (3, 1) = 13, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = 0, (3, 8) = 0, (3, 9) = 75, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (4, 8) = 0, (4, 9) = 0, (5, 1) = 17, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (5, 7) = 0, (5, 8) = 0, (5, 9) = 65, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0, (6, 7) = 0, (6, 8) = 0, (6, 9) = 0, (7, 1) = 21, (7, 2) = 0, (7, 3) = 0, (7, 4) = 0, (7, 5) = 0, (7, 6) = 0, (7, 7) = 0, (7, 8) = 0, (7, 9) = 55, (8, 1) = 0, (8, 2) = 0, (8, 3) = 0, (8, 4) = 0, (8, 5) = 0, (8, 6) = 0, (8, 7) = 0, (8, 8) = 0, (8, 9) = 0, (9, 1) = 37, (9, 2) = 0, (9, 3) = 39, (9, 4) = 0, (9, 5) = 41, (9, 6) = 0, (9, 7) = 47, (9, 8) = 0, (9, 9) = 53})

    (10.1)

    CodeTools:-Usage(Numbrix(P));

    memory used=0.77GiB, alloc change=220.03MiB, cpu time=15.55s, real time=12.78s, gc time=3.85s

     

    Matrix(9, 9, {(1, 1) = 11, (1, 2) = 10, (1, 3) = 7, (1, 4) = 81, (1, 5) = 3, (1, 6) = 4, (1, 7) = 81, (1, 8) = 78, (1, 9) = 77, (2, 1) = 12, (2, 2) = 9, (2, 3) = 8, (2, 4) = 7, (2, 5) = 6, (2, 6) = 5, (2, 7) = 80, (2, 8) = 79, (2, 9) = 76, (3, 1) = 13, (3, 2) = 14, (3, 3) = 27, (3, 4) = 28, (3, 5) = 71, (3, 6) = 72, (3, 7) = 73, (3, 8) = 74, (3, 9) = 75, (4, 1) = 16, (4, 2) = 15, (4, 3) = 26, (4, 4) = 29, (4, 5) = 70, (4, 6) = 69, (4, 7) = 68, (4, 8) = 67, (4, 9) = 66, (5, 1) = 17, (5, 2) = 18, (5, 3) = 25, (5, 4) = 30, (5, 5) = 61, (5, 6) = 62, (5, 7) = 63, (5, 8) = 64, (5, 9) = 65, (6, 1) = 20, (6, 2) = 19, (6, 3) = 24, (6, 4) = 31, (6, 5) = 60, (6, 6) = 59, (6, 7) = 58, (6, 8) = 57, (6, 9) = 56, (7, 1) = 21, (7, 2) = 22, (7, 3) = 23, (7, 4) = 32, (7, 5) = 43, (7, 6) = 44, (7, 7) = 49, (7, 8) = 50, (7, 9) = 55, (8, 1) = 36, (8, 2) = 35, (8, 3) = 34, (8, 4) = 33, (8, 5) = 42, (8, 6) = 45, (8, 7) = 48, (8, 8) = 51, (8, 9) = 54, (9, 1) = 37, (9, 2) = 38, (9, 3) = 39, (9, 4) = 40, (9, 5) = 41, (9, 6) = 46, (9, 7) = 47, (9, 8) = 52, (9, 9) = 53})

    (10.2)

     

    numbrix.mw

    We have just released an update to Maple, Maple 2019.1.

    Maple 2019.1 includes corrections and improvement to the mathematics engine (including LPSolve, sum, statistics, and the Physics package),  visualization (including annotations and the Plot Builder), export to LaTeX (exporting output) and PDF (freezing on export), network licensing, MATLAB connectivity, and more.  We recommend that all Maple 2019 users install these updates.

    This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2019.1 download page, where you can also find more details.

    I just wanted to let everyone know that the Call for Papers and Extended Abstracts deadline for the Maple Conference has been extended to June 14.

    The papers and extended abstracts presented at the 2019 Maple Conference will be published in the Communications in Computer and Information Science Series from Springer. We welcome topics that fall into the following broad categories:

    • Maple in Education
    • Algorithms and Software
    • Applications of Maple

    You can learn more about the conference or submit your paper or abstract here: 

    https://www.maplesoft.com/mapleconference/Papers-and-Presentations.aspx

    Hope to hear from you soon!

    I describe here a finite difference scheme for solving the boundary value
    problem for the heat equation

    "(&PartialD; u)/(&PartialD; t)= ((&PartialD;)^)/((&PartialD;)^( )x^)(c(x)(&PartialD; u)/(&PartialD; x)) + f(x,t)   a<x<b,   t>0"

    for the unknown temperature u(x, t)subject to the boundary conditions

    u(a, t) = alpha(t), u(b, t) = beta(t), t > 0

    and the initial condition

    "u(x,0)=`u__0`(x),    a < x < b."

     

    This finite difference scheme is designed expressly with the goal of avoiding

    differentiating the conductivity c(x), therefore c(x) is allowed to be

    nonsmooth or even discontinuous. A discontinuous c(x) is particularly
    important in applications where the heat conduction takes place through layers
    of distinct types of materials.

     

    The animation below, extracted from the worksheet, demonstrates a solution 

    corresponding to a discontinuous c(x).  The limit of that solution as time goes to

    infinity, which may be calculated independently and exactly, is shown as a gray
    line.

    Download worksheet: heat-finite-difference.mw

     

    We’re excited to announce that we have just released a new version of MapleSim. The MapleSim 2019 family of products helps you get the answers you need from your models, with improved performance, increased modeling scope, and more ways to connect to your existing toolchain. Improvements include:
     

    • Faster simulation speeds, both within MapleSim and when using exported MapleSim models in other tools

    • More simulation options are now available when running models imported from other systems

    • Additional options for FMI connectivity, including support for variable-step solvers with imported FMUs, and exporting models using variable step solvers using the MapleSim FMI Connector add-on

    • Improved interactive analysis apps for Monte Carlo analysis, Optimization, and Parameter Sweep

    • Expanded modeling scope in hydraulics, electrical, multibody, and more, with new built-in components and support for more external Modelica libraries

    • New add-on library: MapleSim Engine Dynamics Library from Modelon provides specialized tools for modeling, simulating, and analyzing the performance of combustion engines

    • New add-on connector: The B&R MapleSim Connector gives automation projects a powerful, model-based ability to test and visualize control strategies from within B&R Automation Studio
       

    See What’s New in MapleSim 2019 for more information about these and other improvements!

    It is a very good computational tool to perform modeling and simulation using our world as a reference. You can also teach math knowing how to choose the right icons.
    I recommend this software to everyone who wants to simulate objects or multibodies. In any case, knowledge of physics and mathematics, especially vector mechanics, is necessary.
    Very grateful to the Maplesoft company for sharing their projects through the MapleSim gallery.

    From now on all projects will be with Maple and MapleSim.

    Lenin AC

    Ambassador of Maple

    macros can be made to work like subs, you just need to know a few tricks to get it to work the same way.  macros just works in a slightly different manner and we can make it useful.

    The difference is with subs, one has to keep specifying the substitution with each equation you want subbed, whereas macro will already have it defined.  As an example:

    a := v^2*z^3 - 34/(5*x^2*sin(y*v^2)) + 36*v^2 - b*v^2 + 3^(v^2 - cos(v^2 + g))
                                

    If we want to substitute h for v^2, then we would normally do this using subs

    subs(v^2=h,a)
                              

    however, we can also use macro

    macro(v^2=h)
                                        

    now it doesn't just automatically substitute those values so we need to coax maple a little bit.  We can do that by converting the equation to a string and parsing it.

    parse(convert(a,string))
                         

    so as you see we arrive at the same result.  Now there is a caveat using macro, if you've already defined a variable in a macro, subs will not work using the same variable sustitution - you first need to reset the variable in the macro back to itself. 

    subs(v^2=h,a)
                          #doesn't work since the variable is defined in a macro

    macro(v^2=v^2) #reset the variable in the macro

    subs(v^2=h,a)
                             # now it works

    we could also define a little procedure to simplify our typing, to have the macro variable work on our equation.

    mvs:=proc(a) #macro variable substitution
      parse(convert(a,string));
    end proc:

    macro(v^2=h)
    mvs(a)
                

    now if we had some other existing equation before defining the macro
    aa:=exp(v^2-sin(theta))+v^2*cos(theta)-1/x^sin(v^2-g)
                                       

    we just have to simply apply our proc on the equation to apply the variable substitution
    mvs(aa)
                  


     

     

     

     

    Submit your paper or extended abstract to the Maple Conference!

    The papers and extended abstracts presented at the 2019 Maple Conference will be published in the Communications in Computer and Information Science Series from Springer. 

    The deadline to submit is May 27, 2019. 

    This conference is an amazing opportunity to contribute to the development of technology in academics. I hope that you, or your colleagues and associates, will consider making a contribution.

    We welcome topics that fall into the following broad categories:

    • Maple in Education
    • Algorithms and Software
    • Applications of Maple

    You can learn more about the conference or submit your paper or abstract here: 

    https://www.maplesoft.com/mapleconference/Papers-and-Presentations.aspx

     

     

     

    Maple 2019 has a new add-on package Maple Quantum Chemistry Toolbox from RDMChem for computing the energies and properties of molecules.  As a member of the team at RDMChem that developed the package, I would like to tell the story of its origins and provide a brief demonstration of the package.  

     

    Thinking about Quantum Chemistry at Harvard

     

    The story of the Maple Quantum Chemistry Toolbox begins with my graduate studies in Chemical Physics at Harvard University in the late 1990s.  Even in 1998 programs for computing the energies and properties of molecules were extremely complicated and nonintuitive.  Many of the existing programs had begun in the 1970s on computers whose programs would be recorded on punchcards.

    Fig. 1: Used Punchcard by Pete Birkinshaw from Manchester, UK CC BY 2.0

     

    Even today some of these programs have remnants of their early versions such as input files that must start on the second column to account for the margin of the now non-existent punchcards.  As a student, I made a bound copy of one of these manuals at a local Kinkos photocopy shop and later found myself in Harvard Yard, thinking that there must be a better way to present quantum chemistry computations.  The idea for a Maple-like package for quantum chemistry was born in that moment.

     

    At the same time I was learning about something called the two-electron reduced density matrix (2-RDM).  The basic variable in quantum chemistry is the wave function which is the probability amplitude for finding each of the electrons in a molecule.  Because electrons are indistinguishable with pairwise interactions, the wave function contains much more information than is needed for computing the energies and electronic properties of molecules.  The energies and properties of any molecule with any number of electrons can be expressed as a function of a 2 electron matrix, the 2-RDM [1-3].  A quantum chemistry based on the 2-RDM, it was known, would have potentially significant advantages over wave function calculations in terms of accuracy and computational cost, especially for molecules far from the mean-field limit.  A 2-RDM approach to quantum chemistry became the focus of my Ph.D. thesis.

     

    Representing Many Electrons with Only Two Electrons

     

    The idea of using the 2-RDM in quantum chemistry can be attributed to four scientists: two physicists Kodi Husimi and Joseph Mayer, a chemist Per-Olov Lowdin, and a mathematician John Coleman [1-3].  In the early 1940s Husimi first published the idea in a Japanese physics journal, but in the midst of World War II the paper was not widely disseminated in the West.  In the summer of 1951 John Coleman, which attending a physics conference at Chalk River, realized that the ground-state energy of any atom or molecule could be expressed as functional of the 2-RDM, and similar ideas later occurred to Per-Olov Lowdin and Joseph Mayer who published their ideas in Physical Review in 1955.  It was soon recognized that computing the ground-state energy of an atom or molecule with the 2-RDM was potentially difficult because not every two-electron density matrix corresponds to an N-electron density matrix or wave function.  The search for the appropriate constraints on the 2-RDM, known as N-representability conditions, became known as the N-representability problem [1-3].  

     

    Beginning in the late 1990s and early 2000s, Carmela Valdemoro and Diego Alcoba at the Consejo Superior de Investigaciones Científicas (Madrid, Spain), Hiroshi Nakatsuji, Koji Yasuda, and Maho Nakata at Kyoto University (Kyoto, Japan), Jerome Percus and Bastiaan Braams at the Courant Institute (New York, USA), John Coleman and Robert Erdahl at Queens University (Kingston, Canada), and my research group and I at The University of Chicago (Chicago, USA) began to make significant progress in the computation of the 2-RDM without computing the many-electron wave function [1-3].  Further contributions were made by Eric Cances and Claude Le Bris at CERMICS, Ecole Nationale des Ponts et Chaussées (Marne-la-Vallée, France), Paul Ayers at McMaster University (Hamilton, Canada), and Dimitri Van Neck at the University of Ghent (Ghent, Belgium) and their research groups.  By 2014 several powerful 2-RDM methods had emerged for the computation of molecules.  The Army Research Office (ARO) issued a proposal call for a company to develop a modern, built-from-scratch package for quantum chemistry that would contain two newly developed 2-RDM-based methods from our group: the parametric 2-RDM method [1] and the variational 2-RDM method with a fast algorithm for solving the semidefinite program [4,5,6].   The company RDMChem LLC was founded to work with the ARO to develop such a package built around RDMs, and hence, the name of the company RDMChem was selected as a hybrid of the RDM abbreviation for Reduced Density Matrices and the Chem colloquialism for Chemistry.  To achieve a really new design for an electronic structure package with access to numeric and symbolic computations as well as advanced visualizations, the team at RDMChem and I developed a partnership with Maplesoft to build something new that became the Maple Quantum Chemistry Package (or Toolbox), which was released with Maple 2019 on Pi Day.

     

    Maple Quantum Chemistry Toolbox

     The Maple Quantum Chemistry Toolbox provides a powerful, parallel platform for quantum chemistry calculations that is directly integrated into the Maple 2019 environment.  It is optimized for both cutting-edge research as well as chemistry education.  The Toolbox can be used from the worksheet, document, or command-line interfaces.  Plus there is a Maplet interface for rapid exploration of molecules and their properties.  Figure 2 shows the Maplet interface being applied to compute the ground-state energy of 1,3-dibromobenzene by density functional theory (DFT) in a 6-31g basis set.           

    Fig. 2: Maplet interface to the Quantum Chemistry Toolbox 2019, showing a density functional theory (DFT) calculation         

    After entering a name into the text box labeled Name, the user can click on: (1) the button Web to import the geometry from an online database containing more than 96 million molecules,  (2) the button File to read the geometry from a standard XYZ file, or (3) the button Input to enter the geometry.  As soon the geometry is entered, the Maplet displays a 3D picture of the molecule in the window on the right of the options.  Dropdown menus allow the user to select the basis set, the electronic structure method, and a boolean for geometry optimization.  The user can click on the Compute button to perform the computation.  When the quantum computation completes, the total energy appears in the box labeled Total Energy.  The dropdown menu Analyze contains a list of data tables, plots, and animations that can be selected and then displayed by clicking the Analyze button.  The Maplet interface contains nearly all of the options available in the worksheet interface.   The Help Pages of the Toolbox include extensive curricula and lessons that can be used in undergraduate, graduate, and even high school chemistry courses.  Next we look at some sample calculations in the worksheet interface.     

     

    Reproducing an Early 2-RDM Calculation

     

    One of the earliest variational calculations of the 2-RDM was performed in 1975 by Garrod, Mihailović,  and  Rosina [1-3].  They minimized the electronic ground state of the 4-electron atom beryllium as a functional of only two electrons, the 2-RDM.  They imposed semidefinite constraints on the particle-particle (D), hole-hole (Q), and particle-hole (G) metric matrices.  They solved the resulting optimization problem of minimizing the energy as a linear function of the 2-RDM subject to the semidefinite constraints, known as a semidefinite program, by a cutting-plane algorithm.  Due to limitations of the cutting-plane algorithm and computers circa 1975, the calculation was a difficult one, likely taking a significant amount of computer time and memory.

     

    With the Quantum Chemistry Toolbox we can use the command Variational2RDM to reproduce the calculation on a Windows laptop.  First, in a Maple 2019 worksheet we load the commands of the Add-on Quantum Chemistry Toolbox:

    with(QuantumChemistry);

    [AOLabels, ActiveSpaceCI, ActiveSpaceSCF, AtomicData, BondAngles, BondDistances, Charges, ChargesPlot, CorrelationEnergy, CoupledCluster, DensityFunctional, DensityPlot3D, Dipole, DipolePlot, Energy, FullCI, GeometryOptimization, HartreeFock, Interactive, Isotopes, MOCoefficients, MODiagram, MOEnergies, MOIntegrals, MOOccupations, MOOccupationsPlot, MOSymmetries, MP2, MolecularData, MolecularGeometry, NuclearEnergy, NuclearGradient, Parametric2RDM, PlotMolecule, Populations, RDM1, RDM2, ReadXYZ, SaveXYZ, SearchBasisSets, SearchFunctionals, SkeletalStructure, Thermodynamics, Variational2RDM, VibrationalModeAnimation, VibrationalModes, Video]

    (1.1)

    Then we define the atom (or molecule) using a Maple list of lists that we assign to the variable atom:

    atom := [["Be",0,0,0]];

    [["Be", 0, 0, 0]]

    (1.2)

     

    We can then perform the variational 2-RDM method with the Variational2RDM command to compute the ground-state energy and properties of beryllium in a minimal basis set like the one used by Rosina and his collaborators.  By default the method uses the D, Q, and G N-representability conditions and the minimal "sto-3g" basis set.  The calculation, which completes in seconds, contains a wealth of information in the form of a convenient Maple table that we assign to the variable data.

    data := Variational2RDM(atom);

    table(%id = 18446744313704784158)

    (1.3)

     

    The table contains the total ground-state energy of the beryllium atom in the atomic unit of energy (hartrees)

    data[e_tot];

    HFloat(-14.40370016681039)

    (1.4)

     

    We also have the atomic orbitals (AOs) employed in the calculation

    data[aolabels];

    Vector(5, {(1) = "0 Be 1s", (2) = "0 Be 2s", (3) = "0 Be 2px", (4) = "0 Be 2py", (5) = "0 Be 2pz"})

    (1.5)

     

    as well as the Mulliken populations of these orbitals

    data[populations];

    Vector(5, {(1) = 1.9995807710723152, (2) = 1.7913484714571852, (3) = 0.6969023822632789e-1, (4) = 0.6969026475511847e-1, (5) = 0.6969029119010149e-1})

    (1.6)

     

    We see that 2 electrons are located in the 1s orbital, 1.8 electrons in the 2s orbital, and about 0.2 electrons in the 2p orbitals.  By default the calculation also returns the 1-RDM

    data[rdm1];

    Matrix(5, 5, {(1, 1) = 1.9999258249189755, (1, 2) = -0.37784860208539793e-2, (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (2, 1) = -0.37784860208539793e-2, (2, 2) = 1.7910034176105256, (2, 3) = 0., (2, 4) = 0., (2, 5) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0.6969023822632789e-1, (3, 4) = 0., (3, 5) = 0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 0.6969026475511847e-1, (4, 5) = 0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 0.6969029119010149e-1})

    (1.7)

     

    The eigenvalues of the 1-RDM are the natural orbital occupations

    LinearAlgebra:-Eigenvalues(data[rdm1]);

    Vector(5, {(1) = 1.9999941387490443+0.*I, (2) = 1.7909351037804568+0.*I, (3) = 0.6969023822632789e-1+0.*I, (4) = 0.6969026475511847e-1+0.*I, (5) = 0.6969029119010149e-1+0.*I})

    (1.8)

     

    We can display the density of the 2s-like 2nd natural orbital using the DensityPlot3D command providing the atom, the data, and the orbitalindex keyword

    DensityPlot3D(atom,data,orbitalindex=2);

     

     

    Similarly,  using the DensityPlot3D command, we can readily display the 2p-like 3rd natural orbital

    DensityPlot3D(atom,data,orbitalindex=3);

     

     

    By using Maple keyword arguments in the Variational2RDM command, we can readily change the basis set, use point-group symmetry, add active orbitals with or without self-consistent-field, change the N-representability conditions, as well as explore many other options.  Having reenacted one of the first variational 2-RDM calculations ever, let's examine a more complicated molecule.

     

    Explosive TNT

     

    We consider the molecule TNT that is used as an explosive. Using the command MolecularGeometry, we can import the experimental geometry of TNT from the online PubChem database.

    mol := MolecularGeometry("TNT");

    [["O", .5454, -3.514, 0.12e-2], ["O", .5495, 3.5137, 0.8e-3], ["O", 2.4677, -2.4539, -0.5e-3], ["O", 2.4705, 2.4513, 0.3e-3], ["O", -3.5931, -1.0959, 0.4e-3], ["O", -3.5922, 1.0993, 0.6e-3], ["N", 1.2142, -2.454, 0.2e-3], ["N", 1.217, 2.4527, 0], ["N", -2.9846, 0.15e-2, 0.1e-3], ["C", 1.2253, -0.6e-3, -0.9e-3], ["C", .5271, -1.2082, -0.8e-3], ["C", .5284, 1.2078, -0.8e-3], ["C", -1.5646, 0.8e-3, -0.4e-3], ["C", -.8678, -1.2074, -0.6e-3], ["C", -.8666, 1.2084, -0.6e-3], ["C", 2.7239, -0.16e-2, 0.11e-2], ["H", -1.4159, -2.1468, -0.3e-3], ["H", -1.4137, 2.1483, -0.3e-3], ["H", 3.1226, .2418, -.9891], ["H", 3.0863, .6934, .7662], ["H", 3.3154, -.8111, .4109]]

    (1.9)

     

    The command PlotMolecule generates a 3D ball-and-stick plot of the molecule

    PlotMolecule(mol);

     

     

    We perform a variational calculation of the 2-RDM of TNT in an active space of 10 electrons and 10 orbitals by setting the keyword active to the list [10,10].  The keyword casscf is set to true to optimize the active orbitals during the calculation.  The keyword basis is used to set the basis set to a minimal basis set sto-3g for illustration.   

    data := Variational2RDM(mol, active=[10,10], casscf=true, basis="sto-3g");

    table(%id = 18446744493271367454)

    (1.10)

     

    The ground-state energy of TNT in hartrees is

    data[e_tot];

    HFloat(-868.8629631593426)

    (1.11)

     

    Unlike beryllium, the electric dipole moment of TNT in debyes is nonzero

    data[dipole];

    Vector(3, {(1) = .5158925019252739, (2) = -0.5985274393363119e-1, (3) = .1277528280025474})

    (1.12)

     

    We can easily visualize the dipole moment relative to the molecule's ball-and-stick model with the DipolePlot command

    DipolePlot(mol,method=Variational2RDM, active=[10,10], casscf=true, basis="sto-3g");

     

     

    The 1-RDM is returned by default

    data[rdm1];

    _rtable[18446744313709602566]

    (1.13)

     

    The natural molecular-orbital (MO) occupations are the eigenvalues of the 1-RDM

    data[mo_occ];

    _rtable[18446744313709600150]

    (1.14)

     

    All of the occupations can be viewed at once by converting the Vector to a list

    convert(data[mo_occ], list);

    [HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(2.0), HFloat(1.9110133620349001), HFloat(1.8984139688344246), HFloat(1.6231436866358906), HFloat(1.6158489471020905), HFloat(1.6145310163161273), HFloat(0.38920731792133734), HFloat(0.387039366894289), HFloat(0.37786347287813526), HFloat(0.09734187094597906), HFloat(0.08559699476985069), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0), HFloat(0.0)]

    (1.15)

     

    We can visualize these occupations with the MOOccupationsPlot command

    MOOccupationsPlot(mol,method=Variational2RDM, active=[10,10], casscf=true, basis="sto-3g");

     

     

    The occupations, we observe, show significant deviations from 0 and 2, indicating that the electrons have substantial correlation beyond the mean-field (Hartree-Fock) limit.  The blue lines indicate the first N/2 spatial orbitals where N is the total number of electrons while the red lines indicate the remaining spatial orbitals.  We can visualize the highest "occupied" molecular orbital (58) with the DensityPlot3D command

    DensityPlot3D(mol,data, orbitalindex=58);

     

     

    Similarly, we can visualize the lowest "unoccupied" molecular orbital (59) with the DensityPlot3D command

    DensityPlot3D(mol,data, orbitalindex=59);

     

     

    Comparison of orbitals 58 and 59 reveals an increase in the number of nodes (changes in the phase of the orbitals denoted by green and purple), which reflects an increase in the energy of the orbital.

     

    Looking Ahead

     

    The Maple Quantum Chemistry Toolbox 2019, an new Add-on for Maple 2019 from RDMChem, provides a easy-to-use, research-grade environment for the computation of the energies and properties of atoms and molecules.  In this blog we discussed its origins in graduate research at Harvard, its reproduction of an early 2-RDM calculation of beryllium, and its application to the explosive molecule TNT.  We have illustrated only some of the many features and electronic structure methods of the Maple Quantum Chemistry package.  There is much more chemistry and physics to explore.  Enjoy!    

     

    Selected References

     

    [1] D. A. Mazziotti, Chem. Rev. 112, 244 (2012). "Two-electron Reduced Density Matrix as the Basic Variable in Many-Electron Quantum Chemistry and Physics"

    [2]  Reduced-Density-Matrix Mechanics: With Application to Many-Electron Atoms and Molecules (Adv. Chem. Phys.) ; D. A. Mazziotti, Ed.; Wiley: New York, 2007; Vol. 134.

    [3] A. J. Coleman and V. I. Yukalov, Reduced Density Matrices: Coulson’s Challenge (Springer-Verlag,  New York, 2000).

    [4] D. A. Mazziotti, Phys. Rev. Lett. 106, 083001 (2011). "Large-scale Semidefinite Programming for Many-electron Quantum Mechanics"

    [5] A. W. Schlimgen, C. W. Heaps, and D. A. Mazziotti, J. Phys. Chem. Lett. 7, 627-631 (2016). "Entangled Electrons Foil Synthesis of Elusive Low-Valent Vanadium Oxo Complex"

    [6] J. M. Montgomery and D. A. Mazziotti, J. Phys. Chem. A 122, 4988-4996 (2018). "Strong Electron Correlation in Nitrogenase Cofactor, FeMoco"

     

    Download QCT2019_PrimesV17_05.05.19.mw

    In this Post I derive the differential equations of motion of a homogeneous elliptic lamina of mass m and the major and minor axes of lengths of a and b which rolls without slipping along the horizontal x axis within the vertical xy plane.

    If the initial angular velocity is large enough, the ellipse will roll forever and go to ±∞ in the x direction, otherwise it will just rock.

    I have attached two files:

     rolling-ellipse.mw
            Worksheet to solve the differential equations and animate the motion

    rolling-ellipse.pdf
             Documentation containing the derivation of the differential equations

    And here are two animations extracted from the worksheet.

    I am a highschool teacher and we just started using Maple. It is a great program, but the students  had a few problems with the worksheet-mode in the editor. Here is a list of small problems that are hopefully easy to fix.

    In text editors such as Word you can highlight a piece of text and select "insert->equation" to turn the text into an equation. Maple doesn't supprt this, so if the students have written an equation in textmode, then they have trouble turning it into math-mode. (the answer is: highlight, ctrl-X, F5, ctrl-v but that is difficult to guess for beginners)

    Once in a while the students place two equations next to eachother with no space in between. When this happens they cannot place the cursor between the two eqations, and therefore they cannot place a newline between the equations. In other words the two equations are glued together. (I think that you can solve this by pressing f5 in the right place, but it would be better to mirror the behavior of word)

    It would be great to allow the user to delete the pink error messages by pressing delete. Sometimes the students use math mode to write text inside a large paragraph and the result is an error message a few lines below. This error message cannot be deleted unless you trace down the math field and delete it. In one situation a student had deleted all the letters in the math field, but the error message could not be deleted until the empty mathfield had been found and deleted. (One solution is to highlight all math fields on the page whenever the user is editing text in math mode. That would make them easier to find and understand)


    If a student pressed enter or alt-enter inside an equation in worksheet mode, then the student stays in worksheet mode after executing the equation. I would prefer to switch to text-mode after pressing enter. This would mirror the behavior of word. Sometimes the students end up writing a long paragraph because they expect Maple to mirror the behavior of word. Once the text has been written in math mode then it is difficult to convert it into textmode again (This requires highlight, ctrl-X, F5, ctrl-v)

    It would be great to write an equation that isn't meant to be executed by the kernel.  In other words the equation should only be for display. You can solve this by writing ":"  at theb end of the equation, but that makes the math look weird. It would be nice to have a way to do this.

    If mac users havent installed a printer then they cannot export to pdf. It would be great to solve this problem (or at least write a helpful error message)

    All of these problems are beginner problems, but if I you want to sell Maple in highschools then I think that you can gain from focusing on making Maple approachable so that the students have an early succes-story with the program. In my class we switched to Maple from another math program, and it was a hard sell because the other math program had an easier editor.

    While googling around for Season 8 spoilers, I found data sets that can be used to create a character interaction network for the books in the A Song of Ice and Fire series, and the TV show they inspired, Game of Thrones.

    The data sets are the work of Dr Andrew Beveridge, an associate professor at Macalaster College (check out his Network of Thrones blog).

    You can create an undirected, weighted graph using this data and Maple's GraphTheory package.

    Then, you can ask yourself really pressing questions like

    • Who is the most influential person in Westeros? How has their influence changed over each season (or indeed, book)?
    • How are Eddard Stark and Randyll Tarly connected?
    • What do eigenvectors have to do with the battle for the Iron Throne, anyway?

    These two applications (one for the TV show, and another for the novels) have the answers, and more.

    The graphs for the books tend to be more interesting than those for the TV show, simply because of the far broader range of characters and the intricacy of the interweaving plot lines.

    Let’s look at some of the results.

    This a small section of the character interaction network for the first book in the A Song of Ice and Fire series (this is the entire visualization - it's big, simply because of the shear number of characters)

    The graph was generated by GraphTheory:-DrawGraph (with method = spring, which models the graph as a system of protons repelling each other, connected by springs).

    The highlighted vertices are the most influential characters, as determined by their Eigenvector centrality (more on this later).

     

    The importance of a vertex can be described by its centrality, of which there are several variants.

    Eigenvector centrality, for example, is the dominant eigenvector of the adjacency matrix, and uses the number and importance of neighboring vertices to quantify influence.

    This plot shows the 15 most influential characters in Season 7 of the TV show Game of Thrones. Jon Snow is the clear leader.

    Here’s how the Eigenvector centrality of several characters change over the books in the A Song of Ice and Fire series.

    A clique is a group of vertices that are all connected to every other vertex in the group. Here’s the largest clique in Season 7 of the TV show.

    Game of Thrones has certainly motivated me to learn more about graph theory (yes, seriously, it has). It's such a wide, open field with many interesting real-world applications.

    Enjoy tinkering!

    1 2 3 4 5 6 7 Last Page 1 of 266