Re: [sage-support] Re: arrows in 3d field plots

2019-02-02 Thread Tevian Dray
>> Now to try to track down how to set jmol parameters in a web page...

I've given up for now on using Sage for this project, as it turns out
that Geogebra can accomplish what I need out of the box.  For reference,
the resulting webpage is:
http://math.oregonstate.edu/bridge/ideas/fields
Happy to revisit this choice as we start to port these applets into our
online book over the next couple of years.

Thanks to all for their suggestions.
Tevian

-- 
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: arrows in 3d field plots

2019-01-31 Thread Tevian Dray
> Hopefully, some day threejs will replace jmol as the default 3d viewer:
> https://trac.sagemath.org/ticket/22408

Good, although I reiterate that it does not appear to respect the
orientation flag.

> Meanwhile, you can define a subdomain of E, U say, where the vector field 
> is everywhere regular and plot the restriction of the vector field to U. 
> For your example, U can be E minus the disk x^2+y^2 <= 0.01: ...

Yes, that works perfectly; thank you.

Now to try to track down how to set jmol parameters in a web page...

Tevian

-- 
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: arrows in 3d field plots

2019-01-30 Thread Tevian Dray
>> You can use the plot functionality of vector fields on
>> Euclidean spaces to get better arrowheads:

OK; I can get jmol to work with some browsers, although it is painfully slow.  
But the results are very nice.

>> And is there a way to disable the perspective view?
>> I want the 2d-view seen from above to look like a with the
>> 2d vector field, arrows sitting exactly on top of each other;
>> the perspective tries to show them all.

I reported this issue with threejs, but it's also present with jmol.  Yes, it's 
possible to eliminate the perspective view interactively, by right-clicking, 
and unchecking "Perspective Depth" in the Style menu.  But I'd like to place 
these images in final form on a webpage, so I'm looking for a way to encode 
jmol settings in either Sage or HTML.  Is this possible?

Finally, is there a simple mechanism to enable Sage to plot vector fields with 
singularities, such as a pole at the origin?  I've had no luck yet trying to 
plot something like:
  E.vector_field((-y/(x^2+y^2),x/(x^2+y^2)))
I've tried piecing together nonsingular domains, although I'm possibly not 
doing it correctly.  But there is surely a more elegant solution, such as 
cutting off the vector field at some maximum magnitude.

Thanks,
Tevian

-- 
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: arrows in 3d field plots

2019-01-28 Thread Tevian Dray
>> You can use the plot functionality of vector fields on Euclidean
>> spaces to get better arrowheads:

Excellent!  Thank you!

>> You may also replace the last line by 
>>   sage: show(xy, orientation=(0,0,0,0), viewer='threejs')

Yes, I had to do that -- jmol froze my browser.  I haven't had a chance
yet to debug that problem, nor to experiment with parameters.  But
threejs unfortunately appears to ignore the orientation parameter, which
defeats the purpose.  And is there a way to disable the perspective view?
I want the 2d-view seen from above to look like a 2d vector field, with
the arrows sitting exactly on top of each other; the perspective tries
to show them all.  Again, I haven't had a chance yet myself to debug or
explore parameters...

Thanks again,
Tevian

-- 
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: arrows in 3d field plots

2019-01-27 Thread Tevian Dray
Thanks, Tom.  So far as I can tell, your examples use "arrowsize" and 
"width" to control the arrows.  But so far as I can tell, those parameters 
have no effect on 3d plots -- yours are all 2d.  Am I missing something? 
 I'm using the SageMathCell server to test; not sure if that affects the 
answer.

Tevian

-- 
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] arrows in 3d field plots

2019-01-27 Thread Tevian Dray
Can the formatting of arrows in 3d field plots be adjusted?

I'm trying to make rotatable, 3d versions of 2d field plots.
I can get most of what I want with, say:
xy=plot_vector_field3d((x,y,0),(x,-1,1),(y,-1,1),(z,-1,1),colors='black')
show(xy,orientation=(0,0,0,0))
but I'd really like the output to look more like:
plot_vector_field((x,y),(x,-1,1),(y,-1,1))
In other words, more obvious arrowheads.  A bigger plot would also help,
to allow setting plot_points to 20 -- the default for 2d.

