asymptote output and Sage question

206 views
Skip to first unread message

Yann Le Du

unread,
May 3, 2012, 6:30:08 AM5/3/12
to mathic...@googlegroups.com
Hi,

Great project! Superb graphics; I'm a user of asymptote, and can't find the export to latex nor to asymptote that is mentioned in the features.

Also, I'm currently installing Mathics with Sage support, so perhaps someone could tell me how to use Sage to solve the following from within Mathics (diesn't work at the moment from within Mathics on the web, but it works in Sage):

f=D[-x * Exp[-2*x^2+1/2],x]
Solve[f==0,x]

Yann

Jan Pöschko

unread,
May 4, 2012, 8:29:29 AM5/4/12
to mathic...@googlegroups.com
Hi Yann,

On Thursday, May 3, 2012 12:30:08 PM UTC+2, Yann Le Du wrote:

Great project! Superb graphics;

Thanks!
 
I'm a user of asymptote, and can't find the export to latex nor to asymptote that is mentioned in the features.

This is not available as a command in the notebook interface, but as a function TeXForm, e.g. TeXForm[Sqrt[x]] (or, equivalently, Sqrt[x]//TeXForm). Unfortunately, something seems to be broken with displaying the generated Asymptote code in MathJax - I'm getting  an "Unexpected text node" error, which is rather weird, as this used to work already. The code is generated correctly, it's just no displayed in the browser for me. I hope I can resolve this. It does work in the console version of Mathics (which you get if you download and install it locally):

>> Graphics[Rectangle[]]//TeXForm
 = 
 . \begin{asy}
 . size(5.83333333333cm, 5cm);
 . filldraw((0.0,0.0)--(350.0,0.0)--(350.0,350.0)--(0.0,350.0)--cycle, rgb(0, 0, 0), nullpen);
 . \end{asy}
 
The dots just indicate beginnings of new lines and should be removed when copying to Asymptote.


Also, I'm currently installing Mathics with Sage support, so perhaps someone could tell me how to use Sage to solve the following from within Mathics (diesn't work at the moment from within Mathics on the web, but it works in Sage):

f=D[-x * Exp[-2*x^2+1/2],x]
Solve[f==0,x]


Solve doesn't use Sage (yet), it uses SymPy's solve. Maybe that cannot solve this particular type of equation. I will have a look into this. A potential workaround could be FindRoot which finds a solution numerically, although in this case it seems hard to guess a reasonable starting point. FindRoot[f,{x,0.3}] does work, for instance.

Best regards,
Jan

Yann Le Du

unread,
May 4, 2012, 4:58:13 PM5/4/12
to mathic...@googlegroups.com


On Friday, May 4, 2012 2:29:29 PM UTC+2, Jan Pöschko wrote:
Hi Yann,

On Thursday, May 3, 2012 12:30:08 PM UTC+2, Yann Le Du wrote:

Great project! Superb graphics;

Thanks!
 
I'm a user of asymptote, and can't find the export to latex nor to asymptote that is mentioned in the features.

This is not available as a command in the notebook interface, but as a function TeXForm, e.g. TeXForm[Sqrt[x]] (or, equivalently, Sqrt[x]//TeXForm). Unfortunately, something seems to be broken with displaying the generated Asymptote code in MathJax - I'm getting  an "Unexpected text node" error, which is rather weird, as this used to work already. The code is generated correctly, it's just no displayed in the browser for me. I hope I can resolve this. It does work in the console version of Mathics (which you get if you download and install it locally):

>> Graphics[Rectangle[]]//TeXForm
 = 
 . \begin{asy}
 . size(5.83333333333cm, 5cm);
 . filldraw((0.0,0.0)--(350.0,0.0)--(350.0,350.0)--(0.0,350.0)--cycle, rgb(0, 0, 0), nullpen);
 . \end{asy}
 
The dots just indicate beginnings of new lines and should be removed when copying to Asymptote.


Okm that's cool, let's wait for a web version that works with that.
 

Also, I'm currently installing Mathics with Sage support, so perhaps someone could tell me how to use Sage to solve the following from within Mathics (diesn't work at the moment from within Mathics on the web, but it works in Sage):

f=D[-x * Exp[-2*x^2+1/2],x]
Solve[f==0,x]


Solve doesn't use Sage (yet), it uses SymPy's solve. Maybe that cannot solve this particular type of equation. I will have a look into this. A potential workaround could be FindRoot which finds a solution numerically, although in this case it seems hard to guess a reasonable starting point. FindRoot[f,{x,0.3}] does work, for instance.


Yes, but now that my mathics server works inside Sage, how can I call Sage functions like Sage's solve? The doc only mentions SageIntegrate, but is that the only one currently exposed? Also, I had a look at the code for SageIntegrate, it looks quite painful to call Sage's functions properly... yet I understand many issues need to be dealt with when calling Sage ; couldn't there be a set of templates that applies to most of Sage's functions?

Yann

 
Best regards,
Jan
Reply all
Reply to author
Forward
0 new messages