ecterrab

10699 Reputation

20 Badges

16 years, 199 days

MaplePrimes Activity


These are replies submitted by ecterrab

@nm 

Maybe this is a good opportunity: why don't you make a post here in Mapleprimes, where you indicate what you would have liked to find in the help system regarding this issue, including the kinds of expressions to match that you'd like to see in that page. Others may want to add expressions to be matched. Then we (at Maplesoft) can move into creating that help page, including those examples and any other that may also seem useful. In the end, the page that would have been useful for you will be there in the system for everybody.

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

@nm 

For that reason I mentioned "note that denominators are represented as negative powers". You seem to have not noticed the comment. It is at the beginning of my previous reply. It is the same reply where you missed the example.

Taking that comment into account, for instance subsindets[flat](expr, And(`*`, satisfies(u -> andmap(membertype, [Or(exp(anything), exp(anything)^(-1)), anything^fraction], [op(u)]))), G) does what you want in one go. Note the use of Or, also mentioned in that reply. This language is remarkably flexible and expressive, but you need to know what is what you want to match, and for that, how the desired expression is represented.

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

@nm 

No. I showed - in the reply you are replying to - how to match that pattern for "any number of operands, 2, 3, or other", and I showed you achieve that by not saying 2, 3, or any fixed number. In that sense, what I showed is just the equivalent of what you show in Mathematica. If you could actually refer to what you are replying and telling what part wasn't clear there? By the way I am only talking about matching in Maple, and am not interested in how you do that in Maxima, Sage, Reduce, Mathematica or others, nor am curious about comparisons. Only showing you how to do it. In Maple.

Repeating then: you need to know clearly what is what you want to match. And there is nothing like "the pattern is meant to be ..." Either it is, or it is not. And both an implicit 1 in a product,  with or without, a fixed or unlimited, or selected different numbers of more operands, are all straightforward types. Then using the tools I mentioned in the previous reply all of them look easy, as in the examples I showed (you seem to have missed them?).

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

@nm 

The types radical and sqrt may or not match a more general expression; you still have anything^fraction. Then you need to familiarize one bit with the representation: denominators are actually negative powers. This single example may be all you need to understand what works and why not when it doesn't:

> op(0 .. -1, 1/sqrt(exp(x)))

                                           `^`, exp(x), -1/2

Then your original question asks about "a product of three operands only, where one is an exponential one is a a radical, the third one is anything". That is what  exp(anything)*anything*sqrt(anything) isThe "three operands in a product" are matched with `&*`(anything$3), but in your expression, I do not see any product of three operands, so Maple gives up before going into the contents of any product.

Summarizing: a) you need to make more precise what is what you want to match, and b) numerators and denominators are not the same things, neither radicals sqrt or fractional powers. Perhaps this example helps:
 

# Your expression
> expr := (-x + sqrt(9*x^2*exp(2*c) + 8)*exp(-c) + 99)/(4*x) + (a*sqrt(z) - 99 + sin(c*sqrt(r + 4) + 20))/3 + 10 + 1/(c + exp(-x)*sqrt(exp(x))) + sqrt(h):

# Apply some G to products of "any" number of operands, where there is an 
# exponential and a fractional power

> subsindets(expr, And(`*`, satisfies(u -> andmap(membertype, [exp(anything), anything^(fraction)], [op(u)]))), G);

(-x + G(sqrt(9*x^2*exp(2*c) + 8)*exp(-c)) + 99)/(4*x) + a*sqrt(z)/3 - 23 + sin(c*sqrt(r + 4) + 20)/3 + 1/(c + G(exp(-x)*sqrt(exp(x)))) + sqrt(h)

This reply applies as well to your next-other question about the same: it is all about the type you are matching, only, and when constructing structured types it helps using the And, Or, Not operators, together with type suffices, as shown above; frequently in conjunction with andmap and ormap. It is a very powerful approach to write types. Then use subsindets.

Note: membertype cannot be thrown over a product `*`, that is why you need to [op(u)] in the example above. To avoid these subtleties you can use the undocumented `tools/membertype`, that you can throw over anything that has any kind of structure (ie non-atomic objects, or for which op returns something)

 

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

@Rouben Rostamian  

