You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To begin: I teach math at university and I find sympy and pythontex very useful for reasons I imagine are obvious to you.
Suppose I have the following python script.
fromsympyimport*var('x')
latex((sin(x))**2) == r'\sin^{2} {\left(x\right)}` # Up to some insignificant whitespacelatex((ln(x))**2) == r'\log {\left(x\right)}^{2}`# Up to some insignificant whitespace
That is, (sin(x))**2 is rendered as sine squared x and (log(x))**2 is rendered as log x squared. Until recently, I believe that the logarithms would have followed the trigonometry functions in placing the exponent near the function. I imagine this change is related to the recent changes related to allowing log to be rendered as ln and the various rendering options for inverse trigonometric functions.
I'm familiar with the various notations, and I imagine I'll be able to distinguish whether or not \log^2 x means \log(\log(x)) or (\log(x))^2 by the context. I'm also comfortable with using operator precedence to disambiguate the competing interpretations of, say, \log(x)^2.
I also believe the non-stem students I teach are entirely capable of learning to navigate the intricacies of notation and operator precedence. But they come to first-year courses without that knowledge, and I haven't the time to give it to them. As a result, I take the strategy of always writing something that seems to have the least potential for ambiguity and/or requires the least consideration of operator precedence. So, in such first-year classes I write:
3 x % Never
3 \cdot x % Always\ln x % Never\ln (x) % Always\ln^2 (x) % Never
{\ln (x)}^2 % Never
(\ln(x))^2 % Always% Lots of other stuff
I immediately concede that the above may be highly opinionated and that opinions can differ. But is it possible for the printing to easily support a broader range of settings? I was glad to see the inclusion of the ln_notation option (for my students, but in my heart it will always be log). I'd like to be able to do something like:
I agree we should change it or at least add an option.
By the way, it isn't necessary to fork SymPy to make the change. The printing system is designed to be extensible. You can just subclass LatexPrinter and define your own custom _print_Pow.
Since you have done so, however, you can send it as a pull request. It will need a test as well. The option name could be something simpler as well.
To begin: I teach math at university and I find sympy and pythontex very useful for reasons I imagine are obvious to you.
Suppose I have the following python script.
That is,
(sin(x))**2
is rendered as sine squared x and(log(x))**2
is rendered as log x squared. Until recently, I believe that the logarithms would have followed the trigonometry functions in placing the exponent near the function. I imagine this change is related to the recent changes related to allowinglog
to be rendered asln
and the various rendering options for inverse trigonometric functions.I'm familiar with the various notations, and I imagine I'll be able to distinguish whether or not
\log^2 x
means\log(\log(x))
or(\log(x))^2
by the context. I'm also comfortable with using operator precedence to disambiguate the competing interpretations of, say,\log(x)^2
.I also believe the non-stem students I teach are entirely capable of learning to navigate the intricacies of notation and operator precedence. But they come to first-year courses without that knowledge, and I haven't the time to give it to them. As a result, I take the strategy of always writing something that seems to have the least potential for ambiguity and/or requires the least consideration of operator precedence. So, in such first-year classes I write:
I immediately concede that the above may be highly opinionated and that opinions can differ. But is it possible for the printing to easily support a broader range of settings? I was glad to see the inclusion of the
ln_notation
option (for my students, but in my heart it will always belog
). I'd like to be able to do something like:Is there any technical/other objection to these possibilities?
The text was updated successfully, but these errors were encountered: