Re: [sage-support] Re: text3d and latex

2010-01-26 Thread William Cauchois
Sorry about the confusion, I was just addressing Jason's comment about
my work adding coordinate transformations to plot3d.

Your example looks cool, Thomas! After #7872 is applied, you'll be
able to use spherical_plot3d to make your code more concise :).

On Tue, Jan 26, 2010 at 12:53 PM, Thomas Scofield scofi...@calvin.edu wrote:

 To what does #7872 refer?  And is that a reply to O. Lazo, or to my post?
 On Jan 26, 2010, at 2:56 AM, William Cauchois wrote:

 Check out #7872, Jason!

 On Jan 23, 11:59 am, Jason Grout jason-s...@creativetrax.com wrote:

 Oscar Lazo wrote:

 On 22 ene, 12:56, Thomas Scofield scofi...@calvin.edu wrote:

 I have made an interactive notebook for help students understand the

 meaning of spherical coordinates.  It is published at

    http://www.sagenb.org/home/pub/1400/

 You might be interested in the code here:

 http://www.sagenb.org/home/pub/1319/

 Also, Bill Cauchois was working on adding a general coordinate

 transformation argument to plot3d, based on our discussions about

 spherical and cylindrical plotting.  He worked on this a lot at the Sage

 Days last week.  I'm not sure when he'll submit a patch.  I hope he does

 soon, since I'd really like to use it in my class in February or March!

 Thanks,

 Jason

 --

 Jason Grout

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

 Thomas L. Scofield
 
 Associate Professor
 Department of Mathematics and Statistics
 Calvin College
 

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: text3d and latex

2010-01-25 Thread William Cauchois
Check out #7872, Jason!

On Jan 23, 11:59 am, Jason Grout jason-s...@creativetrax.com wrote:
 Oscar Lazo wrote:
  On 22 ene, 12:56, Thomas Scofield scofi...@calvin.edu wrote:
  I have made an interactive notebook for help students understand the  
  meaning of spherical coordinates.  It is published at

     http://www.sagenb.org/home/pub/1400/

  You might be interested in the code here:
 http://www.sagenb.org/home/pub/1319/

 Also, Bill Cauchois was working on adding a general coordinate
 transformation argument to plot3d, based on our discussions about
 spherical and cylindrical plotting.  He worked on this a lot at the Sage
 Days last week.  I'm not sure when he'll submit a patch.  I hope he does
 soon, since I'd really like to use it in my class in February or March!

 Thanks,

 Jason

 --
 Jason Grout

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Problems with 3d plotting

2010-01-18 Thread William Cauchois
I'm running Ubuntu 9.10. I installed the package sun-java6-plugin
and it works for me.

On Jan 18, 8:35 am, Jack Fearnley j...@alcor.concordia.ca wrote:
 I have just compiled sage-4.3 running under ubuntu 9.04 on an IBM
 pentium machine. The sage directory is in its own partition under /tools.

 I have no real need for 3d plotting but I was running through the sage
 tutorial and thought I would check it out.

 The plot3d command works silently producing no visible output and no
 error messages.

 I found that my system lacked java so I downloaded the standard ubuntu
 version using synaptic. This had no effect on plotting.

 Any thoughts?

 Best wishes,
                     Jack Fearnley
-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: plot3d can't handle log(0)

2009-11-17 Thread William Cauchois
On Tue, Nov 17, 2009 at 6:08 AM, kcrisman kcris...@gmail.com wrote:


 Would all these ideas for testing deal with the triangulation issue,
 Bill?  Your original post seems to imply this.

 - kcrisman


I thought that, during triangulation, we could test for NaN values and
delete those faces. However, I see now that ParametricSurface.triangulate
assumes a regular indexing scheme for the _faces array, so the array must be
full. This means that deleting faces must be performed after the mesh has
been triangulated, unless we want to change the algorithm significantly.

Jason Grout and I actually dealt with these same issues when working on
#5514, exclusions for parametric 3D plots, which unfortunately is not
entirely finished. Perhaps a better way to get plot3d to handle functions
with undefined values would be to finish work on #5514, and then after we
encounter undefined values apply a region function (this is the feature that
#5514 implements) that serves to exclude those values. I should have
recognized this at the beginning!

Does that sound like a good course of action? I can definitely revisit
#5514.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

[sage-support] Re: plot3d can't handle log(0)

2009-11-15 Thread William Cauchois

I was looking into this issue this afternoon, and its more complicated
than it might appear at first. Removing a point in a 2D plot is
relatively simple, but when you remove a point in a 3D plot you could
be affecting several faces. There is also the matter that evaluation
is separate from triangulation, so you have to find out how to
communicate the fact that a vertex doesn't exist between the two
stages (since ParametricSurface usually assumes it has a uniform
grid).

If during evaluation you could set the vertex coordinates at a non-
existent point to be some kind of special NaN value, you could omit
that vertex later during triangulation. Does anyone know how you could
get at such a NaN value for Cython doubles?

- Bill

On Nov 10, 12:34 pm, kcrisman kcris...@gmail.com wrote:
 In 4.2.1.alpha0:

 sage: f(x,y)=ln(x)
 sage: P=plot3d(f,(x,0,1),(y,0,1))
 sage: P
 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (16,0))
 ---
 ValueError                                Traceback (most recent call
 last)
 snip a lot
 ValueError: math domain error

 Switch to (x,0.1,1), and all is well.  I am pretty sure the problem is
 that line 404 in plot/plot3d/parametric_surface.pyx doesn't have an
 exception handler forlog(0) or other such nan type values:

 sage: math.log(0)
 snip
 ValueError: math domain error

 But in the plotting context, it's silly not to just ignore this; we
 check for things like this all the time:
 sage: plot(log,0,1)
 works fine

 Unfortunately, I don't know enough about C/Cython to fix this.  For
 now it would probably be enough to fix it for the z variable.  This is
 now #7423.  Any takers, or hints as to how to fix this?  Thanks!

 - kcrisman
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: z-range issues in implicit_plot3d