Are the arrows and/or size (easily) configurable?

Thanks,
Tevian

-- 
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: Cartan moving frame formalism

2018-12-10 Thread Tevian Dray
Let me start by confirming that I have successfully used SageManifolds
to implement the several calculations I wanted to make using the Cartan
moving frames formalism.  So first a big "thank you" for developing this
code!

> If you find some missing functionalities and you would like to
> implement them, please visit ...

Thanks for the invitation, but I'm a newbie at both Python and Sage...

I do however have some further questions, some of which likely reflect
my lack of comfort with (and ignorance of) object-oriented programming;
others may be in the category of feature requests for the future.

1. First and foremost, what is the proper way to manipulate the
   components of both tensors and tensor-like objects such as the
   connection, the connection 1-forms, and the curvature 2-forms?

A basic example would be how to set the mass to zero in the
Schwarzschild geometry *after* calculating the curvature.  (I'm still
recovering from my shock at discovering that saying "m=0" is not
sufficient...)  The best I've been able to come up with is to do
something like
object[1,2].expr().subs({m:0})
for each component of each affected object.  Is there a better way?

A similar example would be how to apply simplifications to (all)
components of a given tensor or tensor-like object.

2. Is there a way to display (all) connection 1-forms or curvature
   2-forms, ideally in a format analogous to that produced by
   g.display_comp() or nab.display()?

(An answer involving a print loop is acceptable, although I can't get
the formatting right -- one entry per line, no extraneous symbols.)

3. Is there a way to specify the index labels on the connection 1-forms
   and curvature 2-forms, analagous to index_labels on the connection?

(For that matter, is there a way to specify the labels on the metric?
I get an error when trying to set index_labels in that case.)

4. Can default (non-numerical) index labels be specified, rather than
   repeating them in every display request?

Thank you,
Tevian

-- 
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: Cartan moving frame formalism

2018-12-06 Thread Tevian Dray
>> The answer to your question is essentially "yes" ...

Thank you for your detailed response and links.  I had in fact found
some of them when searching, but clearly hadn't read them carefully
enough.  In particular, I had missed the use of vector_frame in the
documentation of Affine Connections, although I note that 2 of your
subsequent 3 examples appear to define frames without using this class.

I expect that these examples will indeed provide the guidance I need,
and will work through them more carefully.

Again, thank you.

Tevian

-- 
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] Has the Cartan moving frame formalism been implemented in Sage?

2018-12-05 Thread Tevian Dray
Such an implementation would have 2 parts:

1. *Defining the objects:*  The connection 1-forms, torsion 2-forms, and 
curvature 2-forms are all indexed sets of differential forms.  They are not 
tensorial, but the index labels behave in many ways like tensor components. 
 In particular, there are "up" and "down" index versions, with particular 
symmetries.  The case of an orthonormal basis is particularly nice, leading 
to "down" index antisymmetry, which it would be nice to have built in.

2. *Computing the objects:*  The components of the connection 1-forms are 
just the Christoffel symbols, but in an arbitrary frame.  So when working 
with explicit examples, it would be enough to be able to compute the 
Christoffel symbols, then use them to determine the connection forms.  But 
this requires the ability to compute the connection in non-coordinate 
frames.

I'll settle for an implementation of question 2.  However, so far as I can 
tell, sage.manifolds only calculates in a coordinate basis, and the 
VectorFrame class doesn't do tensor derivatives.  If I'm missing something 
here, or if there's some other known way to work in an arbitrary 
(especially orthonormal) basis, please let me know -- ideally with an 
example, such as polar coordinates in an orthonormal frame.

Thank you.

-- 
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] dynamic variable names

2018-12-01 Thread Tevian Dray
>> Use the globals() Python dictionary.

Works perfectly; thanks!

-- 
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] dynamic variable names

2018-12-01 Thread Tevian Dray
How can I create variable names programmatically, then assign values to 
them?

