New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MathML presentation printing for Range, Min, Max, exp, true, false, None #16126
Conversation
✅ Hi, I am the SymPy bot (v142). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.4. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Why do you use blackboard font for |
Also is the last entry in the list a typo? It shows |
sympy/printing/tests/test_mathml.py
Outdated
assert mpp.doprint(Range(30, 1, -1)) == '<mfenced close="}" open="{"><mn>30</mn><mn>29</mn><mi>…</mi><mn>2</mn></mfenced>' | ||
assert mpp.doprint(Range(0, oo, 2)) == '<mfenced close="}" open="{"><mn>0</mn><mn>2</mn><mi>…</mi><mi>∞</mi></mfenced>' | ||
assert mpp.doprint(Range(oo, -2, -2)) == '<mfenced close="}" open="{"><mi>∞</mi><mi>…</mi><mn>2</mn><mn>0</mn></mfenced>' | ||
assert mpp.doprint(Range(-2, -oo, -1)) == '<mfenced close="}" open="{"><mn>-2</mn><mn>-3</mn><mi>…</mi><mn>-oo</mn></mfenced>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it wasn't a typo. This should be fixed.
I guess exp is using Also according to https://www.w3.org/TR/MathML2/chapter4.html#contm.exp there is a |
That is assuming I'm not mixing up presentation and content MathML. I'm not clear how those work in the printer, or which the above document refers to. |
Yes, exponential e is used for exp as it was earlier used for printing a single e. Not sure why Firefox and/or the font maps it to blackboard. My rationale was that if there is a special character defined for it, that is the one to be used (rather than discussing if it should be italic or non-italic etc). I'll check the documentation more carefully, but my guess is that exp is content. Either way we can choose how we want it rendered, but for consistency I think something with e to the power is preferred. Will get back on this later on. |
Yes, the printing of -oo is still in the rather long list of functions to fix. Not sure why it behaves as it does. So the behaviour here is "as expected" given the current code base. (Same thing with complex infinity.) |
I've found the issue with -oo and will fix... sympy/sympy/printing/mathml.py Line 295 in 34482a7
|
I don't know very much about MathML so I'll defer to you on how to best print it. I though we supported both content and presentation MathML, though. If the blackboard e is coming from the renderer then we shouldn't worry about it. |
Well, there are printers for both Content and Presentation MathML. I've focused on Presentation since it is more "fun" to work with (easy to see the effect of changes etc). Also, Content MathML probably works in more cases already as it much more relies on the actual function names and not on specific printing of it (for example, the range printing was probably OK from a "content" perspective as it was, bad comparison since the content MathML looks different, but the idea hold, printing a function name and arguments is more often OK Content MathML). Finally, some things may not even be relevant/supported from a Content perspective. So the conclusion is basically that, sure, it would be great if someone worked on the Content MathML as well. Not sure if we shouldn't merge Presentation MathML improvements because of that though. |
References to other Issues or PRs
Brief description of what is fixed or changed
Added MathML presentation printing for
Range
,Min
,Max
,exp
,true
,false
,None
Before:
After:
Other comments
Release Notes