MaplePrimes Commons General Technical Discussions

The primary forum for technical discussions.

The first update to the Maple 2018 Physics, Differential Equations and Mathematical Functions packages is available. As has been the case since 2013, this update contains fixes, enhancements to existing functionality, and new developments in the three areas. 

The webpage for these updates will continue being the Maplesoft R&D Physics webpage. Starting with Maple 2018, however, this update is also available from the MapleCloud.

To install the update: open Maple and click the Cloud icon (upper-right corner), select "Packages" and search for "Physics Updates". Then, in the corresponding "Actions" column, click the third icon (install pop-up).

NOTE May/1: the "Updates" icon of the MapleCloud toolbar (that opens when you click the upper-right icon within a Maple document / worksheet), now works fine, after having installed the Physics Updates version 32 or higher.

These first updates include:

  • New Physics functionality regarding Tensor Products of Quantum States; and Coherent States.
  • Updates to pdsolve regarding PDE & Boundary Conditions (exact solutions);
  • A change in notation: d_(x), the differential of a coordinate in the Physics package, is now displayed as shown in this Mapleprimes post.


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

Today we are pleased to announce the release of Maple 2018.

For many people, today is just another day in March. It’s not like the release of a new version of a software product is a world-shaking event. But for us here at Maplesoft, these first few days after the latest version of Maple is released are always a bit more special. There’s always a nervous energy whenever we release Maple and everyone else gets to see what we’ve been pouring our efforts into for the past year.

I’m not going to start this post by calling the latest version of Maple “game-changing” or “cutting edge” or any other marketing friendly platitude. I’m well aware that the latest version of Maple isn’t going to change the world.

What I would say though is that with every new release of software comes an opportunity. Every new software release is an opportunity to re-evaluate how that software has evolved to better suit your needs and requirements. So… if you've been sitting on the sidelines and watching version after version go by, assuming that it won't affect you, that's wrong! There's a lot that you could be missing out on.

The way that these release announcements usually work is that we try to amaze and astound you with a long list of features. Don’t worry, I’ll get into that in a bit. But first I wanted to walk through a simple exercise of release arithmetic.

I’ll start with one of those basic truths that has always been hiding in plain sight. The build number # for Maple 2018 is 1298750. Here at Maplesoft, every time our developers make a change to Maple this build number goes up by 1. These changes are sometimes small and sometimes very big; they can be as small as fixing a documentation typo or they can constitute implementing a major feature spread across numerous files in our source tree.

I have come to look at these build numbers in a slightly different way. I look at build numbers as representing all of the small to large sized steps our developers take to get you from one version to the next (or put another way, how many steps behind you are if you are using the older versions). With that in mind, let’s do some quick math:

If you are using Maple 2017 (2017.0 was build # 1231047), there have been 1298750 – 1231047 = 67703 steps since that release (these numerous "steps" are what built the "long list" of features below). If you’re using Maple 2016 (#1113130) this number grows to 185620. And so it goes… Maple 2015 (#1022128) = 276622 steps, Maple 18 (#922027) = 376723, Maple 17 (#813473) = 485277, you get the idea. If you’re using a really old version of Maple – there’s a good chance that we have fixed up a bunch of stuff or added something that you might find interesting in the time since your last upgrade!

 

Every new release of Maple adds functionality that pushes Maple into new domains, rounds out existing packages, fills gaps, and addresses common user requests. Let's explore some additions:

 

Clickable Math - a.k.a. math that looks like math and can be interacted with using your mouse - has evolved. What was once a collection of operations found in the right-click or main menu items or in interactive smart-popups or in many additional dialogs, has been brought together and enhanced to form the new Context Panel.

We can summarize the Context Panel as follows: Enter an expression and relevant operations that you can apply to that expression appear in a panel on the right side of your screen. Easy, right? It's a great change that unlocks a large part of the Maple library for you.

The addition of the Context Panel is important. It represents a shift in the interaction model for Maple – you’ll see more and more interaction being driven through the context panel in future releases. Already, the changes for the Context Panel permeate through to various other parts of Maple too. You’ll see an example in the Units section below and here’s another for coding applications.

The Context Panel also gives you access to embedded component properties – this makes it much easier to modify parts of your application.

There’s much more we can say about the Context Panel but in the interest of keeping this post (somewhat) concise I’ll stop there. If you are interested and want to see more examples, watch this video.

 

Coding in Maple - For many of us, using the Maple coding language is fundamental; it's just what we do. Whether you write a lot of procedures, or modify the start-up code for your worksheet, or put a sequence of commands in a code edit region, or include a button or slider in your application, you’ll find yourself using Maple’s code editing tools.

For Code Edit Regions and the Maple Code Editor, there’s automatic command completion for packages, commands, and even file paths.

maplemint has been integrated into the Code Editor, providing code analysis while you write your code.

mint and maplemint have been unified and upgraded. If you’ve never heard of these before, these are tools for analysing your Maple code. They provide information on procedures, giving parameter naming conflicts, unreachable code, unused parameters or variables, and more. Mint is available for use with external text files and maplemint runs directly inside of Maple.

For more, I’ve got another video.

 

For many engineers and scientists, units are intrinsically linked with calculations. Here's something else in Maple 2018 that will improve your everyday experience – units are now supported in many core routines such as in numeric equation solving, integration, and optimization.

Here’s a quick example of using units in the int command with some thermophysical data:

We define an expression that gives the pressure of methane as a function of the specific volume V.

P := ThermophysicalData:-Property("pressure", "methane", "temperature" = 350*Unit('K'), "density" = 1/V):
-(int(P, V = 1.0*Unit('m'^3/'kg') .. .5*Unit('m'^3/'kg'), numeric));

You'll also find unit formatting in the Context Panel.

Near and dear to my heart, data analysts also have some occasion to rejoice. Maple 2018 finally adds an Interpolate command that supports irregular data! This is one of those items that users have been requesting for a long time and I'm very happy to say that it's finally here.

Furthering the data story, there are new sources for thermochemical data as well as updates to ensure that existing datasets for thermophysical data and scientific constants are up to date.

 

If you're interested in protecting your content in Maple, listen up:

You can now encrypt procedures; anyone can use your code, but they can't see the source!

You can also lock your Maple documents - effectively protecting them from accidental changes or other unintended modifications.

 

 

Of course, I won't leave mathematics out of this. As always, there’s a ton of new and updated stuff here.

There's a new computational geometry package. There are improvements across all fields of mathematics including group theory, graph theory, integration, differential equations and partial differential equations. And there's a ton of new work in Physics (many of you who have been following the Physics project will already know about these).

You can recreate some of the visualizations above as follows:

Here’s an example of the new VoronoiDiagram Command:

m := LinearAlgebra:-RandomMatrix(40, 2):
ComputationalGeometry:-VoronoiDiagram(m, showpoints, symbol = solidcircle, symbolsize = 7,colorregions=ColorTools:-GetPalette("Dalton"));

Here’s another change that I’ve seen mentioned several times on MaplePrimes – the ability to control the  border of arrows:

plots:-display(plottools:-arrow([0, 0], [2, 2], 0.5e-1, .2, .1, border = false, color = "DarkGrey", legend = "A+B"),
                       plottools:-arrow([0, 0], [1, 2], .15, .3, .15, border = false, color = "Crimson", legend = "A"),
                       plottools:-arrow([1, 2], [2, 2], .15, .3, .15, border = false, color = "CornflowerBlue", legend = "B"),
                   size = [600, 400]);

You can rotate Tickmarks in plots using the rotation option. Some plots, such as those in the TimeSeriesAnalysis package, use rotation by default.

ts := TimeSeriesAnalysis:-TimeSeries([7, 23, 21, 19, 13, 46, 42, 30, 31, 26, 19, 9, 16, 26, 17, 33, 31, 46, 42, 35, 45, 30, 11, 17, 23, 20, 15, 36, 31, 55, 49, 39, 36, 28, 12, 11, 21, 23, 27, 33, 36, 49, 42, 37, 33, 45, 12, 7, 23, 32, 25, 42, 27, 52, 50, 34, 41, 40, 16, 14], frequency = monthly, startdate = "2005-09");
TimeSeriesAnalysis:-SeasonalSubseriesPlot(ts, startingperiod = 9, seasonnames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], space = .25, size = [800, 400]);

 

