I want to change the way the exponent is shown in the symbolic equation of Sympy from X**n to any better looking way to look like this Xⁿ or even like this X^n
Asked
Active
Viewed 43 times
1
-
1What do you mean by "shown"? You won't be able to change the *language syntax*, no. – Karl Knechtel Jun 06 '20 at 01:21
-
1I think the answer in this thread has what you need. https://stackoverflow.com/a/8651690/12285920 – Abdulrahman Mohammed Jun 06 '20 at 01:24
-
You can output sympy's expressions in many different formats, e.g. via many types of [printers](https://docs.sympy.org/latest/tutorial/printing.html) or via [codegen](https://docs.sympy.org/latest/modules/utilities/codegen.html). Note that default `**` is used for powers, not because of sympy, but because of Python using `^` only for [exclusive or](https://docs.sympy.org/latest/tutorial/gotchas.html#two-final-notes-and). Default outputting `^` would be extremely confusing as the outputted code wouldn't work when copy-pasted. – JohanC Jun 06 '20 at 08:05