Nigecat / obsidian-desmos

Embed graphs directly into your obsidian notes
GNU General Public License v3.0
125 stars 7 forks source link

Plugin Doesn't Render a Graph That The Desmos Website Does #102

Closed Atrament1s closed 7 months ago

Atrament1s commented 11 months ago

Describe the bug The following graph will render in the Desmos website but not in the plugin:

\left(x^{2}+y^{2}-8\right)\left(\left|x^{2}-10\right|+\left|y^{2}-10\right|-6\right)\left(\left|\left|x^{2}-1\right|-9\right|+\left|\left|y^{2}-1\right|-9\right|-6\right)\left(\left|\left|\left|x^{2}-1\right|-1\right|-8\right|+\left|\left|\left|y^{2}-1\right|-1\right|-8\right|-6\right)\left(\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-7\right|+\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-7\right|-6\right)\left(\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-6\right|+\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-6\right|-6\right)\left(\left|\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-5\right|+\left|\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-5\right|-6\right)\left(\left|\left|\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-4\right|+\left|\left|\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-4\right|-6\right)\left(\left|\left|\left|\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-3\right|+\left|\left|\left|\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-3\right|-6\right)\left(\left|\left|\left|\left|\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-2\right|+\left|\left|\left|\left|\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-2\right|-6\right)\left(\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|x^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|+\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|y^{2}-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-1\right|-6\right)=0

Desktop (please complete the following information):

Additional context I don't actually need to render the graph in my notes but wanted to report it anyway so the developer is aware of the issue.

The error it spit was:

Desmos Graph Error: Expected '{' to match '}'. Note: You may have tried to use the LaTeX syntax in the graph restriction (-6\right)=0), please use some sort of an alternative (e.g \frac{1}{2} => 1/2) as this is not supported by Desmos.

nickoanastassiu commented 8 months ago

Replacing the absolute values with \abs(x) works (simply by doing a Find and Replace). See example with your graph:

Desmos: CleanShot 2024-03-06 at 22 06 08@2x

Obsidian: CleanShot 2024-03-06 at 22 06 53@2x

Your modified graph:

\left(x^{2}+y^{2}-8\right)\left(\abs(x^{2}-10)+\abs(y^{2}-10)-6\right)\left(\abs(\abs(x^{2}-1)-9)+\abs(\abs(y^{2}-1)-9)-6\right)\left(\abs(\abs(\abs(x^{2}-1)-1)-8)+\abs(\abs(\abs(y^{2}-1)-1)-8)-6\right)\left(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-7)+\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-7)-6\right)\left(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-6)+\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-6)-6\right)\left(\abs(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-1)-5)+\abs(\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-1)-5)-6\right)\left(\abs(\abs(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-1)-1)-4)+\abs(\abs(\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-1)-1)-4)-6\right)\left(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-1)-1)-1)-3)+\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-1)-1)-1)-3)-6\right)\left(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-1)-1)-1)-1)-2)+\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-1)-1)-1)-1)-2)-6\right)\left(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(x^{2}-1)-1)-1)-1)-1)-1)-1)-1)-1)-1)+\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(\abs(y^{2}-1)-1)-1)-1)-1)-1)-1)-1)-1)-1)-6\right)=0
Atrament1s commented 7 months ago

Very interesting that \abs() and | |are rendered differently. Thanks for the information, I'll make sure to keep it in mind for future graphs!