I’ll also mention some updates to the Maple language – items that the readers of this forum will likely find useful.

Dates and Times – Maple 2018 adds new data structures that represent dates and times. There are numerous functions that work with dates and times, including fundamental operations such as date arithmetic and more advanced functionality for working with Calendars.

today := Date();

Year( today ), DayOfMonth( today ), Month( today );

Date arithmetic:

One_year_ago := today - 365*Unit(d);

 

Until - An optional until clause has been added to Maple's loop control structure.

Here's an example, the following code finds the next prime number after 37 and then terminates the loop.

n := 37;

do n := n+1 until

    isprime(n):

n;

As always with these posts, we can't cover everything. This post is really just the beginning of the story. I would love to spend another couple of pages describing the inner-workings of every single improvement to Maple 2018 for you; however I'd rather you just try these features yourself, so go ahead, get out there and try out Maple 2018 today. You won't be disappointed that you did.

The Joint Mathematics Meetings are taking place this week (January 10 – 13) in San Diego, California, U.S.A. This will be the 101th annual winter meeting of the Mathematical Association of America (MAA) and the 124nd annual meeting of the American Mathematical Society (AMS).

Maplesoft will be exhibiting at booth #505 as well as in the networking area. Please stop by our booth or the networking area to chat with me and other members of the Maplesoft team, as well as to pick up some free Maplesoft swag or win some prizes.

There are also several interesting Maple-related talks and events happening this week - I would definitely not miss the talk by our own Paulina Chin on grading sketch graphs.

 

Using Symbol-Crunching to find ALL Sucker's Bets (with given deck sizes). 

AMS Special Session on Applied and Computational Combinatorics, II 
Wednesday January 10, 2018, 2:15 p.m.-2:45 p.m.

Shalosh B. Ekhad, Rutgers University, New Brunswick 
Doron Zeilberger*, Rutgers University, New Brunswick 
 

Collaborative Research: Maplets for Calculus. 

MAA Poster Session: Projects Supported by the NSF Division of Undergraduate Education 
Thursday January 11, 2018, 2:00 p.m.-4:00 p.m.

Philip B. Yasskin*, Texas A&M University 
Douglas B. Meade, University of South Carolina 
Matthew Barry, Texas A&M Engineering Extension Service 
Andrew Crenwelge, Texas A&M University 
Joseph Martinson, Texas A&M University 
Matthew Weihing, Texas A&M University

 

Automated Grading of Sketched Graphs in Introductory Calculus Courses. 

AMS Special Session on Visualization in Mathematics: Perspectives of Mathematicians and Mathematics Educators, I 

Friday January 12, 2018, 9:00 a.m.

Dr. Paulina Chin*, Maplesoft 

 

Semantic Preserving Bijective Mappings of Mathematical Expressions between LaTeX and Computer Algebra Systems.

AMS Special Session on Mathematical Information in the Digital Age of Science, III 
Friday January 12, 2018, 9:00 a.m.-9:20 a.m.

Howard S. Cohl*, NIST 

 

Interactive Animations in MYMathApps Calculus. 