2009-11-08 Thread William Cauchois

Thanks for your work resolving this issue! I will be happy to create a
Trac ticket and submit a patch with this change.

-- Bill

On Nov 8, 7:38 pm, Matt Rissler discn...@gmail.com wrote:
 Poking through the code

 I think line 922 in sage/plot/plot3d/implicit_surface.pyx should read:

 self.zrange= ranges[2][:2]

 I'd submit the patch myself, but I'd have to create a login and figure
 out the versioning system.  Someday, but not today.

 Matt
 On Oct 24, 11:34 pm, Micah micah.ja...@gmail.com wrote:



  Greetings all,

  I have been fiddling around withimplicit_plot3dfor most of the day
  and I have noticed that sometimes, the range of values for z are
  partially disregarded.

  sage:  implicit_plot3d((x^2)/2+(y^2)/2+(z^2)/2,(x,-5,5),(y,-5,5),(z,
  0,5),contour=2)

  should produce only the northern hemisphere of the sphere of radius
  sqrt(8) but it produces the entire sphere.  Meanwhile

  sage:  implicit_plot3d((x^2)/2+(y^2)/2+(z^2)/2,(x,0,5),(y,0,5),
  (z,-5,5),contour=2)

  only produces the portion of the sphere in the first octant, rather
  than a full quarter of the sphere.

  Of course, thez-rangeis not always disregarded.

  sage:  implicit_plot3d((x^2)/2+(y^2)/2+(z^2)/2,(x,0,5),(y,-5,5),
  (z,-5,5),contour=2)

  produces the expected output.

  This happens on both 4.1.1 (on sagenb) and 4.1.2 (my installation).
  For convenience, I've published the sagenb notebook.  
  http://sagenb.org/pub/830/

  I have tried tracing through the code, but I was quickly overwhelmed
  by the task.

  -Micah
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: plotting and float

2009-09-03 Thread William Cauchois

By the way, you can make your original example work by using a lambda
instead of a symbolic expression:

sage: plot3d(lambda x, y: abs(e^(pi*i*x)+e^(pi*i*y)), (0,1), (0,1))

Should work. (Although I'm getting the error plot variables should be
distinct, which I think is a bug; workaround is to change one of the
lower bounds to 0.1 instead of 0.)

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: plotting and float

2009-09-01 Thread William Cauchois

It seems to me that the error comes from feeding a function which uses
i into fast_float (called by the plotting functions to compile the
function to be plotted into an optimized form). I tried a simpler
function using i and got the same error:

sage: plot3d(x + y + i, (x, 0, 1), (y, 0, 1))
Traceback (click to the left for traceback)
...
TypeError: float() argument must be a string or a number
sage: from sage.ext.fast_eval import fast_float
sage: fast_float(x + i, 'x')
Traceback (click to the left for traceback)
...
TypeError: float() argument must be a string or a number

It would make sense for the low-level representation used by
fast_float not to include a concept of imaginary numbers. Have you had
success plotting any other functions that use imaginary numbers? There
should be a mechanism to fall back to using the unmodified function in
the event that fast_float fails to convert the function.

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Null space of a matrix?

2009-06-06 Thread William Cauchois

Hi,

I needed to check the null space of the following matrix:

[ -2   7 ]
[ 00 ]

So I typed:

sage: matrix([[-2, 7], [0, 0]]).kernel()

And Sage 4.0.rc0 told me that the basis for the resultant vector space
was [0, 1]. But this does not seem correct -- [0, 1] does not even
satisfy the equation -2x_1 + 7x_2 = 0 that we can read off of the
matrix above (if we augment it with [0, 0] in our head).

So what's wrong? Is kernel() the right method to use for this? Or did
I read the result incorrectly? Or is my reasoning wrong (the
possibility that I fear most, since I have a linear algebra final on
Monday :D)?

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Null space of a matrix?

2009-06-06 Thread William Cauchois

Thanks Jason!

I see that right_kernel() also works for this.

-- Bill

