Re: [sage-support] Re: Weird behavior in sagecell

2018-12-01 Thread Kwankyu

>
> See a similar report on the sage-cell mailing list: 
> https://groups.google.com/d/topic/sage-cell/BL9h7xLiwG4/discussion 
>
> In the discussion there, Andrey Novoseltsev points out 
> that SageMathCell uses only one jsmol instance, and 
> if there are several plots using it, they might conflict in 
> hard to predict ways. 
>

Actually there is an easy fix for this issue. Follow the discussion linked 
above. 

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Weird behavior in sagecell

2018-11-30 Thread david.guichard
Thanks!

On Friday, November 30, 2018 at 5:02:27 PM UTC-8, slelievre wrote:
>
>
> Fri 2018-11-30 23:43:00 UTC, David Guichard:
>>
>> In this page,
>>
>> http://skink.whitman.edu/~guichard/sage/two_plots_clean.html
>>
>> I have two sagecells, each to do a 3d plot. If I evaluate the first one, 
>> it works as expected. If I then evaluate the second, it graphs correctly, 
>> but it also replaces the first plot with a copy of the second. Neither of 
>> them is "live", that is, I can't rotate either version.
>>
>> If I first evaluate the second cell, it works as expected. If I then 
>> evaluate the first one, it also works as expected: I end up with two 
>> (different) plots, both live.
>>
>> I'd appreciate knowing how to fix this, if it's possible. I have tried a 
>> few things, such as changing the outputLocation, but nothing has worked so 
>> far.
>>
>> Thanks,
>> David
>>
>
> Not sure how to explain what happens there,
> or how to really fix it if sticking to jsmol is important.
>
> If you do the 3D-plotting with three.js however,
> the problem goes away.
>
> This just amounts to adding viewer='threejs'
> at the end of the plotting commands:
>
> 
> # Trefoil knot tube
> t, u = SR.var('t u')
> assume(t, u, 'real')
> # First define the Trefoil knot spacecurve
> r = vector((sin(3 * t), 2 * sin(2 * t) + sin(t), cos(t) - 2 * cos(2 * 
> t)))
> # Next compute the T, N, and B vectors
> rp = diff(r, t)
> T = rp / rp.norm()
> Tp = diff(T, t)
> N = Tp / Tp.norm(2)
> B = T.cross_product(N)
> # Define the function to use for the radius of the circle
> radius(t) = 1/2
> # Define the vector function for the surface and plot it
> tube = r + radius(t) * cos(u) * N + radius(t) * sin(u) * B
> parametric_plot3d(tube, (t, 0, 2 * pi), (u, 0, 2 * pi),
>   plot_points=[100, 30], aspect_ratio=[1, 1, 1]
>   viewer='threejs')
> 
> 
> # The cone
> u, v = var('u v')
> assume(u, v, 'real')
> # Define the surface as a vector function
> r = vector((v * cos(u), v * sin(u), v))
> # Plot it
> parametric_plot3d(r, (u, 0, 2*pi), (v, 0, 5), aspect_ratio=[1, 1, 1],
>   viewer='threejs')
> 
>

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Weird behavior in sagecell

2018-11-30 Thread Samuel Lelièvre
Sat 2018-12-01 01:02 UTC, slelievre:
>
> Fri 2018-11-30 23:43 UTC, David Guichard:
>>
>> In this page,
>>
>> http://skink.whitman.edu/~guichard/sage/two_plots_clean.html
>>
>> I have two sagecells, each to do a 3d plot. If I evaluate the first one, it 
>> works as expected. If I then evaluate the second, it graphs correctly, but 
>> it also replaces the first plot with a copy of the second. Neither of them 
>> is "live", that is, I can't rotate either version.
>>
>> If I first evaluate the second cell, it works as expected. If I then 
>> evaluate the first one, it also works as expected: I end up with two 
>> (different) plots, both live.
>>
>> I'd appreciate knowing how to fix this, if it's possible. I have tried a few 
>> things, such as changing the outputLocation, but nothing has worked so far.
>>
>> Thanks,
>> David
>
>
> Not sure how to explain what happens there,
> or how to really fix it if sticking to jsmol is important.
>
> If you do the 3D-plotting with three.js however,
> the problem goes away.
>
> This just amounts to adding viewer='threejs'
> at the end of the plotting commands.

See a similar report on the sage-cell mailing list:
https://groups.google.com/d/topic/sage-cell/BL9h7xLiwG4/discussion

In the discussion there, Andrey Novoseltsev points out
that SageMathCell uses only one jsmol instance, and
if there are several plots using it, they might conflict in
hard to predict ways. He recommends using three.js.

three.js (called "threejs" in Sage) is a javascript 3D-plotting library.
https://threejs.org/

-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Weird behavior in sagecell

2018-11-30 Thread slelievre

Fri 2018-11-30 23:43:00 UTC, David Guichard:
>
> In this page,
>
> http://skink.whitman.edu/~guichard/sage/two_plots_clean.html
>
> I have two sagecells, each to do a 3d plot. If I evaluate the first one, 
> it works as expected. If I then evaluate the second, it graphs correctly, 
> but it also replaces the first plot with a copy of the second. Neither of 
> them is "live", that is, I can't rotate either version.
>
> If I first evaluate the second cell, it works as expected. If I then 
> evaluate the first one, it also works as expected: I end up with two 
> (different) plots, both live.
>
> I'd appreciate knowing how to fix this, if it's possible. I have tried a 
> few things, such as changing the outputLocation, but nothing has worked so 
> far.
>
> Thanks,
> David
>

Not sure how to explain what happens there,
or how to really fix it if sticking to jsmol is important.

If you do the 3D-plotting with three.js however,
the problem goes away.

This just amounts to adding viewer='threejs'
at the end of the plotting commands:


# Trefoil knot tube
t, u = SR.var('t u')
assume(t, u, 'real')
# First define the Trefoil knot spacecurve
r = vector((sin(3 * t), 2 * sin(2 * t) + sin(t), cos(t) - 2 * cos(2 * 
t)))
# Next compute the T, N, and B vectors
rp = diff(r, t)
T = rp / rp.norm()
Tp = diff(T, t)
N = Tp / Tp.norm(2)
B = T.cross_product(N)
# Define the function to use for the radius of the circle
radius(t) = 1/2
# Define the vector function for the surface and plot it
tube = r + radius(t) * cos(u) * N + radius(t) * sin(u) * B
parametric_plot3d(tube, (t, 0, 2 * pi), (u, 0, 2 * pi),
  plot_points=[100, 30], aspect_ratio=[1, 1, 1]
  viewer='threejs')


# The cone
u, v = var('u v')
assume(u, v, 'real')
# Define the surface as a vector function
r = vector((v * cos(u), v * sin(u), v))
# Plot it
parametric_plot3d(r, (u, 0, 2*pi), (v, 0, 5), aspect_ratio=[1, 1, 1],
  viewer='threejs')


-- 
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 post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.