ecterrab

14540 Reputation

24 Badges

20 years, 22 days

MaplePrimes Activity


These are replies submitted by ecterrab

@Arny 

To get the right display, enter Setup(mathematicalnotation = true). But mostly: you need a more modern Maple.

Time ago, these integrals were computed as undefined. Nowadays they are computed as a distribution (Dirac). I don't remember in which version I introduced Diracs but probably Maple 2015, or Maple 18. Note as well that there are updates for the Physics library distributed in the Maplesoft R&D Physics webpage. Physics is almost duplicating its size at every release till 2016 ... and it is still growing in many directions.

These updates are posted basically every week, sometimes several times per week. These updates started being distributed with Maple 18 and there is a link for updating Maple 18 in that R&D page - I don't remember if it contains this change that makes int return Diracs. Anyway there is no update for Maple 17, that is by now somewhat old.

PS: a note on my previous reply, you can save some typing using [x, y, z] =~ -infinity..infinity instead of repeating the integration range three times as I did in the reply worksheet.

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

 

@Arny 

Download VectorIntegral.mw

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

@Louis Lamarche,  tomleslie

I misread here! Sorry. The problem you mention was indeed an issue. In Physics, the order for spherical coordinates is [r, theta, phi] while in VectorCalculus is [r, phi, theta], this is taken into account in one of the conversions (to Physics) but was not taken into account in the other conversion (to VectorCalculus).

This issue in the conversion to VectorCalculus of a vector of the Physics package in spherical coordinates is fixed now. The fix is available to everybody within the updated Physics library distributed in the Maplesoft R&D Physics webpage.

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

Very nice everything!

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

@_Maxim_ , Axel Vogt,

Big oops. You are both right, this conversion of MeijerG to hypergeom has a problem for abs(z) > 1 in general, regardless of Re(z) < 0, case p=q and m+n<=p. Have you noticed any other case, so that when fixing this conversion I can check them as well. Thanks

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

@_Maxim_ 

The plots, as well as the original example of this post, are correct for Re(z) < 0 or abs(z) < 1, not just the latter. The problem is in rather ancient code from 1996 ... I will give this a further look.

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

@Markiyan Hirnyk 

The improvements mentioned by Eithne are in the computation of symbolic (so exact, not numerical) solutions to "PDEs & Boundary Conditions" problems. I just posted a set of examples illustrating these improvements.

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

@MrMarc 

The article behind this map of topics, linked in the post, is what gives context to the map. It says right after in its title:  "Explore the deepest mysteries at the frontier of fundamental physics, and the most promising ideas put forth to solve them". The theories mapped, thus, refer to fundamental physics only, as the map itself shows. This map is indeed an excellent summary of the ideas being explored in the area, that not surprisingly revolve around general relativity in one way or another. Mainly on how to unify this theory of spacetime with quantum mechanics, the topic of Nima's presentation, Quantum Mechanics and Spacetime in the 21st Century, also linked in the post.

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

@Pascal4QM 

:) Thanks. This problem you indirectly focused, however, after some discussion, we agreed at this end that it is indeed unexpected behavior in the kernel. Not OK. In the example mentioned F[1,2](x,y) should return f[1,2](x,y). The issue is now tracked to be fixed in the kernel. Meantime, and only for Physics tensors, the library (not kernel) tweak I introduced yesterday works around the issue.

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

@_Maxim_ ,  Pascal4QM,  vv

Yes, your suggestion works, but there is a consistency problem. Consider

with(Physics);
Define(F[mu, nu] = Matrix(4, symbol = f));

Now, without defining f as a procedure, just enter

F[1,2]
                  f[1,2]

Good. Next:

F[1,2](x,y)
                 F[1,2](x,y)

I was expecting f[1,2](x,y). This is the problem I referred to in my previous reply, perhaps not clearly. I expect F[1,2] to be evaluated, so become f[1,2], then f[1,2] to be applied to (x,y).

Indeed this problem is not visible when you define f itself as a procedure, what you _Maxim_ and PascaQM are saying, eg one that makes use of its indices for the purpose of Pascal's example (see vv's reply, many Maple procs are defined that way, for instance, Physics:-d_),

So why my fuzz? Perhaps because these things, if let in place, for me they attempt against the intuition on how the language works.

Anyway, I fixed this now, as explained in the previous reply, so that we now receive f[1,2](x,y) even when f is not a procedure. The adjustment in the code is available to everybody now, as usual in the Maplesoft R&D Physics webpage.

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

 