Indeed. I noticed that yesterday, when replying here, and tracked the problem in the Maplesoft database. Unfortunately it is not something I can fix, but can tell you what is at the root: if you use 1D-Math display for input lines, as you do in this worksheet, the input does not go through the new latex command (I call that the "library side") and is done in the GUI directly using the {lstlisting} environment; and there, things like \{ \} are displayed "as such". Until this problem is fixed in the GUI (not something I can distribute within the Maplesoft Physics Updates) you have two options:

  1. use 2D-Math display for input lines, and the translation of that input will go to the library side (the new latex command) and be translated properly without this issue.
  2. remain using 1D-Math display for input lines but then you need to remove, manually, the `\` that preceedes `{` and `}`; as said until this is fixed in the GUI which I suppose will happen in 2021.2 or Maple 2022.

My suggestion: go with 1. The 2D-math display for input lines is currently pretty good. When your worksheet is already using 1D-Math display of input, you can still get 2D-Math display by right-clicking the input line followed by "Convert To > 2D-Math input".

On your comments: thanks, Rouben. And indeed I also put special care in making the .tex more readable.

Best!

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

@itsme 

The Physics Typesetting is too advanced to be used as a template and relies on internal Physics subroutines. But giving a look for instance to `print/casesplit/ans` you can get the idea: s is a Typesetting structure representing "how it is going to  look"t is the actual thing being displayed (so not how it looks), then Typesetting:-mcomplete(s, t) looks the way you want (like s), and copy & paste correctly (like t). So all you need is to experiment a bit with creating a Typesetting structure that looks the way you want. For that, you can use the palettes.

Example: use the Fenced palette to produce <A, B> with good typesetting, then mark it with the mouse, right-click > 2D-Math > convert to atomic variable, then lprint it, and you will get this:

`#mrow(mfenced(mrow(mi("A"),mo("&comma;"),mi("B")),open = "&lang;",close = "&rang;"),mo("&InvisibleTimes;"))`

Indeed, copy that cryptic stuff and paste it, press enter, and you see the nice <A, B>. You can even play around adding or removing stuff to see how you can tweak it. 

Next remove those enclosing `` and # and suffix all functions with Typesetting:-. You will now get a Maple Typesetting function, that displays the same way:

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mi("A"),Typesetting:-mo("&comma;"),Typesetting:-mi("B")),open = "&lang;",close = "&rang;"),Typesetting:-mo("&InvisibleTimes;")

Now that you have how it should look you insert this block in your print/foo to produce that s. Then construct the t, that is the easy part - say for f([a,b,c]) ,t is just that, f([a,b,c]). Taking that `print/casesplit/ans` as template, next is to return using Typesetting:-mcomplete. And you get what you want. After one or two you see you can produce excellent print/foo routines with ease. 

Finally, a tip for taking advantage of typesetting already coded, that you see there. Suppose you want to reproduce the typesetting of a Ket. Go with this:

> lprint(Typesetting:-Typeset(Ket(A)));

Typesetting:-mcomplete(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mspace(width = "0.3em"),Typesetting:-mi("A"),Typesetting:-mspace(width = "0.3em")),open = "&verbar;",close = "&rang;"),Typesetting:-_Hold([Physics:-Ket(A)]))

That is mostly all you need. You see the s and the t you can use as you see used in print/casesplit/ans. 

It's been some years now that I am about to write a new Physics export, an Applet so that one could insert "how it should look" and "what it is" and get a related print/... routine ready for use. Such a thing would be useful in Physics where the notation can be rather intricate.

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

@itsme 

What I can tell for sure: if it is doable in current Mathematica, it can either be done with ease, rigth away, using Physics, or the developments necessary for that can only be a small few.

But the most important thing: I have a working style that is about 'curiosity' and 'hands-on', some people call it 'experimental'. The references (arxiv and etc.) are of course relevant, but not a match for that working style. References only after I can experiment with the problem. Focusing one or two things at a time render results faster than focusing many (I can do that but any reply becomes a "papiro"). Then, in that way, my experience at least is that achievements start to pile rapidly and in surprising ways.

To move forward then I'd need from you a worksheet with the steps you know how to do, and where is that you get stuck - plus what is what you'd expect. As you did in this post at the beginning.

Answering the question you present at the end, see ?print, and where you read "there is a limited facility ..." read "There is an extremely powerful facility ...". The page is out-of-date; currently, a mixture of `print/foo` & the Typesetting package has transformed `print/foo` into a marvel.

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

