Here is an example with Sage cells in context:
https://opentext.uleth.ca/Math3410/sec-kernel-image.html#p-283-part2

If I remove the init_printing() line, or change this to 
init_printing(use_latex=False), the code will run, but I lose the 
MathJax-formatted output.

I can't tell if this is a bug in the init_printing() function (to my 
knowledge, there is no recent update to Sympy -- I upgraded my local Python 
installation and everything is still working) or if something is going 
wrong with Sage Cell trying to process the output.

On Wednesday, February 2, 2022 at 12:09:52 PM UTC-7 Sean Fitzpatrick wrote:

> This is in SageMathCell, rather than in a local installation of Sage. I 
> don't think there's much I can do about what is running on here.
> [image: sagecell.png]
>
> On Wednesday, February 2, 2022 at 11:39:40 AM UTC-7 HG wrote:
>
>>  I tried it in sage 9.2 nice printing.
>>
>> But in sage I use show(LatexExpr("r \mu \epsilon))
>>
>> μϵ
>>
>> I am not sure that what you want (and naturaly first command in cell 
>> %display latex        in sage)
>>
>> One can even format text in a beautifull latex 
>>
>> show(LatexExpr(r"This \ is \ \mu \ and \ \epsilon"))
>>
>> This is μ and ϵ 
>>
>> best
>>  Best
>>
>> Henri
>> Le 02/02/2022 à 18:38, Sean Fitzpatrick a écrit :
>>
>> I'm teaching a linear algebra course where we use the Sympy Python 
>> package for a lot of the computations. This includes a PreTeXt textbook 
>> where there are Sage Cells throughout, with sample code supplied. 
>>
>> Until today (I think it was working yesterday), I've had no trouble 
>> running code like the following:
>>
>> from sympy import Matrix, init_printing
>> init_printing()
>> A = Matrix([[1,2,3,4],[5,6,7,8],[9,0,1,2]])
>> display(A.rref())
>>
>> The init_printing function from Sympy renders the output in MathJax 
>> rather than pretty-printed plain text, which is nice for teaching. I can 
>> run this with the language set to either Sage or Python. (the 'display' 
>> command is only needed for Python, which is funny, because it is not needed 
>> in Jupyter with a Python kernel.)
>>
>> Right now this code throws about 50 lines of error messages; the main 
>> error is a Type Error:
>>
>> TypeError: Object of type <class 'bytes'> with value of '(a very, very 
>> long string that I won't reproduce here)' is not JSON serializable
>>
>> Was there a change made today that would cause this error? Maybe in the 
>> Sympy library? If I remove the init_printing() line, everything works, 
>> except that there's no longer nice display for the output.
>>
>> The reason for using Python syntax is that we also do labs in Jupyter 
>> notebooks. Our institution has a Jupyter hub with Python and R kernels, but 
>> no Sage kernel. (We do not have a CoCalc subscription.)
>>
>> I know there is a Sage equivalent to init_printing (although I forget 
>> what it is) but that won't work on the Jupyter side.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-support...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/0262ca41-4a74-467b-8f46-0af9ad6c4df1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sage-support/0262ca41-4a74-467b-8f46-0af9ad6c4df1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/0ef12103-da63-4a66-a8a9-a613d861b7a9n%40googlegroups.com.

Reply via email to