MAA General Contributed Paper Session on Mathematics and Technology 
Saturday January 13, 2018, 11:30 a.m.-11:40 a.m.

Philip B. Yasskin*, Texas A&M University 
Andrew Crenwelge, Texas A&M University 
Joseph Martinsen, Texas A&M University 
Matthew Weihing, Texas A&M University 
Matthew Barry, Texas A&M Engineering Experiment Station 

 

Applying Maple Technology in Calculus Teaching To Create Artwork. 

MAA General Contributed Paper Session on Teaching and Learning Calculus, II 
Saturday January 13, 2018, 2:15 p.m.

Lina Wu*, Borough of Manhattan Community College-The City University of New York

 

If you are attending the Joint Math meetings this week and plan on presenting anything on Maple, please feel free to let me know and I'll update this list accordingly.


See you in San Diego!

Daniel

Maple Product Manager


 

Quantum Commutation Rules Basics

 

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2 

(1) Laboratoire PhLAM, UMR CNRS 8523, Université Lille 1, F-59655, France

(2) Maplesoft

NULL

NULL

In Quantum Mechanics, in the coordinates representation, the component of the momentum operator along the x axis is given by the differential operator


 "`p__x`=-i `ℏ`(∂)/(∂x)  "

 

The purpose of the exercises below is thus to derive the commutation rules, in the coordinates representation, between an arbitrary function of the coordinates and the related momentum, departing from the differential representation

 

p[n] = -i*`ℏ`*`∂`[n]

These two exercises illustrate how to have full control of the computational process by using different elements of the Maple language, including inert representations of abstract vectorial differential operators, Hermitian operators, algebra rules, etc.

 

These exercises also illustrate a new feature of the Physics package, introduced in Maple 2017, that is getting refined (the computation below requires the Maplesoft updates of the Physics package) which is the ability to perform computations algebraically, using the product operator, but with differential operators, and transform the products into the application of the operators only when we want that, as we do with paper and pencil.

 

%Commutator(g(x, y, z), p_) = I*`ℏ`*Nabla(F(X))

 

restart; with(Physics); with(Physics[Vectors]); interface(imaginaryunit = i)

 

Start setting the problem:

– 

 all ofx, y, z, p__x, p__y, p__z are Hermitian operators

– 

 all of x, y, z commute between each other

– 

 tell the system only that the operators x, y, z are the differentiation variables of the corresponding (differential) operators p__x, p__y, p__z but do not tell what is the form of the operators

 

Setup(mathematicalnotation = true, differentialoperators = {[p_, [x, y, z]]}, hermitianoperators = {p, x, y, z}, algebrarules = {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}, quiet)

[algebrarules = {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}, differentialoperators = {[p_, [x, y, z]]}, hermitianoperators = {p, x, y, z}, mathematicalnotation = true]

(1.1)

Assuming F(X) is a smooth function, the idea is to apply the commutator %Commutator(F(X), p_) to an arbitrary ket of the Hilbert space Ket(psi, x, y, z), perform the operation explicitly after setting a differential operator representation for `#mover(mi("p",mathcolor = "olive"),mo("→"))`, and from there get the commutation rule between F(X) and `#mover(mi("p",mathcolor = "olive"),mo("→"))`.

 

Start introducing the commutator, to proceed with full control of the operations we use the inert form %Commutator

alias(X = (x, y, z))

CompactDisplay(F(X))

` F`(X)*`will now be displayed as`*F

(1.2)

%Commutator(F(X), p_)*Ket(psi, X)

Physics:-`*`(%Commutator(F(X), p_), Physics:-Ket(psi, x, y, z))

(1.3)

For illustration purposes only (not necessary), expand this commutator

Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)) = expand(Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)))

Physics:-`*`(%Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = Physics:-`*`(F(X), p_, Physics:-Ket(psi, x, y, z))-Physics:-`*`(p_, F(X), Physics:-Ket(psi, x, y, z))

(1.4)

Note that  `#mover(mi("p",mathcolor = "olive"),mo("→"))`, F(X) and the ket Ket(psi, x, y, z) are operands in the products above and that they do not commute: we indicated that the coordinates x, y, z are the differentiation variables of `#mover(mi("p",mathcolor = "olive"),mo("→"))`. This emulates what we do when computing with these operators with paper and pencil, where we represent the application of a differential operator as a product operation.

 

This representation can be transformed into the (traditional in computer algebra) application of the differential operator when desired, as follows:

Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)) = Library:-ApplyProductsOfDifferentialOperators(Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)))

Physics:-`*`(%Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = Physics:-`*`(F(X), p_(Physics:-Ket(psi, x, y, z)))-p_(Physics:-`*`(F(X), Physics:-Ket(psi, x, y, z)))

(1.5)

Note that, in `#mover(mi("p",mathcolor = "olive"),mo("→"))`(F(X)*Ket(psi, x, y, z)), the application of `#mover(mi("p",mathcolor = "olive"),mo("→"))` is not expanded: at this point nothing is known about  `#mover(mi("p",mathcolor = "olive"),mo("→"))` , it is not necessarily a linear operator. In the Quantum Mechanics problem at hands, however, it is. So give now the operator  `#mover(mi("p",mathcolor = "olive"),mo("→"))` an explicit representation as a linear vectorial differential operator (we use the inert form %Nabla, %Nabla, to be able to proceed with full control one step at a time)

p_ := proc (f) options operator, arrow; -I*`ℏ`*%Nabla(f) end proc

proc (f) options operator, arrow; -Physics:-`*`(Physics:-`*`(I, `ℏ`), %Nabla(f)) end proc

(1.6)

The expression (1.5) becomes

Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)) = Physics[`*`](F(X), p_(Physics[Ket](psi, x, y, z)))-p_(Physics[`*`](F(X), Physics[Ket](psi, x, y, z)))