Have you seen this Mapleprimes post: "The Zassenhaus formula and the algebra of the Pauli matrices"? It has the kind of approximation using expansion similar to what you are mentioning.

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

@Rouben Rostamian  

I don't want to enter a debate about this, but I don't think the interpretation of the wiki page is as you are saying.

Here is another page by people I respect where I read the same, perhaps more clearly said: "The use of dyadics is nearly archaic since tensors perform the same function but are notationally simpler."

This other one is from math.stackexchange: "Dyadics and polyadics are a fantastically archaic way, due to Gibbs of thermodynamics fame, to denote and work with linear transformations and tensors in general."

The word dyadic does not appear in the book on Statistical Mechanics by Feynman, nor in the ones about Fluid Mechanics and Electordynamics of Continuous Media by Landau and Lifchitz. I mentioned that about the so-complete Landau's Course of Theoretical Physics. All these textbooks work with tensors, something implemented very well in Maple - see ?Physics,Tensors.  

All in all, yes, there are books as you say that still use dyadic notation but I (personally) don't think they represent modernity as you seem to say. Yes, I realize too that you feel different about this; there is nothing wrong, diversity of opinions.

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

 

@Rouben Rostamian  

I can see I read your post too fast, missed what you were talking about - Nabla is certainly not the answer to your question, which indeed is more like a request for a feature, not a question. Sorry for that.

By the way, tensor products exist in Physics, but using Dirac's notation, see the help page ?Updates,Maple2019,Physics.  That notation can be mapped one to one into 3D vector notation (equivalent to the dyadic notation you are mentioning) . I will think about your request. I note however that I never heard of people in need of dyadic vector notation. People, e.g. working with continuum mechanics as you say, frequently use tensors. Regardless of opinions, it is a fact that the whole collection of books on Theoretical Physics by Landau & Lifshitz, which use tensors all around, does not use dyadic notation. 

Also, from the Wikipedia help page: "Dyadic notation was first established by Josiah Willard Gibbs in 1884. The notation and terminology are relatively obsolete today." If I were to point out a hole in Physics[Vectors], the main development priority, I'd mention Vector Integral calculus.

Anyway, as you probably know, Physics is a project I care about a lot but that takes time, working alone on it, and with so many areas into which extend. For Maple 2021, particle physics, strengthening all around, and more documentation examples, were the focus. I need to come back to this less advanced but in some sense with more frequently used functionality like Integral Vector Calculus.

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

@mthkvv 

I returned to this today, and have a few comments. I fail to see the problem formulated as in the book. Instead of 96.5 you start from some other expression,

where, in addition, you missed the red dot (multiplication) you see inserted in this image above. The way you entered, %g_[determinant])(...) was a function, not a product, and that generated that error message about the indices (so not an index issue, the error message is correct, but an input issue in your worksheet).

In my previous reply, I suggested a step-by-step based on entering 96.5, that is 

So, define your t[i,k], your h[i,k,l] as in the book, then isolate t[i,k] etc. I am not sure the steps I outlined in the previous reply will take you to 96.8, I didn't try, but if you formulate this correctly I can help you in doing that derivation in the computer.

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

@nm 

The issues you mention now are those I mentioned, to be resolved in a next Updates (v.977).

About breqn, I respectfully disagree. I find it nowadays an excellent package. By the way, the use of breqn passed almost 3 months of intensive testing in the beta forum, and passed that test with flying colours. As an example of that, see this Mapleprimes post.

Best

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

@Sradharam 

The way to go with computer algebra systems is to type a couple of words in their help system. Try that. Type Lie algebras in Maple's help. You will see two packages popping up, not one. DifferentialGeometry, the other package, is the state-of-the-art. That said, your statement of the problem is also unclear. What do you mean, exactly, by "Lie subalgebra for finding optimal solutions"? You can help people help you by clicking that green arrow and uploading a worksheet with your problem formulated, up to what you know how to do it, and then text with your question.

So please check the help system, and if what you need is not found in the help pages (or you are lost in the amount of them), please post a worksheet with your problem; people here will try to help you.

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

 

@subzero 

Also, in 3-D the Weyl tensor has all its components = 0. BTW, in the input that results in (12), it should be Ricci, not Ricch.

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

@subzero 

Setup(dimension = 3). Check the help page of Physics:-Setup

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

1 2 3 4 5 6 7 Last Page 2 of 52