This is indeed a typo in the code, not in the rewriting in terms of abs  (conversion, I dislike this word ...) but in the rewriting of arctan(y, x) in terms of argument. The network works avoiding repetition of formulas when possible, and arctan goes to argument, and from there to abs. Indeed, in addition, the formula is only valid if both x and y are reals. I will fix this and see if this can still be included in the upcomming 2017.3.

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

@wndrslope 

First of all on how it works: the coordinates used by the Physics:-Vectors commands are fixed in that, for cylindrical, they are always [rho, phi, z] and cannot be changed. For spherical they are [r, theta, phi], for cartesian they are [x, y, z] and they cannot be changed too. Their definitions are on the pages ?Physics:-Vectors and ?Vectors,ChangeBasis. The corresponding unit vectors also cannot be changed. So, even if you enter Coordinates(cylindrical) followed by Coordinates(X = [r,theat,z,t]), the first call sets an alias(X = (rho, phi, z, t)) and the second one resets that alias to alias(X = (r, theta, z, t)), and regardless of your calls to Coordinates, for the command Vectors:-Nabla, the cylindrical coordinates are always rho, phi and z.

Now, why would you want to use [r, theta, z] with the geometrical meaning (and the corresponding mathematical relationships) of cylindrical coordinates instead of [rho, phi, z]? It is only a difference in 'name' and 'look'. Well, the answer could still be any, say you find more comfortable to write r instead of rho, or the book you are using uses r, theta instead of rho, phi. So here is what you could do to make Vectors:-Nabla and all the commands of Physics:-Vectors work with a different name and look.
 

Load the package

with(Physics[Vectors])

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

(1)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(2)

For example, set the position vector in cartesian coordinates and basis

R := _i*x+_j*y+_k*z

_i*x+_j*y+_k*z

(3)

Now you want to rewrite R in cylindrical coordinates using r, theta instead of rho, phi. The trick involves two easy steps: 1) introduce so-called local versions of r, theta and 2) set an alias with them pointing at rho, phi

_local(r, theta)

Warning, A new binding for the name `r` has been created. The global instance of this name is still accessible using the :- prefix, :-`r`.  See ?protect for details.

 

Warning, A new binding for the name `theta` has been created. The global instance of this name is still accessible using the :- prefix, :-`theta`.  See ?protect for details.

 

alias(r = rho, theta = phi)

Now, you see that theta and phi represent the same thing, phi, and they are both displayed as theta

theta, phi

theta, theta

(4)

theta-phi

0

(5)

The same for r and rho: they both represent rho and they are both displayed as r

r, rho

r, r

(6)

r-rho

0

(7)

And so, you have what you wanted: Vectors:-Nabla uses [rho, phi, z] but you  work with [r, theta, z] that represents [rho, phi, z] but is displayed as [r, theta ,z].

 

Examples:

Change basis (only the basis unit vectors) and you see that the transformation formulas show theta instead of phi

ChangeBasis(R, 2)

(x*cos(theta)+y*sin(theta))*_rho+(cos(theta)*y-sin(theta)*x)*_phi+z*_k

(8)

Change basis and also the coordinates, now you see r instead of rho multiplying the unit vector

ChangeBasis(R, cylindrical, alsocomponents)

z*_k+_rho*r

(9)

Take the gradient of a function and you see the correct gradient in cylindrical coordinates, expressed using r and theta instead of rho and phi.

Nabla(f(r, theta, z))

(diff(f(r, theta, z), r))*_rho+(diff(f(r, theta, z), theta))*_phi/r+(diff(f(r, theta, z), z))*_k

(10)

Now that it is clear how to do it, you can do the same for the unit vectors

_local(_r, _theta)

Warning, A new binding for the name `_r` has been created. The global instance of this name is still accessible using the :- prefix, :-`_r`.  See ?protect for details.

 

Warning, A new binding for the name `_theta` has been created. The global instance of this name is still accessible using the :- prefix, :-`_theta`.  See ?protect for details.

 

alias(_r = _rho, _theta = _phi)

Try again:

Nabla(f(r, theta, z))

(diff(f(r, theta, z), r))*_r+(diff(f(r, theta, z), theta))*_theta/r+(diff(f(r, theta, z), z))*_k

(11)

