ecterrab

14550 Reputation

24 Badges

20 years, 71 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi

What started as Physics:-Latex, evolved as user-level Latex, will probably be replacing the lowercase 'latex' command of previous releases. But this is not a Maple 2020 project, that is why there is no help page for it in the current release. This is a new project, that started a few months ago, The information you are asking is as follows (where you read latex, think the Latex distributed for Maple 2020 within the Maplesoft Physics Updates). Note these are arguments for Latex:-Settings, not for the Latex command.

  • cacheresults : all results by the internal latex subroutines are cached, for performance, so the translations are computed only once. However, if you are changing things in your worksheet that affect the way things are displayed, previously cached results may prevent you to get different LaTeX translations for the same input. To avoid caching results pass "cacheresults = false".
  • invisibletimes : sets the string used to represent the product operator, by default " ". That matches the default of the LaTeX typesetting system where no spacing is placed between the operands of a product, so a*b is displayed "ab". To have a small space between the operands of a product you can use invisibletimes = "\\,"
  • leavespaceafterfunctionname : default value is false, if set to true no \! LaTeX negative spacing command will be placed between a function name, say F and the parenthesis \left( \right) surrounding the function's arguments.
  • powersoftrigonometricfunctions : default value is mixed, other possible values are textbooknotation and computernotation. With the value mixed, "sin(x)^2" is translated to LaTeX as \sin^2 x and "sin(x + y)^2"to \sin^2(x + y)". With the value textbook, in addition, inverse trigonometric functions are translated to LaTeX with the notation that uses the name of the corresponding trigonometric function power -1, and with the value computer the translation is an exact replica of what you see displayed in the Maple worksheet.
  • spaceaftersqrt : default value is true, to insert or not a LaTeX small spacing command after a square root when it is an operand of a product.
  • usecolor : default value is true, so that colors in the worksheet are translated as such to LaTeX.
  • useimaginaryunit : default value is the one shown by "interface(imaginaryunit)", that in Maple is the capital letter I. This setting can be used to indicate the use of a different symbol when translating to LaTeX.
  • useinputlineprompt : can be true or false, to put or not a prompt at the beginning of Maple input lines when using File -> Export -> LaTeX.
  • userestrictedtypesetting : default value is false; if set to true, only a restricted form of typesetting, like the one used in the input lines of the Maple help pages, is used when translating to LaTeX.
  • usespecialfunctionrules : default value is true; if set to false, no typesetting for the notation of mathematical functions is used.
  • usetypesettingcurrentsettings : default is false; if set two true the Typesetting rules set in the Maple worksheet are not override by latex.

In the final version, probably before the end of this month there will be a couple more of options, mainly to provide more control over the automatic linebreaking and to optionally use the CTAN LaTeX tensor package to typeset tensors (instead of the exact LaTeX translation of how you see tensors displayed in a Maple worksheet).

For all the good of this new Latex command and its settings, the most relevant thing of this project, however, is the rewritten File -> Export -> LaTeX (involves java files, cannot be distributed within the Physics Updates - for this you will need to wait for the next Maple release), in turn based on this new Latex.

In brief, with the new File -> Export -> LaTeX  (as said, not the ones you have in Maple 2020) you can produce LaTeX versions of course lessons or entire scientific papers directly in the Maple worksheet, combining the what-you-see-is-what-you-get editing capabilities of the worksheet/document with the Maple computational engine to produce mathematical results:

  • This new File -> Export -> LaTeX handles equation labels that can appear in the output and also referred to within the text and the input lines. So feel free to use and refer to equation labels all-around in your worksheet.
  • In the worksheet, before exporting, if you prefer, you can remove all, or selectively some, of Maple's input (the Maple output and corresponding equation labels will remain there), by respectively using the menus "View -> Show/Hide Contents -> Input," or "Edit -> Delete Element". This is particularly useful to produce LaTeX mathematical documents that entirely or partially hide their computer algebra origin.
  • In the worksheet, mark with the mouse any mathematical expression written within the text using Maple syntax (e.g. Int(f(x), x)), or that appears in the Maple input and, through right-click, use "Convert To -> 2-D Math" to produce a textbook mathematical display of that expression, that will then appear as such in the LaTeX exported document.

The project has several details and the help page is relatively long. Plus, some of these features just described are not in Maple 2020, for them you will need to wait for the next release. If even so you think it is important / of value to have this help page posted here in Mapleprimes, let me know. 

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

