ecterrab

13431 Reputation

24 Badges

19 years, 361 days

MaplePrimes Activity


These are replies submitted by ecterrab

Hi

In order to help you it is kind-of-mandatory to be able to reproduce the problem. I see you are using the Physics package but I do not see how are you doing it, nor whether you are using the latest version (avialble on the Maplesoft R&D Physics webpage)

So could you just run a worksheet where the problem happens, and as soon as it happens save the worksheet and attach it to your post (you can edit your post, then click that green vertical arrow to attach a file) or clice the "Reply" button and attach the worksheet. From there we will probably be able to resolve the issue whatever it is.

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

@Christopher2222 , @acer 

I updated the workaround posted earlier today with a simpler version of it, that should also work in versions so older like Maple 12, and that automatically resolves the convert / frontend / type, etc. issues you mentioned Acer. Of course one may prefer to wait until an official patch for Maple 2015 is available. But if I were worried today or have a version of Maple prior to Maple 2015, I would install the workaround with no worries.

@Axel Vogt 

Thanks for your kind comments :) Best.

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

@Christopher2222 

Above your comment there is a workaround that works in general, and does not require loading Physics.

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

@Christopher2222 

There is a workaround that works for all of Maple 2015 <-> Maple 9.5 and does not require loading the Physics package.

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


Contents edited after reading comments below: This version of the workaround is simpler (a simplification implicit in Acer's comments), takes care of the problem mentioned by Christopher2222 that the workaround would work only in versions of Maple above Maple 12 (this one should work fine also in Maple 12 of 7 tears ago and also before that) and takes care, in a rather general way, of the possible objections presented by Acer in connection with redefining `+` (because through the macro it gets redefined back to itself).

 

So, having understood that the bug happens only when you input (see Paul de Marco in Maplesoft reply; the bug happens only when entering within an input line a `+ ` with more than 24 terms with some automatic cancellations etc.) a simple workaround is to make Maple input your `+` input. You can achieve that by redefining the `+` operator to just be itself (and then it is not you entering the `+`).

This is one way of implementing this idea, that automatically takes care also of type, convert, frontend, saving procs, etc. mentioned below in this thread

M := module () export `+`; option package; end module:

with(M):

macro(M:-`+` = :-`+`):

c := t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21-t0+t0+t22+t23

t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21+t22+t23

(1)

c := t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21-t0+t0+t22+t23

t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21+t22+t23

(2)

c := t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21-t0+t0+t22+t23

t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16+t17+t18+t19+t20+t21+t22+t23

(3)

We see that the three expressions are equal, the bug is not present, all works ok.

Regarding type, convert, frontend ...

map(type, [a+b, a*b], `+`)

[true, false]

(4)

All as expected

frontend(expand, [sin(a+b)+cos(a+b)], [{`*`, `+`, 'specfunc(anything, sin)'}, {}]);

sin(a)*cos(b)+cos(a)*sin(b)+cos(a+b)

(5)

convert(a*b, `+`)

a+b

(6)

proc (x, y) x+y end proc;

proc (x, y) :-`+`(x, y) end proc

(7)

The three above also return as expected, and frankly speaking I'd say that everything else normal that I could imagine too.

And this workaround works fine (fixes the problem) all the way from Maple 2015 back to Maple 9.5 (I tried it back till Maple 14, there is no older Maple working in current Mac computers).

Until an official patch is provided, the simplest thing, I think, is to have these three lines (the definition of M as a module, first line, you can use any name instead of 'M'), the line that loads this package (with(M))) and the line with the macro macro(M:-`+` = :-`+`), in your Maple initialization file and done with this one.


Download workaround.mw

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

@ThU 

Indeed solving algebraic equations that involve objects noncommutative with respect to `*` would be an excellent addition to Physics. And indeed is in the plans. I don't know if you are following the path: first we added `*`, `^` and diff, then Gtaylor, Simplify, next was Expand, followed by Normal, Coefficients, and more recently Factor. All these are Physics commands; they perform the corresponding operations on algebraic expressions involving noncommutative objects. In addition we moved some of this functionality directly into expand, combine and simplify, the lowercase standard Maple commands.

In view of A*B <> B*A, however, these are complicated algebraic problems. The recent introduction of Physics:-Factor, on the other hand, is a very promising development in connection with "solving algebrai expressions that involve noncommutative operators". I don't think this will be ready for the next Maple release though. Still, some first approach for this functionality will most probably be in place in the near future.

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

Updating this post: Yes we are aware of the "100 years of Einstein's presentation of the theory of general relativity", and today we added 58 more solutions to the database, now totaling 627 solutions, already in the pole position and stepping on the gas towars digitized and bringing alive in the context of the Physics packageall the metrics collected in the classic book "Exact Solutions to Einstein's equations, (2nd edition)". The metrics added today are from Chapters 22 and 23.

As usual, in order to have this new development installed right away, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

 

The necessary information is found in the previous reply, but since you also want the cartesian unit vectors to be displayed "with a hat over the letters x, y, z", that requires a little bit more. This is one way of doing it. Start as in the previous answer:

with(Physics:-Vectors);

[`&x`, `+`, `.`, ChangeBasis, ChangeCoordinates, Component, Curl, DirectionalDiff, Divergence, Gradient, Identify, Laplacian, Nabla, Norm, Setup, diff]

(1)

So set this macro to input things the way you want

_x = _i, _y = _j, _z = _k;

_x = _i, _y = _j, _z = _k

(2)

macro(_x = _i, _y = _j, _z = _k):

Next you want x, y and z with a hat on top. What follows is an interesting way of creating  because it is based on exploration; so, for instance, how is the system constructing the display of `#mover(mi("i"),mo("&and;"))`? You can investigate these things in general using the following:

uv := Typesetting:-Typeset(_i)

Typesetting:-mover(Typesetting:-mi("i"), Typesetting:-mo("&wedge;"))

(3)

lprint(uv)

Typesetting:-mover(Typesetting:-mi("i"), Typesetting:-mo("&wedge;"))

 

 

And once you know how this is constructed, you can construct the three objects you want with ease, in one go

seq(subs("i" = v, uv), v = ["x", "y", "z"])

`#mover(mi("x"),mo("&and;"))`

(4)

Now just proceed ahead as explained in the previous reply

`~`[`=`](Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;")), ` $`, _i, _j, _k)

Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")) = _i, Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")) = _j, Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;")) = _k

(5)

alias(Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")) = _i, Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")) = _j, Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;")) = _k):

And that is all. You can now enter vectors using _i, _j, _k, or _x, _y, _z (they both result in _i, _j, _k) because of the macro (2), and they are both displayed as (4) because of the alias (5):