You see it came literally, as _r and _theta, without the hat. To make them appear with the hat, the trick is slightly different. First undo the previous local and alias

alias(_r = _r, _theta = _theta)

_r := :-_r; _theta := :-_theta

_r

 

_theta

(12)

Now copy and paste the objects that look the way you want for the unit vectors, ie the right-hand sides of the above

_local(`#mover(mi("r"),mo("&and;"))`, `#mover(mi("&theta;",fontstyle = "normal"),mo("&and;"))`)

alias(`#mover(mi("r"),mo("&and;"))` = _rho, `#mover(mi("&theta;",fontstyle = "normal"),mo("&and;"))` = _phi)

Try again

Nabla(f(r, theta, z))

(diff(f(r, theta, z), r))*:-_r+(diff(f(r, theta, z), theta))*:-_theta/r+(diff(f(r, theta, z), z))*_k

(13)

So now you have the coordinates and unit vectors displaying as you want and representing the cylindrical coordinates and unit vectors.

 

CAVEAT: you are now using r and theta representing the cylindrical coordinates rho and phi. That works but you need to be careful if you use the spherical coordinatese r and theta. You can still use them but to distinguish from the cylindrical versions you need to preceed them with :- so that theta <> :-theta, even when they are displayed the same way

theta-:-theta <> 0

theta-:-theta <> 0

(14)

r-:-r <> 0

r-:-r <> 0

(15)

This is the gradient in spherical coordinates

Nabla(f(:-r, :-theta, phi))

(diff(f(r, theta, theta), r))*_r+(diff(f(r, theta, theta), theta))*_theta/r+(diff(f(r, theta, theta), theta))*:-_theta/(r*sin(theta))

(16)

And you see the problem: phi is displayed as theta, because we set it to be that way when using cylindrical coordinates, and the unit vectors _phi and _theta are displayed the same way! This is due to the choice of different coordinates, you choose to display cylindrical coordinates the way Nabla uses for spherical coordinates too. Anyway, you get the point, on how to do it, and the difference: when declaring local variables, you refer to the original variables using :- as prefix.

NULL


 

Download ChangingDefaultLookOfCoordinates.mw

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

@wndrslope 

Yes it is possible, Setup(coordinates = cylindrical) or Coordinates(cylindrical) will both set X = (rho, phi, z, t), or Coordinates(Y = cylindrical) will do the same with Y. And you can always set Coordinates(X = [a,b,c,d]) where a, b, c, d can be any object of type 'name' (see ?type,name). The advantage of using rho, phi, z is that the Physics:-Vectors use those with the exact geometrical meaning of cylindrical coordinates (this meaning is automatically taken into account, for instance, if you Setup(geometricdifferentiation = true)). The documentation of the package has many pages (the Physics environment/package has many commands and some conventions) but all this is explained in the respective pages.

One thing to the side, sometimes relevant: for the signatures +++- or ---+, the position of the time component is 4. If however you want to work with time in position 1, you need to change the signature to either -+++ or +---; for that you use for instance Setup(signature = `-+++`).

And a note about Setup : this is a command with a myriad of options, all explained in ?Physics,Setup, as a mimicry of what we do with paper and pencil: we set a number of conventions in our mind, then proceed computing. On the worksheet, you set these conventions using Setup. What people sometimes miss is that if you enter Setup(); so without any arguments and press enter, an applet pops up displaying all  the settings valid at that moment, and you can change them directly from the applet. This makes setting things simpler: you can rapidly see all the current settings, organized, and change them sometimes with a few clicks.

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

@_Maxim_ 

The FunctionAdvisor command is for retrieving mathematical information in a computationally active way (not just display it), and it does that in two different ways

  1. it return mathematical information in an organized way, grabbing it from all around the Maple library
  2. it extends that functionality to algebraic expressions.

For an example of 1. enter, for instance, FunctionAdvisor(GAMMA). For an example of 2. see, for instance, ?FunctionAdvisor[branch_cuts].

Now, when it is not the case of "2.", e.g. when computing just what a Maple command already computes naturally, for example to compute asympt(hypergeom([1, 1], [2, 2], -z), z) , the idea is to use the command. Of course the FunctionAdvisor - that for asymptotic expansions only uses asympt (ie there is no "2." functionality in this case, asympt is already the command for that purpose) could also just forward the stuff with "-z" argument to asympt, of course with no gain whatsoever. Either way the point remains that what the FunctionAdvisor does regarding asymptotics is just what asympt does, no more, because it just forwards your input to asympt.

 

 