Physics:-`*`(%Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = -I*`ℏ`*Physics:-`*`(F(X), %Nabla(Physics:-Ket(psi, x, y, z)))+I*`ℏ`*%Nabla(Physics:-`*`(F(X), Physics:-Ket(psi, x, y, z)))

(1.7)

Activate now the inert operator VectorCalculus[Nabla] and simplify taking into account the algebra rules for the coordinate operators {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}

Simplify(value(Physics[`*`](%Commutator(F(X), p_), Physics[Ket](psi, x, y, z)) = -I*`ℏ`*Physics[`*`](F(X), %Nabla(Physics[Ket](psi, x, y, z)))+I*`ℏ`*%Nabla(Physics[`*`](F(X), Physics[Ket](psi, x, y, z)))))

Physics:-`*`(Physics:-Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = I*`ℏ`*_i*Physics:-`*`(diff(F(X), x), Physics:-Ket(psi, x, y, z))+I*`ℏ`*_j*Physics:-`*`(diff(F(X), y), Physics:-Ket(psi, x, y, z))+I*`ℏ`*_k*Physics:-`*`(diff(F(X), z), Physics:-Ket(psi, x, y, z))

(1.8)

To make explicit the gradient in disguise on the right-hand side, factor out the arbitrary ket Ket(psi, x, y, z)

Factor(Physics[`*`](Physics[Commutator](F(X), p_), Physics[Ket](psi, x, y, z)) = I*`ℏ`*_i*Physics[`*`](diff(F(X), x), Physics[Ket](psi, x, y, z))+I*`ℏ`*_j*Physics[`*`](diff(F(X), y), Physics[Ket](psi, x, y, z))+I*`ℏ`*_k*Physics[`*`](diff(F(X), z), Physics[Ket](psi, x, y, z)))

Physics:-`*`(Physics:-Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = I*`ℏ`*Physics:-`*`((diff(F(X), y))*_j+(diff(F(X), z))*_k+(diff(F(X), x))*_i, Physics:-Ket(psi, x, y, z))

(1.9)

Combine now the expanded gradient into its inert (not-expanded) form

subs((Gradient = %Gradient)(F(X)), Physics[`*`](Physics[Commutator](F(X), p_), Physics[Ket](psi, x, y, z)) = I*`ℏ`*Physics[`*`]((diff(F(X), y))*_j+(diff(F(X), z))*_k+(diff(F(X), x))*_i, Physics[Ket](psi, x, y, z)))

Physics:-`*`(Physics:-Commutator(F(X), p_), Physics:-Ket(psi, x, y, z)) = I*`ℏ`*Physics:-`*`(%Gradient(F(X)), Physics:-Ket(psi, x, y, z))

(1.10)

Since (1.10) is true for allKet(psi, x, y, z), this ket can be removed from both sides of the equation. One can do that either taking coefficients (see Coefficients ) or multiplying by the "formal inverse" of this ket, arriving at the (expected) form of the commutation rule between F(X) and `#mover(mi("p",mathcolor = "olive"),mo("→"))`

(Physics[`*`](Physics[Commutator](F(X), p_), Ket(psi, x, y, z)) = I*`ℏ`*Physics[`*`](%Gradient(F(X)), Ket(psi, x, y, z)))*Inverse(Ket(psi, x, y, z))

Physics:-Commutator(F(X), p_) = I*`ℏ`*%Gradient(F(X))

(1.11)

Tensor notation, "[`X__m`,P[n]][-]=i `ℏ` g[m,n]"

 

The computation rule for position and momentum, this time in tensor notation, is performed in the same way, just that, additionally, specify that the space indices to be used are lowercase latin letters, and set the relationship between the differential operators and the coordinates directly using tensor notation.

You can also specify that the metric is Euclidean, but that is not necessary: the default metric of the Physics package, a Minkowski spacetime, includes a 3D subspace that is Euclidean, and the default signature, (- - - +), is not a problem regarding this computation.

 

restart; with(Physics); interface(imaginaryunit = i)

Setup(mathematicalnotation = true, coordinates = cartesian, spaceindices = lowercaselatin, algebrarules = {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}, hermitianoperators = {P, X, p}, differentialoperators = {[P[m], [x, y, z]]}, quiet)

[algebrarules = {%Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, z) = 0}, coordinatesystems = {X}, differentialoperators = {[P[m], [x, y, z]]}, hermitianoperators = {P, p, t, x, y, z}, mathematicalnotation = true, spaceindices = lowercaselatin]

(2.1)

Define now the tensor P[m]

Define(P[m], quiet)

{Physics:-Dgamma[mu], P[m], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(2.2)

Introduce now the Commutator, this time in active form, to show how to reobtain the non-expanded form at the end by resorting the operands in products

Commutator(X[m], P[n])*Ket(psi, x, y, z)

Physics:-`*`(Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]), Physics:-Ket(psi, x, y, z))

(2.3)

Expand first (not necessary) to see how the operator P[n] is going to be applied

Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)) = expand(Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)))

Physics:-`*`(Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]), Physics:-Ket(psi, x, y, z)) = Physics:-`*`(Physics:-SpaceTimeVector[m](X), P[n], Physics:-Ket(psi, x, y, z))-Physics:-`*`(P[n], Physics:-SpaceTimeVector[m](X), Physics:-Ket(psi, x, y, z))

(2.4)

Now expand and directly apply in one ago the differential operator P[n]

Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)) = Library:-ApplyProductsOfDifferentialOperators(Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)))

Physics:-`*`(Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]), Physics:-Ket(psi, x, y, z)) = Physics:-`*`(Physics:-SpaceTimeVector[m](X), P[n](Physics:-Ket(psi, x, y, z)))-P[n](Physics:-`*`(Physics:-SpaceTimeVector[m](X), Physics:-Ket(psi, x, y, z)))