[_x, _y, _z] = [Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;"))]

[Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;"))] = [Typesetting:-mover(Typesetting:-mi("x"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("y"), Typesetting:-mo("&wedge;")), Typesetting:-mover(Typesetting:-mi("z"), Typesetting:-mo("&wedge;"))]

(6)

_x._x, _x._y, _x._z

1, 0, 0

(7)

 

Download UnitVectors_(reviewed).mw

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

Updating this post: Today we added 77 more metrics to the database of solutions to Einstein's equations, totaling 569 solutions at this point, according to the plan of having in the database, digitized and alive in the context of the Physics package, all the metrics collected in the classic book "Exact Solutions to Einstein's equations, (2nd edition)". The metrics added today correspond to Chapters 21 and 22.

As usual, in order to have this new development installed right away, you need to update your Physics library from the Maplesoft R&D Physics webpage.

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

@J F Ogilvie 

Thanks for your kind comments :) But please let’s not forget that general relativity (GR) is indeed part of physics, and this post just happened to be about that, which doesn’t mean that physics in Maple is only about GR.

As people using the package know, Physics has basic and advanced functionality for Quantum Mechanics since it entered the Maple library, including a full implementation of anticommutative and noncommutative operators and functions, related operations (including functional differentiation), Commutators, Anticommutators, Creation and Annihilation operator commands, pre-defined and customizable algebra rules, a whole implementation of Dirac notation for vector calculus on a space of quantum physical states, … to mention but a few; the list of functionality available is really large.

Perhaps it is useful to point to some application examples on Quantum Mechanics posted in this Mapleprimes forum in the past, developed using the same Physics package (that today implemented this most thorough digital database in existence for solutions to Einstein's equations):

The following link is also interesting because it shows a balanced set of applications in different physics areas, and the section on Quantum Mechanics also features a subsection on the use of the Physics package in developing proofs regarding properties of operations between quantum operators, something I don't recall having seen before in any computer algebra system, commercial or brewed at universities

For completeness, this other link to a mini-course on computer algebra for physicists is somehow ambitious, in that it shows an entry point to using such a wide-range-of-areas package as Physics is, while at the same time it is a compact tutorial for people who - simply put - never used computer algebra

Regarding your suggestion on updating the values of the fundamental constants, we have been working on this too and also have good news: mainly the incorporation of the CODATA 2010 updates to these constants. This is not distributed with the Physics package updates though, since this development is - at the company - unrelated to the one of Physics.

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

Hi

I'm in the midst of some changes in the way D_ and d_ work, that will probably take care of this issue (your 'D') as well - hopefully returning with a solutoin to this thread tomorrow or after tomorrow.

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

These two commands, FindFormula in Mathematica and identify in Maple have some similarities: both receive numbers, and return algebraic exact expressions that, when evaluated numerically, result in the given numbers. These two commands, however, are different in relevant ways.

FindFormula receives a collection of numbers, typically the points of a plot, think a curve from A to B, and returns an algebraic expression that may contain floating point numbers and that when plotted reproduces that curve from A to B. To some point you can indicate the functions you would like to see in the algebraic expression.

In my opinion, this functionality of FindFormula is not more useful than the one for the same purpose found in the Maple CurveFitting package, in that both provide an algebraic expression that matches a given curve. The fact that FindFormula can include 'functions' in the expression, as opposed to the rational expressions used by CurveFitting doesn't make the result more useful, and generally speaking I tend to prefer a rational expression because it has more mathematical properties than non-polynomial / non-rational expressions.

The identify Maple command, on the other hand, aims at something different, that you cannot do with any interpolation or curve fitting command: it receives a single floating point number and returns an exact algebraic expression in terms of algebraic constants that when evaluated numerically matches the given number. For example, identify(2.596684952) returns 3+Pi-2*sqrt(Pi). For me this is really impressive, and useful in various contexts, as opposed to the curve-fitting functionality, present in both Mathematica and Maple, but of use in more specific contexts.

I know, I work for Maplesoft, and then there may be no way I could be entirely neutral, but I am doing my best in that direction, and still don't see the greatness of FindFormula in a context where there exists CurveFitting packages with so much functionality / features and doing actually more (but for the use of rational expressions that actually I tend to prefer as I said above).

So perhaps I am missing something here, but still don't see the big deal in Mathematica 10.3.0 regarding mathematical functions, but for the introduction of MathematicalFunctionData that is equivalent to the Maple FunctionAdvisor (introduced 12 years earlier) only regarding querying databases, but misses the whole set of algorithms that the FunctionAdvisor has for computing results that can never be found in any database (I mean: because there are infinitely many of them).

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

Yes, MathematicalFunctionData, introduced in Mathematica today, is a replica of the FunctionAdvisor introduced in Maple 12 years ago. More important: MathematicalFunctionData works querying a database while the FunctionAdvisor works taking advantage of some very advanced algorithms, not just querying a database.

Maple, for instance, has a full featured conversion network for mathematical expressions, which is independent of, and in addition, to the FunctionAdvisor, and for which Mathematica still has nothing equivalent. Hence, for instance, you can input FunctionAdvisor(specialize, erfc) (or any other function in place of erfc), or even give specific values to the functions's arguments, say as in 'erfc(1, z)', or even erfc(n, z) with assumptions on the function's arguments placed using assuming, and get results just not present in any database, including the conditions on the function's arguments such that the relationship holds.

Likewise, MathematicalFunctionData and the FunctionAdvisor can tell you about the branch cuts of mathematical functions, BUT the FunctionAdvisor can also tell you about the branch cuts of arbitrary algebraic expressions, because it uses algorithms, some of which are still unpublished research. Here again MathematicalFunctionData, or for the case any other Mathematica command, cannot do that type of computation, because it works by querying a database only.

Another item that springs to my mind is symbolic differentiation: both MathematicalFunctionData and the FunctionAdvisor can tell you about the symbolic derivative of a specific mathematical function. But then in Maple you can directly call the differentiation command diff and compute symbolic derivatives of arbitrary algebraic expressions. That is very-very unique and, again, it is based on algorithms, not just a database. Neither MathematicalFunctionData nor any other Mathematica command can do that.

Finally, while MathematicalFunctionData and the FunctionAdvisor can tell you about the differential equation behind a specific mathematical function, Maple has the PDEtools:-dpolyform command that can write the system of partial differential equations behind an arbitrary mathematical expression involving mathematical functions, possibly nested and combined with any kind of algebraic operation, including fractional and symbolic powers. The FunctionAdvisor takes advantage of that, and here again nothing like that exists in Mathematica. In fact this functionality is not possible without DifferentialAlgebra another thing implemented in Maple in 1996, almost 20 years ago, and still not present in Mathematica.

Regarding FindFormula, it is true, we do not have something like this - fitting a curve against preferred functions, but then Maple has a whole CurveFitting package , that fits curves to rational expressions in a featured way, and also the identify command, which has similarities to FindFormula in that it fits a number to an algebraic expression (ADDED AFTERWARDS: another comment below explains the similarities and differences between FindFormula and identify).

About the residue command: that is not related to the new Mathematica and falls in the class of "a command that exists in the two systems since a long time" - you may want to track the lack of a result (what you posted) as a bug, but I don't see that related to the core of this thread, that is, the new functionality for mathematical functions in the last version of Mathematica.

In summary I do think that MathematicalFunctionData and FindFormula are good steps ahead but in my opinion, taking all together into acount, Mathematica is still concretely behind Maple regarding functionality for mathematical expressions that depend on the properties of the mathematical functions (the paragraphs above).

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

@vv 

The updated library is used by the whole system. It contains in fact all the changes and fixed in the Physics, DE and Mathematical functions that are present in the version of Maple under development.

After you install it, you will obtain the LambertW solution because this update consisted of that, ie: a tweak in the computational flow such that instead of returning a solution as soon as it is found, the code now searches for alternative solutions when it detects that the solution found so far involves a RootOf with an argument nonpolynomial in _Z.

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

I just gave a look at the computational flow and changed it a tiny bit so that in situations like this one the code now prefers to try alteranatives instead of returning a solution that involves a RootOf with an argument that is non-polynomial in _Z, and in that way, in this example, it finds the more tractable solution in terms of Lambert functions.

The update is available to everyone as usual in the Maplesoft R&D webpage for Differential Equations and Mathematical Functions. So we now have, systematically,

First 36 37 38 39 40 41 42 Last Page 38 of 60