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
  • I am testing Maple 2020.2 with new Latex with Physics version latest 879.

    The latex generated now issues \! between the symbol and the () next to it to improve the spacing. This post is just to let anyone using the package mleftright in Latex, that this will cause a problem. So it is better to remove this package if you are allready using it.

    Here is an example

    eq:=y(x)=exp(x/2);
    Latex(eq)
    
                  y \! \left(x \right) = {\mathrm e}^{\frac{x}{2}}

    In earlier version of Physics:-Latex (now it is just Latex), the above generated this

                 y  \left(x \right) = {\mathrm e}^{\frac{x}{2}}

    Notice, no \! in earlier version.

    If you happen to be using \usepackage{mleftright} to improve the spacing for \left and \right, which I was using, you'll get negative side effect. A solution is to remove this package. Here is an example showing the above Latex compiled with this package added, and without it, so you can see the differerence.

    \documentclass[12pt]{book}
    \usepackage{amsmath} 
    \usepackage{mleftright}
    \mleftright
    \begin{document}
    
    With the package mleftright loaded
    
    which gives using latest Latex V 879. Maple 2020.2
    \[
      y \! \left(x \right) = {\mathrm e}^{\frac{x}{2}}
    \]
                
    And which gives using earlier Physics Latex. Using Maple 2020.1
    \[
      y \left(x \right) = {\mathrm e}^{\frac{x}{2}}
    \]
    \end{document}

    This is the output without using this package. by removing the inlcude command in the above Latex code and not calling mlfright. Now the problem is gone:

    I like the effect added from \! , which is a manual way to improve the space, which this package was doing.

    just be careful not to use mleftright package now, which is a somewhat popular package in latex and It was recommended to use sometime ago to improve the spacing, as it will over correct the spacing, and looks like not needed any more with latest Maple Latex.

     

     

    We have just released updates to Maple and MapleSim.

    Maple 2020.2 includes corrections and improvements to printing and export to PDF, support for macOS 11.0, more MATLAB connectivity, resolves issues with the installation of the Maplesoft Physics Updates, and more.  We recommend that all Maple 2020 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 2020.2 download page, where you can also find more details.

    If you are also a MapleSim user, this Maple update will be installed automatically when you update your MapleSim installation to the newly released MapleSim 2020.2. The MapleSim update also includes many updates to MapleSim, the MapleSim CAD Toolbox, specialized MapleSim libraries, MapleSim connectivity tools, and MapleSim Insight.  You will find details about new features and improvements, as well as instructions on obtaining the update, on the MapleSim 2020.2 page.


    One forum had a topic related to such a platform. You can download a video of the movement of this platform from the picture at this link. The manufacturer calls the three-degrees platform, that is, having three degrees of freedom. Three cranks rotate, and the platform is connected to them by connecting rods through ball joints. The movable beam (rocker arm) has torsion springs.  I counted 4 degrees of freedom, because when all three cranks are locked, the platform remains mobile, which is camouflaged by the springs of the rocker arm. Actually, the topic on the forum arose due to problems with the work of this platform. Neither the designers nor those who operate the platform take into account this additional fourth, so-called parasitic degree of freedom. Obviously, if we will to move the rocker with the locked  cranks , the platform will move.
    Based on this parasitic movement and a similar platform design, a very simple device is proposed that has one degree of freedom and is, in fact, a spatial linkage mechanism. We remove 3 cranks, keep the connecting rods, convert the rocker arm into a crank and get such movements that will not be worse (will not yield) to the movements of the platform with 6 degrees of freedom. And by changing the length of the crank, the plane of its rotation, etc., we can create simple structures with the required design trajectories of movement and one degree of freedom.
    Two examples (two pictures for each example). The crank rotates in the vertical plane (side view and top view)
    PLAT_1.mw


    and the crank rotates in the horizontal plane (side view and top view).

    The program consists of three parts. 1 choice of starting position, 2 calculation of the trajectory, 3 design of the picture.  Similar to the programm  in this topic.

     

     

    It would be useful if there was a category (or subcategory) of scientific domain (e.g. physics, methematics, economics...)  in which Maple is applied. Thus it would become very convinient for someone who have a question on a specific topic to find a possible answer. 

    I like how the Julia community has been organised in https://discourse.julialang.org, so I would suggest to implement something similar in Maple Primes

    When this question was asked here earlier, I neglected to suggest or to emphasize two further items.  Now, on revising Mathematics for Chemistry with [Maple], I recognise that I should have included these two objectives for inclusion in Maple 2021.

    - an extended and improved spreadsheet with symbolic capability; I suspect that Maple was the only software for symbolic computation to include such a facility, which sadly has become deprecated, for no obvious reason.

    - a much extended capability to solve integral equations; publications dating from 1976 -- i.e. before Maple! -- have shown what is possible; Maple's capabilities for differential equations might still be superior, although the competition is becoming close, so further efforts in the development of both differential and integral equations are timely and appropriate.  Related to differential equations is naturally the extension of capabilities of special functions, both to extend present functions and to produce new functions, such as those of Lame.

    I created a little procedure to automatically size text areas based on content. It sizes the text area based on wraparound and tab characters, something that the autosize for the code edit region does not do. (Hint to Maple developers)

    Enjoy.

        AutosizeTextArea:=proc(TextAreaName, {intMinRows::nonnegint:=5, intMinChars::nonnegint:=50, intMaxChars::nonnegint:=140})
            description "Autosizes the TextArea based on content",
                      "Parameters",
                      "1) TextAreaName__The name of the textarea",
                      "Optional Parameters",
                      "intMinRows________Minimum number of visible rows",
                      "intMinChars_______Minimum character width",
                      "intMaxChars_______Maximum character width";
            uses DocumentTools, StringTools;          
            local strLines, intLongestLine, nLines;
            strLines := Split(GetProperty(TextAreaName,'value'),"\n");
            intLongestLine := max('numelems'~(strLines));
            # Count the characters in each line (add 7 extra characters for each tab). Determine the number of lines to display each line due to wraparound, then add all these together
            #   to determine the number of rows to display.
            nLines := add(ceil~(('numelems'~(strLines) + StringTools:-CountCharacterOccurrences~(strLines, "\t")*~7)/~intMaxChars));
            SetProperty(TextAreaName, 'visibleRows', max(nLines, intMinRows), 'refresh' = true);
            SetProperty(TextAreaName, 'visibleCharacterWidth', min(max(intLongestLine, intMinChars),intMaxChars), 'refresh' = true);
        
        end proc:

    A fascinating race is presently running (even if the latest results seem  to have put an end to it).
    I'm talking of course about the US presidential elections.

    My purpose is not to do politics but to discuss of a point of detail that really left me puzzled: the possibility of an electoral college tie.
    I guess that this possibility seems as an aberration for a lot of people living in democratic countries. Just because almost everywhere at World electoral colleges contain an odd number of members to avoid such a situation!

    So strange a situation that I did a few things to pass the time (of course with the earphones on the head so I don't miss a thing).
    This is done with Maple 2015 and I believe that the amazing Iterator package (that I can't use thanks to the teleworking :-( ) could be used to do much more interesting things.

     

    restart:

    with(Statistics):

    ElectoralCollege := Matrix(51, 2, [

    Alabama,        9,        Kentucky,        8,        North_Dakota,        3,

    Alaska,        3,        Louisiana,        8,        Ohio,        18,

    Arizona,        11,        Maine,        4,        Oklahoma,        7,

    Arkansas,        6,        Maryland,        10,        Oregon,        7,

    California,        55,        Massachusetts,        11,        Pennsylvania,        20,

    Colorado,        9,        Michigan,        16,        Rhode_Island,        4,

    Connecticut,        7,        Minnesota,        10,        South_Carolina,        9,

    Delaware,        3,        Mississippi,        6,        South_Dakota,        3,

    District_of_Columbia,        3,        Missouri,        10,        Tennessee,        11,

    Florida,        29,        Montana,        3,        Texas,        38,

    Georgia,        16,        Nebraska,        5,        Utah,        6,

    Hawaii,        4,        Nevada,        6,        Vermont,        3,

    Idaho,        4,        New_Hampshire,        4,        Virginia,        13,

    Illinois,        20,        New_Jersey,        14,        Washington,        12,

    Indiana,        11,        New_Mexico,        5,        West_Virginia,        5,

    Iowa,        6,        New_York,        29,        Wisconsin,        10,

    Kansas,        6,        North_Carolina,        15,        Wyoming,        3
    ]):
     

    ElectoralCollege := Vector(4, {(1) = ` 51 x 2 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

    (1)

    add(ElectoralCollege[..,2]):
    tie := %/2;

    269

    (2)

    ec := convert(ElectoralCollege, listlist):

    # Sets of states that form an electoral college tie

    R      := 10^5:
    nbties := 0:
    states := NULL:
    for r from 1 to R do
      poll  := combinat:-randperm(ec):
      cpoll := CumulativeSum(op~(2, poll)):
      if tie in cpoll then
        nbties := nbties+1;
        place  := ListTools:-Search(tie, cpoll);
        states := states, op~(1, poll)[1..place]:   # see below
      end if:
    end do:

    # electoral college tie is not so rare an event
    # (prob of occurrence about 9.4 %).
    #
    # Why the hell the US constitution did not decide to have an odd
    # number or electors to avoid ths kind of situation instead of
    # introducing a complex mechanism when tie appears????

    nbties;
    evalf(nbties/R);

    states := [states]:

    9397

     

    0.9397000000e-1

    (3)

    # What states participate to the tie?

    names := sort(ElectoralCollege[..,1]):

    all_states_in_ties := [op(op~(states))]:

    howoften := Vector(
                        51,
                        i -> ListTools:-Occurrences(names[i], all_states_in_ties)
                ):

    ScatterPlot(Vector(51, i->i), howoften);

     

    # All the states seem to appear equally likely in an electoral college tie.
    # Why? Does someone have a guess?
    #
    # The reason is obvious, as each state must appear in the basket of a candidate,
    # then in case of a tie each state is either in op~(1, poll)[1..place] (candidate 1)
    # or either in op~(1, poll)[place+1..51] (candidate 2);
    # So, as we obtained 9397 ties, each states appears exactly 9397 times (with
    # different occurences in the baskets of candidate 1 and 2).

     

    # Lengths of the configurations that lead to a tie.
    #
    # Pleas refer to the answer above to understand why Histogram(lengths) should be
    # symmetric.
    lengths := map(i -> numelems(states[i]), [$1..nbties]):
    sort(Tally(lengths))

    [14 = 1, 15 = 2, 16 = 7, 17 = 36, 18 = 78, 19 = 179, 20 = 341, 21 = 507, 22 = 652, 23 = 849, 24 = 1015, 25 = 1041, 26 = 1056, 27 = 997, 28 = 862, 29 = 657, 30 = 515, 31 = 300, 32 = 158, 33 = 95, 34 = 41, 35 = 6, 36 = 2]

    (4)

    Histogram(lengths, range=min(lengths)..max(lengths), discrete=true)

     

    ShortestConfigurations := map(i -> if lengths[i]=min(lengths) then states[i] end if, [$1..nbties]):
    print~(ShortestConfigurations):

    [New_York, Wisconsin, Illinois, Kentucky, Florida, New_Jersey, Mississippi, Indiana, Virginia, Maryland, California, Massachusetts, North_Carolina, Texas]

    (5)

    LargestConfigurations := map(i -> if lengths[i]=max(lengths) then states[i] end if, [$1..nbties]):
    print~(LargestConfigurations):

    [Alaska, Tennessee, North_Carolina, South_Carolina, District_of_Columbia, Colorado, Minnesota, Georgia, South_Dakota, New_Hampshire, Wyoming, Ohio, Rhode_Island, Arizona, Delaware, Montana, West_Virginia, Vermont, Michigan, Kentucky, Louisiana, Arkansas, Maine, Missouri, New_Mexico, Virginia, Maryland, Oregon, Wisconsin, Iowa, Kansas, Connecticut, North_Dakota, Nevada, Hawaii, Oklahoma]

     

    [West_Virginia, Maryland, Massachusetts, Colorado, South_Dakota, Kentucky, Kansas, Wyoming, North_Dakota, Indiana, Michigan, Utah, Louisiana, Ohio, Alabama, Nebraska, Connecticut, Illinois, Oklahoma, Alaska, New_Jersey, District_of_Columbia, Oregon, Nevada, Missouri, Delaware, Washington, New_Hampshire, Arizona, Maine, South_Carolina, Hawaii, Vermont, Montana, Rhode_Island, Idaho]

    (6)

    # What could be the largest composition of a basket in case of a tie?
    # (shortest composition is the complementary of the largest one)

    ecs   := sort(ec, key=(x-> x[2]));
    csecs := CumulativeSum(op~(2, ecs)):

    # Where would the break locate?

    tieloc := ListTools:-BinaryPlace(csecs, tie);

    csecs[tieloc..tieloc+1]

    [[North_Dakota, 3], [Alaska, 3], [Delaware, 3], [South_Dakota, 3], [District_of_Columbia, 3], [Montana, 3], [Vermont, 3], [Wyoming, 3], [Maine, 4], [Rhode_Island, 4], [Hawaii, 4], [Idaho, 4], [New_Hampshire, 4], [Nebraska, 5], [New_Mexico, 5], [West_Virginia, 5], [Arkansas, 6], [Mississippi, 6], [Utah, 6], [Nevada, 6], [Iowa, 6], [Kansas, 6], [Oklahoma, 7], [Oregon, 7], [Connecticut, 7], [Kentucky, 8], [Louisiana, 8], [Alabama, 9], [Colorado, 9], [South_Carolina, 9], [Maryland, 10], [Minnesota, 10], [Missouri, 10], [Wisconsin, 10], [Arizona, 11], [Massachusetts, 11], [Tennessee, 11], [Indiana, 11], [Washington, 12], [Virginia, 13], [New_Jersey, 14], [North_Carolina, 15], [Michigan, 16], [Georgia, 16], [Ohio, 18], [Pennsylvania, 20], [Illinois, 20], [Florida, 29], [New_York, 29], [Texas, 38], [California, 55]]

     

    40

     

    Array(%id = 18446744078888202358)

    (7)

    # This 40  states coniguration is not a tie.
    #
    # But list all the states in basket of candidate 1 and look to the 41th state (which is
    # in the basket of candidate 2)

    ecs[1..tieloc];
    print():
    ecs[tieloc+1]

    [[North_Dakota, 3], [Alaska, 3], [Delaware, 3], [South_Dakota, 3], [District_of_Columbia, 3], [Montana, 3], [Vermont, 3], [Wyoming, 3], [Maine, 4], [Rhode_Island, 4], [Hawaii, 4], [Idaho, 4], [New_Hampshire, 4], [Nebraska, 5], [New_Mexico, 5], [West_Virginia, 5], [Arkansas, 6], [Mississippi, 6], [Utah, 6], [Nevada, 6], [Iowa, 6], [Kansas, 6], [Oklahoma, 7], [Oregon, 7], [Connecticut, 7], [Kentucky, 8], [Louisiana, 8], [Alabama, 9], [Colorado, 9], [South_Carolina, 9], [Maryland, 10], [Minnesota, 10], [Missouri, 10], [Wisconsin, 10], [Arizona, 11], [Massachusetts, 11], [Tennessee, 11], [Indiana, 11], [Washington, 12], [Virginia, 13]]

     

     

    [New_Jersey, 14]

    (8)

    # It appears that exchanging Virginia and New_Jersey increases by 1 unit the college of candidate 1
    # and produces a tie.

    LargestBasketEver := [ ecs[1..tieloc-1][], ecs[tieloc+1] ];

    add(op~(2, LargestBasketEver))

    [[North_Dakota, 3], [Alaska, 3], [Delaware, 3], [South_Dakota, 3], [District_of_Columbia, 3], [Montana, 3], [Vermont, 3], [Wyoming, 3], [Maine, 4], [Rhode_Island, 4], [Hawaii, 4], [Idaho, 4], [New_Hampshire, 4], [Nebraska, 5], [New_Mexico, 5], [West_Virginia, 5], [Arkansas, 6], [Mississippi, 6], [Utah, 6], [Nevada, 6], [Iowa, 6], [Kansas, 6], [Oklahoma, 7], [Oregon, 7], [Connecticut, 7], [Kentucky, 8], [Louisiana, 8], [Alabama, 9], [Colorado, 9], [South_Carolina, 9], [Maryland, 10], [Minnesota, 10], [Missouri, 10], [Wisconsin, 10], [Arizona, 11], [Massachusetts, 11], [Tennessee, 11], [Indiana, 11], [Washington, 12], [New_Jersey, 14]]

     

    269

    (9)

    # The largest electoral college tie contains 40 states (the shortest 11)


     

    Download ElectoralCollegeTie.mw

    Controlled platform with 6 degrees of freedom. It has three rotary-inclined racks of variable length:

    and an example of movement parallel to the base:

    Perhaps the Stewart platform may not reproduce such trajectories, but that is not the point. There is a way to select a design for those specific functions that our platform will perform. That is, first we consider the required trajectories of the platform movement, and only then we select a driving device that can reproduce them. For example, we can fix the extreme positions of the actuators during the movement of the platform and compare them with the capabilities of existing designs, or simulate your own devices.
    In this case, the program consists of three parts. (The text of the program directly for the first figure : PLATFORM_6.mw) In the first part, we select the starting point for the movement of a rigid body with six degrees of freedom. Here three equations f6, f7, f8 are responsible for the six degrees of freedom. The equations f1, f2, f3, f4, f5 define a trajectory of motion of a rigid body. The coordinates of the starting point are transmitted via disk E for the second part of the program. In the second part of the program, the trajectory of a rigid body is calculated using the Draghilev method. Then the trajectory data is transferred via the disk E for the third part of the program.
    In the third part of the program, the visualization is executed and the platform motion drive device is modeled.
    It is like a sketch of a possible way to create controlled platforms with six degrees of freedom. Any device that can provide the desired trajectory can be inserted into the third part. At the same time, it is obvious that the geometric parameters of the movement of this device with the control of possible emergency positions and the solution of the inverse kinematics problem can be obtained automatically if we add the appropriate code to the program text.
    Equations can be of any kind and can be combined with each other, and they must be continuously differentiable. But first, the equations must be reduced to uniform variables in order to apply the Draghilev method.
    (These examples use implicit equations for the coordinates of the vertices of the triangle.)

    In the study of the Gödel spacetime model, a tetrad was suggested in the literature [1]. Alas, upon entering the tetrad in question, Maple's Tetrad's package complained that that matrix was not a tetrad! What went wrong? After an exchange with Edgardo S. Cheb-Terrab, Edgardo provided us with awfully useful comments regarding the use of the package and suggested that the problem together with its solution be presented in a post, as others may find it of some use for their work as well.

     

    The Gödel spacetime solution to Einsten's equations is as follows.

     

    Physics:-Version()

    `The "Physics Updates" version in the MapleCloud is 858 and is the same as the version installed in this computer, created 2020, October 27, 10:19 hours Pacific Time.`

    (1)

    with(Physics); with(Tetrads)

    _______________________________________________________

     

    `Setting `*lowercaselatin_ah*` letters to represent `*tetrad*` indices`

     

    ((`Defined as tetrad tensors `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*`&efr;`[a, mu]*`, `)*eta[a, b]*`, `*gamma[a, b, c]*`, `)*lambda[a, b, c]

     

    ((`Defined as spacetime tensors representing the NP null vectors of the tetrad formalism `*`see <a href='http://www.maplesoft.com/support/help/search.aspx?term=Physics,tetrads`*`,' target='_new'>?Physics,tetrads`*`,</a> `*l[mu]*`, `)*n[mu]*`, `*m[mu]*`, `)*conjugate(m[mu])

     

    _______________________________________________________

    (2)

    Working with Cartesian coordinates,

    Coordinates(cartesian)

    `Systems of spacetime coordinates are:`*{X = (x, y, z, t)}

     

    {X}

    (3)

    the Gödel line element is

     

    ds^2 = d_(t)^2-d_(x)^2-d_(y)^2+(1/2)*exp(2*q*y)*d_(z)^2+2*exp(q*y)*d_(z)*d_(t)

    ds^2 = Physics:-d_(t)^2-Physics:-d_(x)^2-Physics:-d_(y)^2+(1/2)*exp(2*q*y)*Physics:-d_(z)^2+2*exp(q*y)*Physics:-d_(z)*Physics:-d_(t)

    (4)

    Setting the metric

    Setup(metric = rhs(ds^2 = Physics[d_](t)^2-Physics[d_](x)^2-Physics[d_](y)^2+(1/2)*exp(2*q*y)*Physics[d_](z)^2+2*exp(q*y)*Physics[d_](z)*Physics[d_](t)))

    _______________________________________________________

     

    `Coordinates: `*[x, y, z, t]*`. Signature: `*`- - - +`

     

    _______________________________________________________

     

    Physics:-g_[mu, nu] = Matrix(%id = 18446744078354506566)

     

    _______________________________________________________

     

    `Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

     

    [metric = {(1, 1) = -1, (2, 2) = -1, (3, 3) = (1/2)*exp(2*q*y), (3, 4) = exp(q*y), (4, 4) = 1}, spaceindices = lowercaselatin_is]

    (5)

    The problem appeared upon entering the matrix M below supposedly representing the alleged tetrad.

    interface(imaginaryunit = i)

    M := Matrix([[1/sqrt(2), 0, 0, 1/sqrt(2)], [-1/sqrt(2), 0, 0, 1/sqrt(2)], [0, 1/sqrt(2), -I*exp(-q*y), I], [0, 1/sqrt(2), I*exp(-q*y), -I]])

    Matrix(%id = 18446744078162949534)

    (6)

    Each of the rows of this matrix is supposed to be one of the null vectors [l, n, m, conjugate(m)]. Before setting this alleged tetrad, Maple was asked to settle the nature of it, and the answer was that M was not a tetrad! With the Physics Updates v.857, a more detailed message was issued:

    IsTetrad(M)

    `Warning, the given components form a`*null*`tetrad, `*`with a contravariant spacetime index`*`, only if you change the signature from `*`- - - +`*` to `*`+ - - -`*`. 
You can do that by entering (copy and paste): `*Setup(signature = "+ - - -")

     

    false

    (7)

    So there were actually three problems:

    1. 

    The entered entity was a null tetrad, while the default of the Physics package is an orthonormal tetrad. This can be seen in the form of the tetrad metric, or using the library commands:

    eta_[]

    Physics:-Tetrads:-eta_[a, b] = Matrix(%id = 18446744078354552462)

    (8)

    Library:-IsOrthonormalTetradMetric()

    true

    (9)

    Library:-IsNullTetradMetric()

    false

    (10)
    2. 

    The matrix M would only be a tetrad if the spacetime index is contravariant. On the other hand, the command IsTetrad will return true only when M represents a tetrad with both indices covariant. For  instance, if the command IsTetrad  is issued about the tetrad automatically computed by Maple, but is passed the matrix corresponding to "`&efr;`[a]^(mu)"  with the spacetime index contravariant,  false is returned:

    "e_[a,~mu, matrix]"

    Physics:-Tetrads:-e_[a, `~&mu;`] = Matrix(%id = 18446744078297840926)

    (11)

    "IsTetrad(rhs(?))"

    Typesetting[delayDotProduct](`Warning, the given components form a`*orthonormal*`tetrad only if the spacetime index is contravariant. 
You can construct a tetrad with a covariant spacetime index by entering (copy and paste): `, Matrix(4, 4, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = sqrt(2)*exp(-q*y), (3, 4) = -sqrt(2), (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1}), true).rhs(g[])

     

    false

    (12)
    3. 

    The matrix M corresponds to a tetrad with different signature, (+---), instead of Maple's default (---+). Although these two signatures represent the same physics, they differ in the ordering of rows and columns: the timelike component is respectively in positions 1 and 4.

     

    The issue, then, became how to correct the matrix M to be a valid tetrad: either change the setup, or change the matrix M. Below the two courses of action are provided.

     

    First the simplest: change the settings. According to the message (7), setting the tetrad to be null, changing the signature to be (+---) and indicating that M represents a tetrad with its spacetime index contravariant would suffice:

    Setup(tetradmetric = null, signature = "+---")

    [signature = `+ - - -`, tetradmetric = {(1, 2) = 1, (3, 4) = -1}]

    (13)

    The null tetrad metric is now as in the reference used.

    eta_[]

    Physics:-Tetrads:-eta_[a, b] = Matrix(%id = 18446744078298386174)

    (14)

    Checking now with the spacetime index contravariant

    e_[a, `~&mu;`] = M

    Physics:-Tetrads:-e_[a, `~&mu;`] = Matrix(%id = 18446744078162949534)

    (15)

    At this point, the command IsTetrad  provided with the equation (15), where the left-hand side has the information that the spacetime index is contravariant

    "IsTetrad(?)"

    `Type of tetrad: `*null

     

    true

    (16)

    Great! one can now set the tetrad M exactly as entered, without changing anything else. In the next line it will only be necessary to indicate that the spacetime index, mu, is contravariant.

    Setup(e_[a, `~&mu;`] = M, quiet)

    [tetrad = {(1, 1) = -(1/2)*2^(1/2), (1, 3) = (1/2)*2^(1/2)*exp(q*y), (1, 4) = (1/2)*2^(1/2), (2, 1) = (1/2)*2^(1/2), (2, 3) = (1/2)*2^(1/2)*exp(q*y), (2, 4) = (1/2)*2^(1/2), (3, 2) = -(1/2)*2^(1/2), (3, 3) = ((1/2)*I)*exp(q*y), (3, 4) = 0, (4, 2) = -(1/2)*2^(1/2), (4, 3) = -((1/2)*I)*exp(q*y), (4, 4) = 0}]

    (17)

     

    The tetrad is now the matrix M. In addition to checking this tetrad making use of the IsTetrad command, it is also possible to check the definitions of tetrads and null vectors using TensorArray.

    e_[definition]

    Physics:-Tetrads:-e_[a, `&mu;`]*Physics:-Tetrads:-e_[b, `~&mu;`] = Physics:-Tetrads:-eta_[a, b]

    (18)

    TensorArray(Physics:-Tetrads:-e_[a, `&mu;`]*Physics:-Tetrads:-e_[b, `~&mu;`] = Physics:-Tetrads:-eta_[a, b], simplifier = simplify)

    Matrix(%id = 18446744078353048270)

    (19)

    For the null vectors:

    l_[definition]

    Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-l_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[`~mu`] = 1, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-mb_[`~mu`] = 0, Physics:-g_[mu, nu] = Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]+Physics:-Tetrads:-l_[nu]*Physics:-Tetrads:-n_[mu]-Physics:-Tetrads:-m_[mu]*Physics:-Tetrads:-mb_[nu]-Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-mb_[mu]

    (20)

    TensorArray([Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-l_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[`~mu`] = 1, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-m_[`~mu`] = 0, Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-mb_[`~mu`] = 0, Physics[g_][mu, nu] = Physics:-Tetrads:-l_[mu]*Physics:-Tetrads:-n_[nu]+Physics:-Tetrads:-l_[nu]*Physics:-Tetrads:-n_[mu]-Physics:-Tetrads:-m_[mu]*Physics:-Tetrads:-mb_[nu]-Physics:-Tetrads:-m_[nu]*Physics:-Tetrads:-mb_[mu]], simplifier = simplify)

    [0 = 0, 1 = 1, 0 = 0, 0 = 0, Matrix(%id = 18446744078414241910)]

    (21)

    From its Weyl scalars, this tetrad is already in the canonical form for a spacetime of Petrov type "D": only `&Psi;__2` <> 0

    PetrovType()

    "D"

    (22)

    Weyl[scalars]

    psi__0 = 0, psi__1 = 0, psi__2 = -(1/6)*q^2, psi__3 = 0, psi__4 = 0

    (23)

    Attempting to transform it into canonicalform returns the tetrad (17) itself

    TransformTetrad(canonicalform)

    Matrix(%id = 18446744078396685478)

    (24)

    Let's now obtain the correct tetrad without changing the signature as done in (13).

    Start by changing the signature back to "(- - - +)"

    Setup(signature = "---+")

    [signature = `- - - +`]

    (25)

    So again, M is not a tetrad, even if the spacetime index is specified as contravariant.

    IsTetrad(e_[a, `~&mu;`] = M)

    `Warning, the given components form a`*null*`tetrad, `*`with a contravariant spacetime index`*`, only if you change the signature from `*`- - - +`*` to `*`+ - - -`*`. 
You can do that by entering (copy and paste): `*Setup(signature = "+ - - -")

     

    false

    (26)

    By construction, the tetrad M has its rows formed by the null vectors with the ordering [l, n, m, conjugate(m)]. To understand what needs to be changed in M, define those vectors, independent of the null vectors [l_, n_, m_, mb_] (with underscore) that come with the Tetrads package.

    Define(l[mu], n[mu], m[mu], mb[mu], quiet)

    and set their components using the matrix M taking into account that its spacetime index is contravariant, and equating the rows of M  using the ordering [l, n, m, conjugate(m)]:

    `~`[`=`]([l[`~&mu;`], n[`~&mu;`], m[`~&mu;`], mb[`~&mu;`]], [seq(M[j, 1 .. 4], j = 1 .. 4)])

    [l[`~&mu;`] = Vector[row](%id = 18446744078368885086), n[`~&mu;`] = Vector[row](%id = 18446744078368885206), m[`~&mu;`] = Vector[row](%id = 18446744078368885326), mb[`~&mu;`] = Vector[row](%id = 18446744078368885446)]

    (27)

    "Define(op(?))"

    `Defined objects with tensor properties`

     

    {Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-Tetrads:-e_[a, mu], Physics:-Tetrads:-eta_[a, b], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Tetrads:-gamma_[a, b, c], l[mu], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-lambda_[a, b, c], m[mu], Physics:-Tetrads:-m_[mu], mb[mu], Physics:-Tetrads:-mb_[mu], n[mu], Physics:-Tetrads:-n_[mu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

    (28)

    Check the covariant components of these vectors towards comparing them with the lines of the Maple's tetrad `&efr;`[a, mu]

    l[], n[], m[], mb[]

    l[mu] = Array(%id = 18446744078298368710), n[mu] = Array(%id = 18446744078298365214), m[mu] = Array(%id = 18446744078298359558), mb[mu] = Array(%id = 18446744078298341734)

    (29)

    This shows the [l_, n_, m_, mb_] null vectors (with underscore) that come with Tetrads package

    e_[nullvectors]

    Physics:-Tetrads:-l_[mu] = Vector[row](%id = 18446744078354520414), Physics:-Tetrads:-n_[mu] = Vector[row](%id = 18446744078354520534), Physics:-Tetrads:-m_[mu] = Vector[row](%id = 18446744078354520654), Physics:-Tetrads:-mb_[mu] = Vector[row](%id = 18446744078354520774)

    (30)

    So (29) computed from M is the same as (30) computed from Maple's tetrad.

    But, from (30) and the form of Maple's tetrad

    e_[]

    Physics:-Tetrads:-e_[a, mu] = Matrix(%id = 18446744078297844182)

    (31)

    for the current signature

    Setup(signature)

    [signature = `- - - +`]

    (32)

    we see the ordering of the null vectors is [n, m, mb, l], not [l, n, m, mb] used in [1] with the signature (+ - - -). So the adjustment required in  M, resulting in "M^( ')", consists of reordering M's rows to be [n, m, mb, l]

    `#msup(mi("M"),mrow(mo("&InvisibleTimes;"),mo("&apos;")))` := simplify(Matrix(4, map(Library:-TensorComponents, [n[mu], m[mu], mb[mu], l[mu]])))

    Matrix(%id = 18446744078414243230)

    (33)

    IsTetrad(`#msup(mi("M"),mrow(mo("&InvisibleTimes;"),mo("&apos;")))`)

    `Type of tetrad: `*null