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
  • Vector using package Physics, LinearAlgebra.

    Vectores.mw     (in spanish)

    I was recently asked about performing some General Relativity computations from a paper by Plamen Fiziev, posted in the arXiv in 2013. It crossed my mind that this question is also instrumental to illustrate how these General Relativity algebraic computations can be performed using the Physics package. The pdf and mw links at the end show the same contents but with the Sections expanded.

     

    General Relativity using Computer Algebra

     

    Problem: for the spacetime metric,

    g[mu, nu] = (Matrix(4, 4, {(1, 1) = -exp(lambda(r)), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = exp(nu(r))}))

     

    a) Compute the trace of

     

    "Z[alpha]^(beta)=Phi R[alpha]^(beta)+`𝒟`[alpha]`𝒟`[]^(beta) Phi+T[alpha]^(beta)"

     

    where `≡`(Phi, Phi(r)) is some function of the radial coordinate, R[alpha, `~beta`] is the Ricci tensor, `𝒟`[alpha] is the covariant derivative operator and T[alpha, `~beta`] is the stress-energy tensor

     

    T[alpha, beta] = (Matrix(4, 4, {(1, 1) = 8*exp(lambda(r))*Pi, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 8*r^2*Pi, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 8*r^2*sin(theta)^2*Pi, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 8*exp(nu(r))*Pi*epsilon}))

    b) Compute the components of "W[alpha]^(beta)"" ≡"the traceless part of  "Z[alpha]^(beta)" of item a)

     

    c) Compute an exact solution to the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)" obtained in b)

     

    Background: The equations of items a) and b) appear in a paper from February/2013, "Withholding Potentials, Absence of Ghosts and Relationship between Minimal Dilatonic Gravity and f(R) Theories", by Plamen Fiziev, a Maple user.  These equations model a problem in the context of a Branse-Dicke theory with vanishing parameter "omega." The Brans–Dicke theory is in many respects similar to Einstein's theory, but the gravitational "constant" is not actually presumed to be constant - it can vary from place to place and with time - and the gravitational interaction is mediated by a scalar field. Both Brans–Dicke's and Einstein's theory of general relativity are generally held to be in agreement with observation.

     

    The computations below aim at illustrating how this type of computation can be performed using computer algebra, and so they focus only on the algebraic aspects, not the physical interpretation of the results.

    a) The trace of "  Z[alpha]^(beta)=Phi R[alpha]^(beta)+`𝒟`[alpha]`𝒟`[]^(beta) Phi+T[alpha]^(beta)"

       

    b) The components of "W[alpha]^(beta)"" ≡"the traceless part of " Z[alpha]^(beta)"

       

    c) An exact solution for the nonlinear system of differential equations conformed by the components of  "W[alpha]^(beta)"

       

     

    GeneralRelativit.pdf    GeneralRelativity.mw

    Edgardo S. Cheb-Terrab 
    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    Code of the animation:

    restart;

    N := 192:

    A := seq(plot([[.85*sin(t)^3-2+1.25*i/N, .85*(13*cos(t)*(1/15)-(1/3)*cos(2*t)-2*cos(3*t)*(1/15)-(1/15)*cos(4*t)), t = 0 .. Pi*i/N], [-.85*sin(t)^3-2+1.25*i/N, .85*(13*cos(t)*(1/15)-(1/3)*cos(2*t)-2*cos(3*t)*(1/15)-(1/15)*cos(4*t)), t = 0 .. Pi*i/N], [sin(t)^3+2-1.25*i/N, 13*cos(t)*(1/15)-(1/3)*cos(2*t)-2*cos(3*t)*(1/15)-(1/15)*cos(4*t), t = 0 .. Pi*i/N], [-sin(t)^3+2-1.25*i/N, 13*cos(t)*(1/15)-(1/3)*cos(2*t)-2*cos(3*t)*(1/15)-(1/15)*cos(4*t), t = 0 .. Pi*i/N]], color = red, thickness = 5, view = [-3 .. 3, -1.2 .. .9]), i = 1 .. N):

    plots[display](A, insequence = true, scaling = constrained, axes = none);

    Dear Bryon and Will:

    Please fix MaplePrimes so that the Replies to Answers to Questions appear in chronological order under their respective Answers. Currently they appear in a somewhat random and changing order when their are several Replies. This has been a problem since the last "upgrade" to MaplePrimes.

    Another persistent problem since that upgrade is that about half of the time that someone tries to attach a file, the file does not actually attach, even though the editor gives every indication that it has attached, and a hyperlink even appears in the post.

    People are starting to leave MaplePrimes because of these problems.

    Thank you for your attention to these matters,
    Carl Love

    Congratulations to Andriy Andrusyk, from the Institute for Condensed Matter Physics of the National Academy of Sciences of Ukraine, who won last quarter’s Möbius Challenge with his application Heat Equation.  Dr. Andrusyk won a DSLR Camera Prize Pack.

    Remember that you have until Mar. 31 to enter your Möbius Apps for a chance to win the next prize, an Xbox One!   Visit Möbius App Challenge for full contest details.

     

    eithne


    This post is an index page for reading the Parallel Programming blog posts.

    I thought it would be interesting to review what happened with Physics in Maple during 2013. The proposed theme for the Physics project was the consolidation and integration of the package with the rest of the Maple library. There were more than 500 changes, enhancements in most of the Physics commands, plus 17 new Physics:-Library commands. The impact of these changes is across the board, from Vector Analysis to Quantum Mechanics, Relativity and Field Theory.

    Consolidation of the Physics package is about making it robust and versatile in real case scenarios. With the launch of the Physics: Research and Development updates webpage, Maplesoft has pioneered feedback, adjustments in the package and new developments provided around the clock for all of its users. The result of this accelerated exchange with people around the world is what you find in Maple's updated Physics today.

    In addition to changes improving the functionality in mathematical-physics, changes were introduced towards making the computational experience as natural as possible, now including textbook-like typesetting of inert forms for the whole mathematical language and vectorial differential operators.

    Physics doubled in size in Maple 16, almost doubled again in Maple 17, and during 2013 Physics received the largest number of changes ever in the package in one year. We are aiming for real to provide a state-of-the-art environment for algebraic computations in Physics. The links at the end show the same but with the Examples sections expanded.

    Simplify

     

    Simplification is perhaps the most common operation performed in a computer algebra system. In Physics, this typically entails simplifying tensorial expressions, or expressions involving noncommutative operators that satisfy certain commutator/anticommutator rules, or sums and integrals involving quantum operators and Dirac delta functions in the summands and integrands. Relevant enhancements were introduced for all these cases.

    Examples

       

    4-Vectors, Substituting Tensors

     

    In Maple 17, it is possible to define a tensor with a tensorial equation, where the tensor being defined is on the left-hand side. Then, on the right-hand side, you write either a tensorial expression with free and repeated indices, or a Matrix or Array with the components themselves. With the updated Physics, you can also define a 4-Vector with a tensorial equation, where you indicate the vector's components on the right-hand side as a list.

    One new Library routine specialized for tensor substitutions was added to the Maple library: SubstituteTensor, which substitutes the equation(s) Eqs into an expression, taking care of the free and repeated indices, such that: 1) equations in Eqs are interpreted as mappings having the free indices as parameters, and 2) repeated indices in Eqs do not clash with repeated indices in the expression. This new routine can also substitute algebraic sub-expressions of type product or sum within the expression, generalizing and unifying the functionality of the subs and algsubs  commands for algebraic tensor expressions.

    Examples

       

    Functional Differentiation

     

    The Physics:-Fundiff command for functional differentiation has been extended to handle all the complex components ( abs , argument , conjugate , Im , Re , signum ) and vectorial differential operators in order to compute field equations using variational principles when the field function enters the Lagrangian together with its conjugate. For an example illustrating the use of the new capabilities in the context of a more general problem, see the MaplePrimes post Quantum Mechanics using Computer Algebra.

    Examples

       

    More Metrics in the Database of Solutions to Einstein's Equations

     

    A database of solutions to Einstein's equations  was added to the Maple library in Maple 15 with a selection of metrics from "Stephani, H.; Kramer, D.; MacCallum, M.; Hoenselaers, C.; and Herlt, E.,  Exact Solutions to Einstein's Field Equations" and "Hawking, Stephen; and Ellis, G. F. R., The Large Scale Structure of Space-Time". More metrics from these two books were added for Maple 16 and Maple 17. These metrics can be searched using the command DifferentialGeometry:-Library:-MetricSearch, or directly using g_ (the Physics command representing the spacetime metric that also sets the metric to your choice).

    • 

    With the updated Physics, fifty more metrics are available in the database from Chapter 28 of the aformentioned book entitled "Exact Solutions to Einstein's Field Equations".

    • 

    It is now possible to list all the metrics of a chapter by indexing the metric command with the chapter's number, for example, entering g_["28"].

    Examples

       

    Commutators, AntiCommutators

     

    When computing with products of noncommutative operators, the results depend on the algebra of commutators and anticommutators that you previously set. Besides that, in Physics, various mathematical objects themselves satisfy specific commutation rules. You can query about these rules using the Library commands Commute and Anticommute. Previously existing functionality and enhancements in this area were refined and implemented during 2013. Among them:

    • 

    Both Commutator and AntiCommutator now accept matrices as arguments.

    • 

    The AntiCommutator of products of fermionic operators - for instance annihilation and creation operators - is now derived automatically from the intrinsic anticommutation rules they satisfy.

    • 

    Commutators and Anticommutators of vectorial quantum operators `#mover(mi("A",mathcolor = "olive"),mo("→"))`, `#mover(mi("B",mathcolor = "olive"),mo("→"))`, are now implemented and expressed using the dot (scalar) product, as in Physics:-Commutator(`#mover(mi("A",mathcolor = "olive"),mo("→"))`, `#mover(mi("B",mathcolor = "olive"),mo("→"))`) = `#mover(mi("A",mathcolor = "olive"),mo("→"))`.`#mover(mi("B",mathcolor = "olive"),mo("→"))`-`#mover(mi("B",mathcolor = "olive"),mo("→"))`.`#mover(mi("A",mathcolor = "olive"),mo("→"))`

    • 

    If two noncommutative operators a and S  satisfy "[a^(†),S][-]=0" , then the commutator  "[a,S^(†)][-]" is automatically taken equal to 0; if in addition S is Hermitian, then  "[a,S][-]"is also automatically taken equal to zero.

    Examples

       

    Expand and Combine

     

    In the context of Physics, the expansion and recombination of algebraic expressions requires additional care: products may involve non-commutative operators and then some of the standard expansion and combination rules do not apply, or apply differently. Similarly, the expansion of vectorial operators also follows special rules. During 2013, many of these algebraic operations were reviewed and related special formulas (such as Glauber's and Haussdorf's) were implemented.

    Examples

       

    New Enhanced Modes in Physics Setup

     

    Four enhanced modes were added to the Physics setup. With these modes, you can:

    1. 

    Indicate the real objects of a computation.

    2. 

    Automatically combine powers of the same base.

    3. 

    Set Maple to take z and its conjugate, "z," as independent variables and in equal footing; this is Wirtinger calculus.

    4. 

    Redefine the sum command in order to perform multi-index summation.

    These options combined provide flexibility, subsequently making the Physics environment more expressive.

    Real Objects

       

    Combining Powers of the Same Base

       

    Complex variables: z and conjugate(z) in equal footing

       

    Redefine Sum for Multi-Index Summation

       

    Dagger

     

    Physics:-Dagger now has the same shortcut notation of Hermitian transpose , which acts on Vectors, vector products, equations, and automatically maps over the arguments of derivatives when the differentiation variables are real.

    Examples

       

    Vectors Package

     

    A number of changes were performed in the Vectors subpackage to make the computations more natural and versatile:

    • 

    You can now use geometrical coordinates indexed, as in r[j], to represent mathematical objects unrelated to the coordinates themselves (in this case the spherical coordinate r).  This is a more appropriate mimicry of the way we compute with paper and pencil.

    • 

    Integrate the Vectors package commands with assuming and accept a tensor with 1 index (of type Library:-PhysicsType:-Tensor, defined using Define) as a possible abstract representation of the kth component of a vector.

    • 

    When V is a vector of the Physics:-Vectors package, make its absolute value abs(V), compute automatically using Physics:-Vectors:-Norm

    • 

    For an arbitrary vector  `#mover(mi("A"),mo("→"))`, make its Norm LinearAlgebra[Norm](`#mover(mi("A"),mo("→"))`) = "A*(A)," and introduce a new option conjugate to Norm, to specify whether to use `#mover(mi("A"),mo("→"))`.conjugate(`#mover(mi("A"),mo("→"))`) or `#mover(mi("A"),mo("→"))`.`#mover(mi("A"),mo("→"))` when computing LinearAlgebra[Norm](`#mover(mi("A"),mo("→"))`).

    • 

    When `#mover(mi("A",mathcolor = "olive"),mo("→"))` is a quantum operator, Norm returns using Dagger instead of conjugate.

    • 

    Commutators and Anticommutators of vectorial quantum operators `#mover(mi("A",mathcolor = "olive"),mo("→"))`, `#mover(mi("B",mathcolor = "olive"),mo("→"))`, are now implemented and expressed using the dot (scalar) product, as in "[A,B][-]=A*B-B*A . "

    • 

    New PhysicsVectors type in the Library of types Library:-PhysicsTypes, in order to programmatically identify vectors of the Physics:-Vectors package.

     

    Two examples illustrating the use of the new capabilities in the context of a more general problem are found in the MaplePrimes posts Quantum Mechanics using Computer Algebra and Quantum Mechanics (II).

    Examples

       

    Library

     

    Seventeen new commands, useful for programming and interactive computation, were added to the Physics:-Library package. These are:

    • 

    Add unifies the standard add and sum commands using a more modern handling of arguments, free of premature evaluation problems, and brings new multi-index functionality.

    • 

    ApplyCommandUsingImplicitAssumptions applies any command to expressions containing sums, integrals or products such that the command is applied to the summand (integrand or 1st argument of the product) taking into account the assumptions implicit in the summation (integration or product) range.

    • 

    CombinePowersOfSameBase combines powers of the same base in products correctly handling the case of noncommutative products and powers, using Glauber's formula.

    • 

    FromTensorFunctionalForm is a generalization of the former FromGeneralRelativityTensorFunctionalForm command, that also handles user defined tensor functions.

    • 

    GetFAndDifferentiationVariables receives a derivative and returns a sequence with derivand and all the differentiation variables.

    • 

    GetReplacementIndices receives a list of indices of different kinds (spacetime, space, spinor, etc) and any other arguments and returns a list with new indices of the same kinds - useful for replacements - not present in the rest of the arguments.

    • 

    GetSymbolsWithSameType receives an expression x, of type commutative, anticommutative or noncommutative, and any other arguments, and returns symbols of the same type as x, and not present in the rest of arguments.

    • 

    GetTensorDependency gets the dependency of a given tensor; this dependency typically depends of the spacetime metric or on the way you defined the tensor using Define.

    • 

    GetTensorFunctionalForm is a generalization of the former GetGeneralRelativityTensorFunctionalForm command, that also handles user defined tensor functions.

    • 

    IsLiteralSubscript returns true or false according to whether a symbol s is of the form x__y, that is, it has the substring __ after the first or next characters and before the last one.

    • 

    IsRealObject returns true or false according to whether a mathematical expression, function or variable passed is known to be real, either because it was assumed to be real, or because it was set to be real using Setup and its realobjects keyword.

    • 

    RealObjects sets and unsets mathematical variables and functions as real, and answers queries about them.

    • 

    SortProducts sorts the operands of noncommutative products into any particular desired ordering while taking into account commutator and anticommutator algebra rules, such that the returned product is mathematically equivalent to the one received.

    • 

    SubstituteTensor substitutes equations into an expression, taking care of the free and repeated indices such that: 1) the substitution equations are interpreted as mappings having the free indices as parameters, and 2) repeated indices in the substitution equations do not clash with existing repeated indices in the target expression.

    • 

    ToContravariant and ToCovariant rewrite a given expression multiplying by the spacetime metric so that all of its free indices become respectively contravariant or covariant.

    • 

    ToTensorFunctionalForm reverses the operation performed by the new FromTensorFunctionalForm described above.

    Examples

       

    Miscellaneous

     
    • 

    Implement formulas for abstract k, n both nonnegint entering "`a+`^k*| A[n] >" and "a(-)^k*| A[n] >", where `a+` and "a-" are Creation and Annihilation operators, respectively, acting on the 1st quantum number of the space of quantum states labeled A.

    • 

    Implement new PDEtools:-dchange rules for changing variables in Bras Kets and Brackets of the Physics package

    • 

    Library:-Degree can now compute the degree for noncommutative products Enhance PDEtools:-Library:-Degree and PDEtools:-Coefficients, to work with Physics:-`.` the same way it does with Physics:-`*`

    • 

    Changes in design:

    a. 

    When the spacetime is Euclidean, there is no difference in value between the covariant and contravariant components of a tensor. Therefore, represent both with covariant indices making simplification and all manipulations simpler. This change affects the display of indices on the screen as well as the output of SumOverRepeatedIndices.

    b. 

    The dot product A . B of quantum operators A and B now returns as a (noncommutative) product  A * B when neither A nor B involve Bras or Kets.

    c. 

    When A is a quantum operator (generic, Hermitian or unitary), the literal subscript object A__x is now considered an operator of the same kind.

    d. 

    Normal normalizes powers of the same base (including exponentials) by combining them. For example, A^n*A^m "->A^(n+m)."

    e. 

    Normal normalizes noncommutative products by sorting objects that commute between themselves putting those that involve Dagger and conjugate to the left, more aligned with normal ordering in quantum field theories.

    f. 

    FeynmanDiagrams does not return any crossed propagators unless explicitly requested using the new option includecrossedpropagators. The former option, normalproducts, was renamed as externallegs.

    Examples

       

    See Also

     

    The Physics project, Physics, what is new in Physics in Maple 17, what is new in Physics in Maple 16

     

    Physics2013.pdf    Physics2013.mw

    Edgardo S. Cheb-Terrab
    Physics, Maplesoft

    Do you want to use both Simulink® and MapleSim in your tool chain? If so, we have a free upcoming webinar today at 2 pm EST that might be helpful to you!

    In this webinar, Application Engineer Bonnie Yue will demonstrate:

    - How to quickly develop and optimize engineering system models in MapleSim, then use the MapleSim Connector to automatically convert them into S-Function blocks for seamless inclusion in Simulink® diagrams.
    - How to export MapleSim models to Simulink®, including models with custom components.

    To join us for this live webinar, please visit: http://www.maplesoft.com/webinars/live/register.aspx?id=627&p=TC-3916

    We hope to see you there!


    Simulink® is a registered trademark of The MathWorks, Inc..

    Maplesoft is holding its first ever Virtual User Summit on Feb. 27.  You’ll be able to watch presentations by both Maplesoft and Maplesoft customers, ask questions, have discussions in the lounge with other attendees, and even enter a draw, all from the comfort of your own home or office.

    Here’s the agenda.  We’ll release more detailed information on speakers and session times in the next couple of weeks.

    For more information and to register:  Maplesoft Virtual User Conference

    We're looking forward to seeing you there. (Well, "seeing you" :-))

    eithne

    I'd like to pay attention to an application "Periodicity of Sunspots " by Samir Khan, where a real data is analysed. That application can be used in teaching statistics.

    PS. The code by Samir Khan works well for me.

    Voting is open for the next individual prize to be awarded as part of the Möbius App Challenge.  The winner will receive a DSLR Camera Prize Pack! 

    Here are the finalist Apps:

    If you do not have the latest version of Java installed, released last week, you may have problems viewing these apps, as older versions of Java seem to be quietly disabling themselves.  I’ve attached a zip file of the finalist Apps in case it is helpful. finalists.zip

    Note that, if you ever have any problems viewing Apps in your browser, or simply want to work offline, you can always download a Möbius App and view it in Maple or the free Maple Player. To download a Möbius App, follow the link to the App and then click on the Download button near the top left of the page.

    You can vote for your favorite through our Facebook page or, if you’re not on Facebook, send an email with your vote to Mobius-Project@maplesoft.com.

    And remember, we are now accepting entries for the next quarterly prize. You could win an Xbox One!  See the Möbuis App Challenge for details.

    Voting closes Jan. 30.

    eithne

    Greetings to all.

    It is a new year (for some time now) and I am writing to indicate that the mathematical adventures with cycle index computations and Maple continue!

    Here are the previous installments:

    My purpose this time is to alert readers who might be interested to a new cycle index computation that is neither an application of the classical form of the Polya Enumeration Theorem (PET) nor of Power Group Enumeration. The former counts objects being distributed into slots with a group acting on the slots and the latter objects going into slots with a second group which permutes the objects in addition to the slots being permuted. What I am about to present treats a third possible case: when the slot permutation group and the object permutation group are one and the same and act simultaneously (not exactly the same but induced by the action of a single group).

    This requires quite radical proceedings in the etymological sense of the word, which is to go back to the roots of a problem. It seems that after working with the PET sooner or later one is confronted with enumeration problems that demand the original unmitigated power of Burnside's lemma, sometimes called the lemma that is not Burnside's. This is the case with the following problem. Suppose you have an N-by-N matrix whose entries are values from 1 to N, with all assignments allowed and the symmetric group on N elements acts on the row and column indices permuting rows and columns as well as the entries simultaneously. We ask how many such matrices there are taking these double symmetries into account. This also counts the number of closed binary operations on a set of N elemnents and there is a discussion as well as the Maple code (quite simple in my opinion and no more than a few lines) that solves this problem at the following Math Stackexchange link, which uses Lovasz Formula for the cycle index of the symmetric group which some readers may remember.

    In continuing the saga of Polya and Burnside exploration I have often reflected on how best to encapsulate these techniques in a Maple package. With this latest installment it would appear that a command to do Burnside enumeration probably ought to be part of such a package.

    Best regards,

    Marko Riedel

    CoolProp is an open source C++ library of thermophysical properties for pure fluids, pseudo-pure fluids, and humid air. Ian Bell has recently developed a wrapper for Maple (get the wrapper and library at Github). Compiling CoolProp gives a library (a DLL on Windows) you can call in Maple via define_external().

    I started exploring CoolProp a few days ago, and here's a few simple examples of what you can do

    The saturation pressure (in kPa) of the refrigerant R134a at 253 K

    The pressure (in kPa) of the refrigerant R22 that produces a two-phase mixture of quality 0.3 with an enthalpy of 300 kJ/kg

    And since I'm a fan of engineering visualization, here's a refrigeration cycle on a P-h-T chart, generated in Maple with CoolProp.

    Here's a Maple application that uses CoolProp to analyze a refrigeration cycle (together with a CoolProp DLL for 64-bit Windows).

    Analysis_of_a_Refrig.zip

    I'd like to encourage anyone with an interest in thermophysical modeling to download CoolProp and explore its functionality. It's certainly opened up a new field of applications for me.

    Samir

    Event?

    January 2014: Pages of oldest Russian Maple Application Center have been opened 10000000 times.

    http://webmath.exponenta.ru/

    Dear friends. 

    This is to alert you to a minor problem with your website. I use a variety of operating systems and browsers to access your site. With Firefox 22 and Firefox 26 and OpenSuse 12.2 when I click on a question with a lot of commentary like "Perl vs. Maple (MPF)" from a couple of days ago or "collect x/2-y/2 1/2" the question appears to load for a while but then an empty page appears, containing only the string "2014" and nothing else. Maybe you want to look into this.

    Best regards,

    Marko Riedel

     

    First 83 84 85 86 87 88 89 Last Page 85 of 301