I've tried creating variables with something like
var('q'+str(n))
but my attempts to assign a value to such a variable have been unsuccessful.
The underlying problem is that I do not know in advance how many variables 
will
be required, so I need some way to assign values to indexed variables in 
some sort
of loop based on the index.  But I can't figure out how to simultaneously 
call the variable
using a parameter, and assign a value to this parametrized variable.

This may be a Python issue, rather than Sage...

-- 
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: Right way to kill notebook server on single-user machine

2018-05-03 Thread Tevian Dray
Nope -- or at least, not for me.  "jupyter notebook list" works fine, but 
"jupyter notebook stop " returns an error indicating that the file stop 
can not be found...  Perhaps this feature has been dropped?  This approach 
also appears to be slow, presumably due to overhead when starting jupyter.

On Thursday, May 3, 2018 at 2:47:51 PM UTC-7, Nils Bruin wrote:
>
> On Thursday, May 3, 2018 at 2:32:22 PM UTC-7, Tevian Dray wrote:
>>
>> Finally had a chance to test this; yes it works -- although it is 
>> apparently possible to send the two kill commands too close together. Thank 
>> you very much.  Have to say it's a bit of a kluge, though -- the design 
>> assumption that notebooks will always be started in shell windows that stay 
>> open is surely flawed.
>>
>> Indeed, there seems to be an even righter way:
>
> https://github.com/jupyter/notebook/issues/1950
>
> apparently you can do
>
> $ jupyter notebook list
> 
> $ jupyter notebook stop 
>
> When doing this with sage you'd have to make sure to run it through sage's 
> jupyter, so something like
>
> $ sage -sh -c "jupyter notebook list"
> $ sage -sh -c "jupyter notebook stop "
>
>
>

-- 
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: Right way to kill notebook server on single-user machine

2018-05-03 Thread Tevian Dray
Finally had a chance to test this; yes it works -- although it is 
apparently possible to send the two kill commands too close together. Thank 
you very much.  Have to say it's a bit of a kluge, though -- the design 
assumption that notebooks will always be started in shell windows that stay 
open is surely flawed.

On Wednesday, April 25, 2018 at 12:42:54 PM UTC-7, Nils Bruin wrote:
>
> When you start up the jupyter notebook it writes some files describing its 
> state. On Fedora, they end up in in /run/user//jupyter. There's a file 
> there nbserver-.json. In the file you'll find some basic data about 
> the server, including the "pid", which also appears in the filename.
>
> executing
>
> kill -2 
>
> twice in quick succession has the same result as pressing ctrl-C twice at 
> the terminal where the server is running, so that shuts down the notebook 
> cleanly.
>
> Obviously there can be multiple notebook servers running, even under the 
> same UID, so there can be multiple files there. You'll have to have a way 
> to pick the right one.
>

-- 
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] Right way to kill notebook server on single-user machine

2018-04-16 Thread Tevian Dray
I'm a relatively new Sage user, trying Jupyter for the first time.  OS is 
Ubuntu 14.04; Sage version is 8.1.  Starting Jupyter from the command line 
(sage -n jupyter) works as expected, but so far as I can tell the only way 
to shut down the notebook server after closing the browser is via ctrl-c. 
 What if sage is not started from a terminal?  Or if stdout is redirected 
to a file?  For example, if I redirect stdout when starting sage, then send 
ctrl-c after closing the browser, the sage-notebook process continues to 
run -- presumably because I have no way to send a second ctrl-c.

I found this 10-year-old post asking essentially the same question:

https://groups.google.com/forum/#!newtopic/sage-support/sage-support/IrA6obQupKw
but parts of it are clearly out of date.  However, the suggestion to use 
"kill -2" sounds promising, but on which process?  I only see two, one 
running sage-notebook, the other running sage-cleaner.  Or is there some 
other way?  "killall python" works, but presumably isn't a clean shutdown 
-- and I certainly wouldn't want to script such a sledgehammer.

It would be really nice if there were a provided script for shutting down 
the notebook server cleanly!

-- 
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.