@wndrslope 

Differential operators in general, be the ones that come predefined in the Physics package as d_ (used tensorially as in d_[j]) or D_ (for curved geometries), the dAlembertian, or Nabla (from the Physics:-Vectors package), or any differential operator you define using Setup (in this case you indicate also who are the related differentiation variables) are all OK, ie you can do algebraic operations with them as you do with noncommutative operators, as shown in the previous reply.

Now, as soon as you introduce differentiation operators in your algebraic expressions, you need to pay attention to the differentiation variables that correspond to each of them.

For d_, D_ (these are used mostly as tensorial indexed operators, but you can use them as total differentials as well) and the dAlembertian, they are the ones you set using Setup, for instances as Setup(differentiationvariables = X), that automatically defines X as a coordinate system constituted of variables x1, x2, x2, x4 (via alias, from now on you can refer to these coordinates using X directly).

You can set more coordinates systems using Coordinates(Y), or for instance Setup(coordinates = Y). Or also Coordinates(Y = Cartesian) (can also be spherical or cylindrical), in which case you will have Y = [x, y, z, t] or etc. You can also make the coordinates be whatever you prefer, for instance: redo this definition as Coordinates(redo, Y = [r, s, u ,v]), etc. You can also change the dimension for instance via Setup(dimension = 3) and also indicate that your geometry is just Euclidean (default is Minkowski) via Setup(metric = Euclidean).

Then you can enter these operators in products as d_[j]( A(X) ), ie applied, or as d_[j] * A (X), ie as a product that you can make it be applied whenever you want using Library:-ApplyProductsOfDifferentialOperators.

For Nabla, (the Physics:-Vectors:-Nabla command), the differentiation variables are predefined: they are Cartesian, cylindrical or spherical, the dimension is assumed to be equal to 3 and the command knows the relationship between the three systems, so you don't need to define anything, just use it, eg as in Nabla(A(x,y,z)), ie applied, it is the gradient of A(x,y,z), or Nabla * A (x,y,z), that you can make it be applied whenever you want via  Library:-ApplyProductsOfDifferentialOperators. 

Note that all this works perfectly well when A is also a noncommutative operator (e.g. a matrix whose elements are not specified), and also when A_ (note the postfix '_') is a vector, that can also be noncommutative, eventually representing a vector of matrices, in which case Nabla. A_(X) is the divergence and Nabla &x A_(X) is the curl (besides Vectors:-Nabla you also have the commands Vectors:-Divergence and Vectors:-Curl as well as Vectors:-Laplacian, all representing the same things you can represent using Nabla).

Now: the two classes of differential operators above, that you can use on noncommutative objects e.g. representing abstract matrices, require that the space you are working on has some specific dimension, either 3 in the case of Nabla, or 4 (the default when you load Physics), that you can change to any positive integer using Setup. So, in case you want to "Nabla operate" in more, or less, than 3 dimensions, use d_[j] and set the space to Euclidean: d_[j] will just be a tensorial representation for Nabla.

And what if you want as well to work with a differential operator that operates with an abstract - not indicated - dimension?

For that, new in Maple 2017, you can set differential operators and corresponding differentiation variables at will. Then use them applied or within products, as explained above for the predefined differential operators, so that again you make the operator be applied only when you want using  Library:-ApplyProductsOfDifferentialOperators. For examples of this, again see the help page for Physics:-Setup (at the end).

Important: say you set p to be a differential operator with differentiation variable x, as in Setup(differentialoperators = [p, [x]]). Then, in addition, you can assign to p a program, for instance p := f -> diff(f, x), so that when p gets applied some concrete action you want actually happens.

I'm writing this from the top of my head, no examples, no worksheet, assuming that this plus the previous reply completes the picture, but if it doesn't please post here your doubt more concretely and I will produce some related examples.

All in all, the ability to compute with products of noncommutative objects, be them differential operators or not, is rather advanced in Maple. Using this functionality to represent matrix abstract algebra is pretty much what we do in quantum mechanics or quantum field theory every day. Generally speaking, every quantum (ie noncommutative) operator is assumed to admit a matrix representation that can be finite or infinite dimensional, and basically all the commands for working algebraically with these objects already exist in the Physics package.

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

 

First 34 35 36 37 38 39 40 Last Page 36 of 64