Good catch; it is adjusted and the adjustment distributed to everybody using Maple 2020 in the Maplesoft Physics Updates v.892 and newer.

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

Hi Melvin

No, what you see in Maple 2020 is the best you can get at this moment.

Yes: although still experimental, I've been working on a new File -> Export -> LaTeX together with a new latex command supporting the translation. The latter is distributed as the Latex command within the Maplesoft Physics Updates.

So here is my suggestion: could you please post the worksheet, or if it contains material you do not want to present in public at this point, then send it to me in private through Mapleprimes or to the email address you see under my name in the Maplesoft Physics Updates webpage. I will translate your worksheet using this new File -> Export -> LaTeX experimental code and return you the resulting .tex file.

Important: in case you send me the worksheet, 

  • This new File -> Export -> LaTeX handles equation labels that can appear in the output and also referred to within the text and the input lines. So feel free to use and refer to equation labels all-around in your worksheet.
  • In the worksheet, before exporting, if you prefer, please remove all, or selectively some, of Maple's input (the Maple output and corresponding equation labels will remain there), by respectively using the menus "View -> Show/Hide Contents -> Input," or "Edit -> Delete Element". This is particularly useful to produce LaTeX mathematical documents that entirely or partially hide their computer algebra origin.
  • In the worksheet, mark with the mouse any mathematical expression written within the text using Maple syntax (e.g. Int(f(x), x)), or that appears in the Maple input and, through right-click, use "Convert To -> 2-D Math" to produce a textbook mathematical display of that expression, that will then appear as such in the LaTeX exported document.

  • Not necessary, but if you install the Maplesoft Physics Updates you can also set several preferences regarding how to perform the LaTeX translation using the Latex:-Settings command (distributed to everybody using Maple 2020 within the Maplesoft Physics Updates). To see the different settings and their current value, enter Latex:-Settings(). That will be of use for you to get the translation using your preferences.

In summary, besides some of the settings shown by Latex:-Settings(), the design of this experimental code is to export the worksheet to LaTeX reproducing what you see on the screen. CAVEAT: Translation of "Tables" is not yet implemented.

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