(2.5)

Introducing the explicit differential operator representation for P[n], here again using the inert %d_[n] to keep control of the computations step by step

P[n] := proc (f) options operator, arrow; -I*`ℏ`*%d_[n](f) end proc

proc (f) options operator, arrow; -Physics:-`*`(Physics:-`*`(I, `ℏ`), %d_[n](f)) end proc

(2.6)

The expanded and applied commutator (2.5) becomes

Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)) = Physics[`*`](Physics[SpaceTimeVector][m](X), P[n](Ket(psi, x, y, z)))-P[n](Physics[`*`](Physics[SpaceTimeVector][m](X), Ket(psi, x, y, z)))

Physics:-`*`(Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]), Physics:-Ket(psi, x, y, z)) = -I*`ℏ`*Physics:-`*`(Physics:-SpaceTimeVector[m](X), %d_[n](Physics:-Ket(psi, x, y, z)))+I*`ℏ`*%d_[n](Physics:-`*`(Physics:-SpaceTimeVector[m](X), Physics:-Ket(psi, x, y, z)))

(2.7)

Activate now the inert operators %d_[n] and simplify taking into account Einstein's rule for repeated indices

Simplify(value(Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)) = -I*`ℏ`*Physics[`*`](Physics[SpaceTimeVector][m](X), %d_[n](Ket(psi, x, y, z)))+I*`ℏ`*%d_[n](Physics[`*`](Physics[SpaceTimeVector][m](X), Ket(psi, x, y, z)))))

Physics:-`*`(Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]), Physics:-Ket(psi, x, y, z)) = I*`ℏ`*Physics:-g_[m, n]*Physics:-Ket(psi, x, y, z)

(2.8)

Since the ket Ket(psi, x, y, z) is arbitrary, we can take coefficients (or multiply by the formal Inverse  of this ket as done in the previous section). For illustration purposes, we use   Coefficients  and note hwo it automatically expands the commutator

Coefficients(Physics[`*`](Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]), Ket(psi, x, y, z)) = I*`ℏ`*Physics[g_][m, n]*Ket(psi, x, y, z), Ket(psi, x, y, z))

Physics:-`*`(Physics:-SpaceTimeVector[m](X), P[n])-Physics:-`*`(P[n], Physics:-SpaceTimeVector[m](X)) = I*`ℏ`*Physics:-g_[m, n]

(2.9)

One can undo this (frequently undesired) expansion of the commutator by sorting the products on the left-hand side using the commutator between X[m] and P[n]

Library:-SortProducts(Physics[`*`](Physics[SpaceTimeVector][m](X), P[n])-Physics[`*`](P[n], Physics[SpaceTimeVector][m](X)) = I*`ℏ`*Physics[g_][m, n], [P[n], X[m]], usecommutator)

Physics:-Commutator(Physics:-SpaceTimeVector[m](X), P[n]) = I*`ℏ`*Physics:-g_[m, n]

(2.10)

And that is the result we wanted to compute.

 

Additionally, to see this rule in matrix form,

TensorArray(-(Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]) = I*`ℏ`*Physics[g_][m, n]))

Matrix(%id = 18446744078261558678)

(2.11)

In the above, we use equation (2.10) multiplied by -1 to avoid a minus sign in all the elements of (2.11), due to having worked with the default signature (- - - +); this minus sign is not necessary if in the Setup at the beginning one also sets  signature = `+ + + -`

 

For display purposes, to see this matrix expressed in terms of the geometrical components of the momentum `#mover(mi("p",mathcolor = "olive"),mo("→"))` , redefine the tensor P[n] explicitly indicating its Cartesian components

Define(P[m] = [p__x, p__y, p__z], quiet)