On Sat, Jun 6, 2009 at 5:41 PM, Jason Groutjason-s...@creativetrax.com wrote:

 William Cauchois wrote:
 Hi,

 I needed to check the null space of the following matrix:

 [ -2   7 ]
 [ 0    0 ]

 So I typed:

 sage: matrix([[-2, 7], [0, 0]]).kernel()

 And Sage 4.0.rc0 told me that the basis for the resultant vector space
 was [0, 1]. But this does not seem correct -- [0, 1] does not even
 satisfy the equation -2x_1 + 7x_2 = 0 that we can read off of the
 matrix above (if we augment it with [0, 0] in our head).

 So what's wrong? Is kernel() the right method to use for this? Or did
 I read the result incorrectly? Or is my reasoning wrong (the
 possibility that I fear most, since I have a linear algebra final on
 Monday :D)?


 Sage returns the *left* nullspace, i.e., the solution to the equation
 xA=0.  You want the right nullspace; so do matrix(...).transpose().kernel().

 Jason



 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: parametric_plot3d appears to not give the correct axes values, also steals keyboard

2009-05-07 Thread William Cauchois

I filed a ticket at http://trac.sagemath.org/sage_trac/ticket/6002.

-- Bill

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: parametric_plot3d appears to not give the correct axes values, also steals keyboard

2009-05-07 Thread William Cauchois

On Wed, May 6, 2009 at 12:28 PM, Alden alden.wal...@gmail.com wrote:

 0)
 sagenb.com is awesome, especially since Mathematica 7 takes up 100% of
 my processor at all times under Ubuntu 9.04.

Glad to hear it :).

 1)
 When I run:
 parametric_plot( (cos(t), sqrt(2)*sin(t)) , (t,0,2*pi))
 I get a nice 2d parametric plot, with the top of the ellipse clearly
 hitting close to 1.5 on the y-axis.  When I run:
 parametric_plot3d( (cos(t), 1 , sqrt(2)*sin(t)), (t,0,2*pi))
 The top of the ellipse really looks like it's at z=1, and the whole
 thing looks a lot like a circle. I realize that this is probably not a
 problem with sage and rather with whatever is doing the plotting, but
 I thought I should point it out.

I think that this is a bug, but I can't find the source of the error
very easily. I will open a Trac ticket to address this issue. Thanks
for pointing it out!

 2)
 Also, after clicking and dragging on the 3d plot, I can't type
 anywhere in firefox (the notebook or the address bar) until I click
 onto another tab and then back again.  This may be a problem with java
 in my browser not taking the keyboard away from the applet.

That's odd. Do you mean to say that even when you try to move focus
away from the Java applet using your mouse, input is still captured? I
myself use Sage on vanilla Ubuntu 9.0.4 with no difficulties. Maybe
the problem is with your Java or web browser configuration.

 3-more of a feature request than an error I guess)
 I have noticed from googling that there has been some discussion about
 creating a function from R^n to R^m.  I am sure there is some good
 reason why this isn't the case, but I was curious about whether it
 would be possible to just automatically map everything over tuples of
 symbolic expressions, or make a tuple of symbolic expressions a
 symbolic expression itself.  For example, why couldn't diff( (t, 2*t),
 t) (which gives the error that a tuple is not a symbolic expression)
 notice that the tuple is a tuple of symbolic expressions, and then
 just map itself over it to get (1,2).  Also, then defining f(x,y) =
 (2*x, 2*y) seems like it would work.  Similarly, what if there was a
 dot product function which just did the obvious thing when it was
 given two tuples of symbolic expressions?  The reason that I am
 thinking about this is that it would be really awesome if I could tell
 my vector calculus class to do a line integral by defining what f(c(t))
 =fc(t) and c(t) are and then just:
 integrate( dot( fc(t),  diff( c(t), t), t, 0, 2*pi)
 rather than something like
 integrate( vector( (t,t^2,t^3) ).dot_product( diff( vector( (t,t,t) ),
 t ) ), t,0,2*pi)
 which is a little less intuitive.

To address your diff example: it is simple enough in this case to do
[diff(f, t) for f in (t, 2*t)]. I don't know what work is being done
in Sage to help work with vector-valued functions, but maybe someone
more familiar with the symbolic calculus component can chime in.

One way to improve your line integral example would be to refactor it
into a Python function in terms of f and fc, so that students could
simply type: line_integral(f, fc). But since this is a math class, I
understand if you do not want to go that in-depth into programming
techniques.

-- Bill

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug in region_plot

2009-03-20 Thread William Cauchois

I've had to deal with adapt_to_callable a bit, and I too would greatly
appreciate an improvement to it.

One thing that I think should be handled in adapt_to_callable, or
whatever its replacement will be, is plot ranges. Users are usually
allowed to explicitly specify variables in plot ranges (this overlaps
with adapt_to_callable's variable inference functionality), and I see
a lot of duplicated code to extract u_low and u_high from a plot range
which may be a 2-tuple or a 3-tuple. In Carl Witty's implicit surface
patch (#5249), I wrote a function called extract_vars_ranges_and_adapt
which may be worth taking a look at. From the docstring, it makes f
into a fast callable function, while inferring its arguments and
canonicalizing the provided ranges. This function can be found at
line 1193 in 
http://trac.sagemath.org/sage_trac/attachment/ticket/5249/trac5249.patch

Thanks,
Bill

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---