Hi
Interesting observation ... Since version 1, the approach in (Physics:-)Latex has been to translate Typesetting structures, which for abs(x) uses "|", in turn, automatically transformed by some internal routines to \mid, instead of \vert (a synonym of |). It should have been |, in agreement with what you observed (I don't see lack of spacing symmetry when using \mid, but do see too much space to the left and right of it).

An adjustment for this, so using | instead of \mid, not just for translating abs(x) but in most cases, e.g. Ket(A) in Physics, is there within the Maplesoft Physics Updates v.891 and newer. On the way this called my attention to the translation of MeijerG and eval structures: the vertical bar was too short, now it is tall enough, as in \Bigr | instead of the previous \mid or just |.

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

This is your worksheet reviewed.

NULL

restart

PDE := diff(u(x, y), `$`(x, 4))+diff(u(x, y), `$`(y, 2)) = 0

diff(diff(diff(diff(u(x, y), x), x), x), x)+diff(diff(u(x, y), y), y) = 0

(1)

cond1 := u(x, 0) = f(x)

u(x, 0) = f(x)

(2)

cond2 := (D[2](u))(x, 0) = 0

(D[2](u))(x, 0) = 0

(3)

If you allow the following two limits to be conditions on f(x), not u(x, y)

limit(u(x, y), x = infinity) = 0

limit(u(x, y), x = infinity) = 0

(4)

 

limit(u(x, y), x = -infinity) = 0

limit(u(x, y), x = -infinity) = 0

(5)

This is How can we apply fourier transform to get the solution of this problem

pdsolve([PDE, cond1, cond2], method = Fourier)

u(x, y) = invfourier(fourier(f(x), x, s)*cos(s^2*y), s, x)

(6)

``

``


 

Download Fourier_transform_(reviewed).mw

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

As per the Title, you can set the invisibletimes (the spacing or symbol used to represent a product); its default value is " " (to reproduce, please update to v.883 of the Maplesoft Physics Updates). In your example:

Note, however, that this affects every product, not just after \sqrt{}.

Regarding yours and @itsme comments, I basically think the same: the latex typesetting system is already excellent. Trying to tweak it is something to be done with extra care and only in exceptional situations. For example, \sin (x) is not typeset with a space before (x), but in an automatic mode, we go with \sin \left(x \right), which is typeset with a space after sin, so I see no harm in translating this as \sin\! \left(x \right). And as @itsme says, providing an option to undo this tweak (you can input Latex:-Settings(leavespaceafterfunctionname = true) and won't see that \! anymore).

Altogether, I will think about the specific case of \sqrt{xxx}. There is a point in that, in the worksheet, I see a space before the a that I don't see in the tex-compiled translation. On the other hand, it is also true that for latex typesetting, that space shouldn't be there.

And I want to take the opportunity, following @itsme, to thank you for all the feedback you are giving. It is a very fruitful exchange for all Maple users. As it is the case of all the DE, Physics and Mathematical Functions, code; this kind of feedback and exchange (through the Maplesoft Physics Updates) is the best possible approach I imagine to develop software.

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

If you quote your input, it is echoed on the screen with an equation label that you can refer to all around. If besides, you place the cursor on the input line and press the combo Ctrl + Delete (or Command + Delete on a Mac), that input line disappears, but the output and its equation label remain. It is an easy way to produce equation labels for math correctly displayed, and that is not executed. Using the "Context Bar" (see the View menu), you can also change this output by centring Y/N or make parts of it italic or bold, underline, change colours etc. 

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

Nicely spotted; there was a typo in a list of math functions for which latex has a special command. The fix is distributed as usual, within the Maplesoft Physics Updates, v.780 or newer.

Additionally, I don't like the lack of space between 4 and the exponential, due to using \mathrm. In v.781 and newer, that is resolved, so that the tex-translation is now this one:

and upon latex compilation -> PDF, we get this look

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

Hi

This was asked before. If, after having used Latex, you change the way things are Typeset on the screen, say by direct calls to the Typesetting package, remember to clear Latex's caches so that the new look is taken into account. In brief, to have things working the way you want, in v.879 and before, after Typesetting:-Settings(prime=x,typesetprime=true), enter Latex:-Forget(). Alternatively, just use Latex(...., forget); and that will make Latex not remember previous results.

In v.780, you can also use the new Latex:-Settings(cacheresults = false), the default value is cacheresults = true; setting cacheresults to false makes Latex not to cache results, so you don't need to enter Forget after changing the way things are typeset on the screen, nor to pass the keyword forget to ignore previous results.

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

Hi

I understand there was a glitch in the MapleCloud server, versions 875 and 877 didn't get stored. The problem got resolved. Current is v.878.

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

This is development, things are moving ahead. At this point you have Latex:-Settings. Use that instead of assigning the variables yourself. This is your worksheet using Settings:

Among other things, using Settings you don't need to use Latex:-Forget after changing any setting.

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

Hi
Indeed, this is an issue introduced recently when adding the new Latex:-Settings(powersoftrigonometricfunctions = textbooknotation), see this Mapleprimes reply. It is adjusted in the Maplesoft Physics Updates v.870 and newer.

To the side: with v.869, you can still work OK if you input Latex:-Settings(powersoftrigonometricfunctions = computernotation), which is the standard notation used by Maple to display trig and arctrig functions. I am experimenting with having textbooknotation as default, say that is option 1. There is option 2: textbook notation only for trig (so cos(x)^2 is tex-translated as cos^2(x), but arccos(x) remains arccos, not cos^(-1)). Then option 3 is to have computernotation by default. Some people already expressed that for students this textbooknotation is a bit confusing. I remember that too from the time I was teaching at university.

So most probably textbooknotation will be optional, not the default as you see in this moment.

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

It is the first time I see someone complaining about \rm ....(wow!). Learning. If some packages don't handle \rm, we need a replacement. By the way, \rm is being used within the whole Latex in only one place, to represent the e of 'exponential'. Where else is that you saw it popping up? And for a single letter, \mathrm or \textrm work as well. Any indication that  one is better than the other one?

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

As everybody guessed, there was a place in the code where an expansion of exp(x + y) was not happening, that place was PDEtools:-Library:-IsNotSeparable, a quick shortcut to avoid wasting time with unsolvable problems. Without that expansion, for some arbitrary F(x + y),  deq1 := diff(u(x, y), x) - diff(u(x, y), y$2) = F(x + y); is of course not separable.

This issue is resolved and the adjustment distributed for everybody within the Maplesoft Physics Updates v.865 and higher; thanks for posting the example.

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

One condition, with denominator different from zero, for the existence of a solution using the S-function method was missing. A fix for this is distributed within the Maplesoft Physics Updates v.864 or newer.

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

First 17 18 19 20 21 22 23 Last Page 19 of 60