{Physics:-Dgamma[mu], P[m], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(2.12)

TensorArray(-(Physics[Commutator](Physics[SpaceTimeVector][m](X), P[n]) = I*`ℏ`*Physics[g_][m, n]))

Matrix(%id = 18446744078575996430)

(2.13)

Finally, in a typical situation, these commutation rules are to be taken into account in further computations, and for that purpose they can be added to the setup via

"Setup(?)"

[algebrarules = {%Commutator(x, p__x) = I*`ℏ`, %Commutator(x, p__y) = 0, %Commutator(x, p__z) = 0, %Commutator(x, y) = 0, %Commutator(x, z) = 0, %Commutator(y, p__x) = 0, %Commutator(y, p__y) = I*`ℏ`, %Commutator(y, p__z) = 0, %Commutator(y, z) = 0, %Commutator(z, p__x) = 0, %Commutator(z, p__y) = 0, %Commutator(z, p__z) = I*`ℏ`}]

(2.14)

For example, from herein computations are performed taking into account that

(%Commutator = Commutator)(x, p__x)

%Commutator(x, p__x) = I*`ℏ`

(2.15)

NULL

NULL


 

Download DifferentialOperatorCommutatorRules.mw

 

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

We’ve just released a major new version of MapleSim. The MapleSim 2017 family of products provides new and improved model development and analysis tools, expands modeling scope, introduces new deployment options, and strengthens toolchain connectivity.  Here are some highlights:

  • The new Initialization Diagnostics App further simplifies the initialization task by helping you determine how your initial values are computed and what you need to do to adjust them.
     
  • The new Modal Analysis App helps you explore and understand the natural vibration modes of your mechanism, so you can determine how to reduce the vibration in the final product. 
     
  • Over 100 new components include expansions to the Electrical and Magnetic libraries.
     
  • A new Modelica® code editor makes it easier to create Modelica-based custom components.
     
  • The MapleSim Heat Transfer Library from CYBERNET, a new add-on component library, provides a comprehensive view into heat transfer effects in your model, enabling you to refine your  design to improve performance and avoid overheating.
     
  • The new MapleSim Explorer product provides a cost-effective deployment solution that allows you to make MapleSim models available to more people in your organization.

 

There’s more, of course.  See What’s New in MapleSim for lots more details.

eithne

Try More/GeneratePDF  in  the menu under  a post/question. See screen_26.09.17.docx as an example of a result. Also Adobe Acrobat Reader fails with it. That was submitted to MaplePrimes staff through the Contact  button at the bottom of this page. I obtained no feedback from them.

This might be of interest to some of us here - a comparison of differential equation solvers between many different packages/tools/libraries:

http://www.stochasticlifestyle.com/comparison-differential-equation-solver-suites-matlab-r-julia-python-c-fortran/

The "analysis" of maple's capabilities are presented as somewhat limited in comparison to mathematica's - I wonder if this is a simple bias/misinformation of the author, or if his conclusions are correct. 

My interface has frozen, but above is a screen shot of what is by far the most unusual response from the CAS in the i guess 8 or so years ive been using it in total.

 

*updated situation its allowing me to interrupt evaluation

Download New_ReportGeneration_with_ExcelData.mw

Dear Users,

I have received a congratulations from a Mapleprime user for my post (on Finite Element Analysis - Basics) posted two years earlier. I  did not touch that subject for two years for obvious reasons. Now that a motivation has come, I have decided to post my second application using embedded components. This I was working for the past two years and with the support from Maplesoft technical support team and Dr.RobertLopez. I thank them here for this workbook has come out well to my satisfaction and has given me confidence to post it public.

About the workbook

I have tried to improve the performance of a 2-Stroke gasoline engine to match that of a four stroke engine by using exhaust gas recirculation. Orifice concept is new and by changing the orifice diameter and varying the % of EGR, performance was monitored and data stored in Excel workbook. These data can be imported to Maple workbook by you as you want for each performance characteristic. The data are only my experimental and not authentic for any commercial use.

This Maple workbook generates curves from data for various experiments conducted by modifying the field variables namely Orifice diameter, % Exhaust gas Recirculation and Heat Exchanger Cooling. Hence optimum design selection is possible for best performance.

Thanks for commenting, congratulating or critisising!! All for my learning and improving my Maple understanding!! 

A new code based on higher derivative method has been implemented in Maple. A sample code is given below and explained. Because of the symbolic nature of Maple, this method works very well for a wide range of BVP problems.

The code solves BVPs written in the first order form dy/dx = f (Maple’s dsolve numeric converts general BVPs to this form and solves).

The code can handle unknown parameters in the model if sufficient boundary conditions are provided.

This code has been tested from Maple 8 to Maple 2017. For Digits:=15 or less, this code works in all of the Maple versions tested.

Most problems can be solved with Digits:=15 with atol = 1e-10 or so. This code can be used to get a tolerance value of 1e-20 or any high precision as needed by changing the number of Digits accordingly. This may be needed if the original variables are not properly sacled. With arbitrarily high Digits, the code fails in Maple 18 or later version, etc because Maple does not support SparseDirect Solver at high precision in some of the versions (hopefuly this bug can be removed in the future versions).

For simple problems, Maple’s dsolve/numeric is superior to the code developed as it is implemented in hardware floats. For large scale problems and stiff problems, the method developed is much more superior to Maple and comparable to (and often times better than) state of the art codes for BVPs - bvp4c (MATLAB), COLSYS,TWPBVP, etc.

The code, as written, cannot be used for problems with a singularity at end points (doable in the future). In addition, mixed boundary conditions are not supported in this version of the code (for example, y1(1)=y2(0)). Future updates will include the application of this approach for DAE-BVPs, currently not supported by Maple’s dsolve/numeric command.

A paper has been submitted to JCAM. I welcome feedback on the code and solicit input from Mapleprimes members if they are able to test (and break this code) for any BVP.

 

PDF of the paper submitted, example maple code and the solver as a text file needed are uploaded here. Additional examples are hosted on my website at http://depts.washington.edu/maple/HDM.html


 

 

##################################################################################

Troesch's problem
This is an inherently unstable, difficult, nonlinear, two-point BVP formulated by Weibel and Troesch that describes the confinement of a place column by radiation pressure. Increasing epsilon increases the stiffness of the ODE.
1. E.S. Weibel, On the confinement of a plasma by magnetostatic fields, Phys. Fluids. 2 (1959) 52-56.
2. B. Troesch, A simple approach to a sensitive two-point boundary value problem, J. Comput. Phys. 21 (1976) 279-290.

Introduction
The package HDM solves boundary value problems (BVPs) using higher derivative methods (HDM) in Maple®. We explain how to solve BVPs using this package. HDM can numerically solve BVPs of ordinary differential equations (ODEs) of the form shown is the fowllowing example.

###################################################################################

 

 

Reset the program to clear the memory from previous execution command.

restart:

 

Read the txt file which contains the HDM solver for BVPs.

read("HDM.txt");

 

Declare the precision for the entire Maple® sheet.

Digits:=15;

Digits := 15

(1)

 

Enter the first-order ODEs into EqODEs list.

EqODEs:=[diff(y1(x),x)=y2(x),diff(y2(x),x)=epsilon*sinh(epsilon*y1(x))];

EqODEs := [diff(y1(x), x) = y2(x), diff(y2(x), x) = epsilon*sinh(epsilon*y1(x))]

(2)

 

Define the left boundary condition (bc1), and the right boundary condition (bc2). One should collect all the terms in one side.

bc1:=evalf([y1(x)]);

bc1 := [y1(x)]

(3)

bc2:=evalf([y1(x)-1]);

bc2 := [y1(x)-1.]

(4)

 

Define the range (bc1 to bc2) of this BVP.

Range:=[0.,1.];

Range := [0., 1.]

(5)

 

List any known parameters in the list.

pars:=[epsilon=2];

pars := [epsilon = 2]

(6)

 

List any unknown parameters in the list. When there is no unknown parameter, use [ ].

unknownpars:=[];

unknownpars := []

(7)

 

Define the initial derivative in nder (default is 5 for 10th order) and the number of the nodes in nele (default is 10 and distributed evenly across the range provided by the user). The code adapts to increase the order. For many problems, 10th order method with 10 elements are sufficient.

nder:=5;nele:=10;

nder := 5

nele := 10

(8)

 

Define the absolute and relative tolerance for the local error. The error calculation is done based on the norm of both the 9th and 10th order simulation results.

atol:=1e-6;rtol:=atol/100;

atol := 0.1e-5

rtol := 0.100000000000000e-7

(9)

 

Call HDMadapt procedure, input all the information entered above and save the solution in sol. HDMadapt procedure does not need the initial guess for the mesh.

sol:= HDMadapt(EqODEs,bc1,bc2,pars,unknownpars,nder,nele,Range,atol,rtol):

 

Present some details of the solution.

sol[4]; # final derivative

5

(10)

sol[5]; # Maximum local RMSE

0.604570329905172e-8

(11)

 

Store the dimension of the solution (after adjusting the mesh) to NN.

NN:=nops(sol[3])+1;

NN := 11

(12)

 

Plot the interested variable (the ath ODE variable will be sol[1][i+NN*(a-1)] )

node:=nops(EqODEs);
odevars:=select(type,map(op,map(lhs,EqODEs)),'function');

node := 2

odevars := [y1(x), y2(x)]

(13)

xx:=Vector(NN):

xx[1]:=Range[1]:

for i from 1 to nops(sol[3]) do xx[i+1]:=xx[i]+sol[3][i]: od:

for j from 1 to node do
  plot([seq([xx[i],rhs(sol[1][i+NN*(j-1)])],i=1..NN)],axes=boxed,labels=[x,odevars[j]],style=point);
end do;

 

 


 

Download Example_3_Troesch.mws

 

Was just pondering this idea and posted this in the post topic for discussion. 

Each Maple finished version of Maple may still have certain bugs that will not be updated for that version, so I am suggesting (I think anyone could implement it) that if there is a workaround, one could wrap it up in something I would call a patch package updateable by us users we could update here on mapleprimes.  It would be good for people who haven't upgraded or can't upgrade due to costs etc...

For example, there was recent issue with pdsolve that was fixed quite quickly in the seperate updateable Physics package.  Things could be done similarily that might work with other workarounds using this patch package idea. 

If anyone thinks this is good or even viable idea then lets implement it.  I envisioned it with just this one rule to follow - the name of the patch package would reflect the version we are patching (ie. with(patch12) or with(patch2016) for Maple 12 and Maple 2016 respectively etc...)  We could make these patch packages available in this post or start another.

As I said, I'm just throwing the idea out there.  Thoughts?

There seems to be a bug with improper integration:

integrate(cos(t)*exp(-x*t),t=-infinity..infinity)

gives

0

Substituting any number for x, or assuming x >= 0  (or x<=0) does give the correct result,

The problem also persists when assuming x>-1 (or x>-Maple_floats(MIN_FLOAT))

 

Books free. Like!!!

Lenin Araujo Castillo

Yahoo Finance recently discontinued their (largely undocumented) historical stock quote API.

Previously, you simply send a HTTP:-Get request like this…

HTTP:-Get(“http://ichart.yahoo.com/table.csv?s=AAPL&a=00&b=1&c=2016&d=00&e=1&f=2017&g=d&ignore=.csv")

…and get historical OHLCV (open, high, low, close, trading volume) data in your worksheet (in this case for AAPL between 1 January 2016 and 1 January 2017).

This no longer works! Yahoo shut the door on this easy-to-use and widely disseminated API.

You can still download historical stock quotes from Yahoo Finance into Maple, but the process is now somewhat more involved. My complete code in this worksheet but I'll step through the process below.

If you visit the updated Yahoo Finance website and download historical data for a ticker, you see a URL like this in the status bar of your browser

https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1497727945&period2=1500319945&interval=1d&events=history&crumb=C9luNcNjVkK

Let's examine how ths URL is constructed.

  • period1 and period2 are Unix time stamps for your start and end date
  • interval is the data retrieval interval (this can be either 1d, 1w or 1m)
  • crumb is an alphanumeric code that’s periodically regenerated every time you download new historical data from from the Yahoo Finance website using your browser. Moreover, crumb is paired with a cookie that’s stored by your browser.

Here’s how to extract and supply the cookie-crumb pair to Yahoo Finance so you can still use Maple to retrieve historical stock quotes

Send a dummy request to get a cookie-crumb pair

res:=HTTP:-Get("https://finance.yahoo.com/lookup?s=bananas"):

Grab the crumb from the response

i:=StringTools:-Search("CrumbStore\":{\"crumb\":\"",res[2]):
crumbValue := res[2][i+22..i+32]
                  crumbValue := "btW01FWTBn3"

Store the cookie from the response

cookieHeader:=res[3]["Set-Cookie"]
    cookieHeader := "B=702eqhdcmq7cl&b=3&s=0t; expires=Mon,17-Jul-2018 20:27:01 GMT; path=/; domain=.yahoo.com

Construct the URL

  • Your desired start and end dates have to be defined as Unix time stamps. Converting a human readable date (like 1st January 2017) to a Unix timestamp is simple, so I won't cover it here.
  • The previously retrieved crumb has to be added to the URL.
ticker:="AAPL":
p1 := 1497709183:
p2 := 1500301183:
url:=cat("https://query1.finance.yahoo.com/v7/finance/download/",ticker,"?period1=",p1,"&period2=",p2,"&interval=1d&events=history&crumb=", crumbValue):

Send the request to Yahoo Finance, including the cookie in the header

data:=HTTP:-Get(url,headers = ["Cookie" = cookieHeader])

Your historical data is now returned

The historical data is now easily parsed into a matrix.

Please note that any use of Yahoo Finance has to be consistent with their terms of service.

Maple 2017 has launched!

Maple 2017 is the result of hard work by an enthusiastic team of developers and mathematicians.

As ever, we’re guided by you, our users. Many of the new features are of a result of your feedback, while others are passion projects that we feel you will find value in.

Here’s a few of my favourite enhancements. There’s far more that’s new - see What’s New in Maple 2017 to learn more.

 

MapleCloud Package Manager

Since it was first introduced in Maple 14, the MapleCloud has made thousands of Maple documents and interactive applications available through a web interface.

Maple 2017 completely refreshes the MapleCloud experience. Allied with a new, crisp, interface, you can now download and install user-created packages.

Simply open the MapleCloud interface from within Maple, and a mouse click later, you see a list of user-created packages, continuously updated via the Internet. Two clicks later, you’ve downloaded and installed a package.

This completely bypasses the traditional process of searching for and downloading a package, copying to the right folder, and then modifying libname in Maple. That was a laborious process, and, unless I was motivated, stopped me from installing packages.

The MapleCloud hosts a growing number of packages.

Many regular visitors to MaplePrimes are already familiar with Sergey Moiseev’s DirectSearch package for optimization, equation solving and curve fitting.

My fellow product manager, @DSkoog has written a package for grouping data into similar clusters (called ClusterAnalysis on the Package Manager)

Here’s a sample from a package I hacked together for downloading maps images using the Google Maps API (it’s called Google Maps and Geocoding on the Package Manager).

You’ll also find user-developed packages for exploring AES-based encryption, orthogonal series expansions, building Maple shell scripts and more.

Simply by making the process of finding and installing packages trivially easy, we’ve opened up a new world of functionality to users.

Maple 2017 also offers a simple method for package authors to upload workbook-based packages to the MapleCloud.

We’re engaging with many package authors to add to the growing list of packages on the MapleCloud. We’d be interested in seeing your packages, too!

 

Advanced Math

We’re committed to continually improving the core symbolic math routines. Here area few examples of what to expect in Maple 2017.

Resulting from enhancements to the Risch algorithm, Maple 2017 now computes symbolic integrals that were previously intractable

Groeber:-Basis uses a new implementation of the FGLM algorithm. The example below runs about 200 times faster in Maple 2017.

gcdex now uses a sparse primitive polynomial remainder sequence together.  For sparse structured problems the new routine is orders of magnitude faster. The example below was previously intractable.

The asympt and limit commands can now handle asymptotic cases of the incomplete Γ function where both arguments tend to infinity and their quotient remains finite.

Among several improvements in mathematical functions, you can now calculate and manipulate the four multi-parameter Appell functions.

 

Appel functions are of increasing importance in quantum mechanics, molecular physics, and general relativity.

pdsolve has seen many enhancements. For example, you can tell Maple that a dependent variable is bounded. This has the potential of simplifying the form of a solution.

 

Plot Builder

Plotting is probably the most common application of Maple, and for many years, you’ve been able to create these plots without using commands, if you want to.  Now, the re-designed interactive Plot Builder makes this process easier and better.

When invoked by a context menu or command on an expression or function, a panel slides out from the right-hand side of the interface.

 

Generating and customizing plots takes a single mouse click. You alter plot types, change formatting options on the fly and more.

To help you better learn Maple syntax, you can also display the actual plot command.

Password Protected Content

You can distribute password-protected executable content. This feature uses the workbook file format introduced with Maple 2016.

You can lock down any worksheet in a Workbook. But from any other worksheet, you can send (author-specified) parameters into the locked worksheet, and extract (author-specified) results.

 

Plot Annotations

You can now get information to pop up when you hover over a point or a curve on a plot.

In this application, you see the location and magnitude of an earthquake when you hover over a point

Here’s a ternary diagram of the color of gold-silver-copper alloys. If you let your mouse hover over the points, you see the composition of the points

Plot annotations may seem like a small feature, but they add an extra layer of depth to your visualizations. I’ve started using them all the time!

 

Engineering Portal

In my experience, if you ask an engineer how they prefer to learn, the vast majority of them will say “show me an example”. The significantly updated Maple Portal for Engineers does just that, incorporating many more examples and sample applications.  In fact, it has a whole new Application Gallery containing dozens of applications that solve concrete problems from different branches of engineering while illustrating important Maple techniques.

Designed as a starting point for engineers using Maple, the Portal also includes information on math and programming, interface features for managing your projects, data analysis and visualization tools, working with physical and scientific data, and a variety of specialized topics.

 

Geographic Data

You can now generate and customize world maps. This for example, is a choropleth of European fertility rates (lighter colors indicate lower fertility rates)

You can plot great circles that show the shortest path between two locations, show varying levels of detail on the map, and even experiment with map projections.

A new geographic database contains over one million locations, cross-referenced with their longitude, latitude, political designation and population.

The database is tightly linked to the mapping tools. Here, we ask Maple to plot the location of country capitals with a population of greater than 8 million and a longitude lower than 30.

 

There’s much more to Maple 2017. It’s a deep, rich release that has something for everyone.

Visit What’s New in Maple 2017 to learn more.

3 4 5 6 7 8 9 Last Page 5 of 78