Re: [sage-support] Re: integral() error

2011-09-06 Thread robin hankin
Hello Justin

thanks for this...I'm more familiar with the R help list, where
there's a very heavy emphasis on not wasting bandwidth,
and replies not much less terse than 'rtfm' are very common.

So, I'm finding the more tolerant atmosphere in sage to take some
getting used to!

best wishes

Robin


On Mon, Sep 5, 2011 at 4:30 PM, Justin C. Walker jus...@mac.com wrote:
 Hi, Robin,

 On Sep 4, 2011, at 16:10 , robin hankin wrote:

 Hello Justin

 thanks for this.

 (I'm a linux user but currently getting to know macosx).

 If you use linux, you aren't that far from (command-line) Mac OS X.  It's 
 basically a BSD unix at that level.

 $SAGE_ROOT was null, but I can run it from the commandline by changing
 to Applications/Sage-4.7.1-OSX-64bit-10.6.app/Contents/Resources/sage/
 and running ./sage.

 As I said, you had to replace $SAGE_ROOT with a real path.  But you've 
 gotten past this.

 And the integral() command seems to work but I have other problems:


 wt118:/Applications/Sage-4.7.1-OSX-64bit-10.6.app/Contents/Resources/sage%
 ./sage
 --
 | Sage Version 4.7.1, Release Date: 2011-08-11                       |
 | Type notebook() for the GUI, and license() for information.        |
 --
 sage: 2+2
 4
 sage: integral(x^2,x)
 1/3*x^3
 sage: quit()

 'quit' is a command, not a procedure call; in both Python and iPython, you 
 call quit(), but apparently, in Sage, not so much :-}.  Note that Sage is 
 essentially Python, with a modified iPython front end, and a bit of syntactic 
 sugaring with a preparser.  We throw a few things like this in just to keep 
 the hapless user on his toes.  Or hers.

 I'm beginning to think I should reinstall from scratch (or indeed
 compile my own).

 No need.  The precompiled version should work just fine.  You only have to 
 survive the learning curve :-}

 Keep asking questions and reading documentation.

 Apropos of documentation, there is a lot available

  http://www.sagemath.org/help.html#SageStandardDoc

 but what's there can always use improvement.  Feel free to browse and either 
 ask questions or submit bug reports (cf. 
 http://www.sagemath.org/development.html).  Also, there is some built-in 
 documentation in Sage.  To get an idea, type (at the prompt) the beginning of 
 a procedure name (e.g., there is one that creates a number field):

  sage: Number[TAB]

 should produce a list of four known Sage identifiers.  Typing

  sage: NumberField?

 will get you the sourcecode documentation for this procedure.  Using ?? 
 instead of ? will get you the documentation plus source code, so you can 
 see the implementation details.

 That may help get you started.

 We're here to help.  Sometimes, we succeed.

 Justin

 --
 Justin C. Walker, Curmudgeon-At-Large
 Institute for the Absorption of Federal Funds
 
 If you're not confused,
 You're not paying attention
 



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




-- 
Robin Hankin
Uncertainty Analyst
hankin.ro...@gmail.com

-- 
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] Warnings and lines

2011-09-06 Thread Dan Aldrich
Two questions, how to turn off divide by 0 warnings and how to draw a 
line over a plot. I was trying to draw a horizontal line at the 
equilibrium solution at y = -3.


set_verbose(-1) #Turn off warning
s1 = -3
p1 = plot_slope_field(((y+3)/(1-y)), (x,-6,6), (y,-6,6)).show(aspect_ratio=1)
p2 = plot(s1)
show (p1+s1)

Thanks,
-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
URL: http://www.sagemath.org


[sage-support] Re: Warnings and lines

2011-09-06 Thread kcrisman
 set_verbose(-1) #Turn off warning

I think there is a way to turn off those warnings, but I think one has
to do it from within Numpy.

 s1 = -3
 p1 = plot_slope_field(((y+3)/(1-y)), (x,-6,6), (y,-6,6)).show(aspect_ratio=1)

You should assign the plot itself to p1.  Currently you've assigned
the show - probably None is returned? to p1.

 p2 = plot(s1)
 show (p1+s1)

And now you added -3 to the show.

Try

sage: p1 = p1 = plot_slope_field(((y+3)/(1-y)), (x,-6,6), (y,-6,6))
sage: p2 = plot(s1,-6,6)
sage: show(p1+p2,aspect_ratio=1)

Good luck!  Hopefully someone else who doesn't have to run to work
will remember how to shut off the warnings.  In any case, there is a
ticket open related to this, upstream has been informed (because they
are not really valid, it's related to our slope field lines having
arrowheads of zero size).

- 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] writing solution in sage to OpenCV cvSolve

2011-09-06 Thread Matti Koskinen
hi,

new to this list, but using sage for some time.
I have a function E(Xc,Yc,Zc) which calculates the squared distance of
camera center 3d coordinates (as per paint-brush laser scanner by
Zagorchev Goshtasby). I have the partial derivatives of E Xy Yc and
Zc which are set to zero. My problem is that the function is very
long, using real measured 3d coordinates in the double frame. My code
is in c++ using OpenCV. I'd like to use cvSolve to calculate the 3d
camera coordinates, but writing the A matrix and b vector by hand is
very tedious and prone to typos, so using sage to set up  the matrix
would be ideal. I've googled and searched the sage documentation, but
not finding an easy way to do this. Even getting the variables to left-
hand side and the constants to right-hand side would help a lot. I
know nearly nothing about python, but I think it should be able to
write a function which outputs directly code for OpenCV. Are there any
sage functions to simplify the process?

thanks

-matti

-- 
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] w/ sliders in interact functions, how apply format strings to the numbers? (Want to truncate decimals!)

2011-09-06 Thread Chris Seberino
This slider will display the corresponding numbers as the slider is
moved

@interact
def _(a=slider(1, 2, 0.2)):
print test

The problem is the numbers have too many digits for my taste...

e.g. 1.00, 1.20, 1.40, etc.

How truncate or round or format?

Thanks!

Chris

-- 
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] w/ sliders in interact functions, how apply format strings to the numbers? (Want to truncate decimals!)

2011-09-06 Thread William Stein
On Tue, Sep 6, 2011 at 10:15 PM, Chris Seberino cseber...@gmail.com wrote:
 This slider will display the corresponding numbers as the slider is
 moved

 @interact
 def _(a=slider(1, 2, 0.2)):
    print test

 The problem is the numbers have too many digits for my taste...

 e.g. 1.00, 1.20, 1.40, etc.

 How truncate or round or format?

Here is one way:

@interact
def _(a=slider(1, 2, RealField(5)(.2))):
   print test, a, RR(a), RR(str(a))


Note -- here a will be a 5-bit real number, so you may want to convert
it to a full 53-bit number before using it.   One way to do that which
will preserve the *print output* is RR(str(a)).  That will probably be
less confusing to users than RR(a).

William



 Thanks!

 Chris

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




-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.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] How make/hack 1D real number line plots like we learned in elementary algebra?

2011-09-06 Thread Chris Seberino
Sage can do great 2D and 3D plots.

What about baby 1D plots that would be really nice for the kids?

If I select a number using an interact widget, it would be nice to see
a plot of a 1D real number line with the selected point appear as a
big colored dot.  Plots of solutions to inequalities like x  1 would
be icing on the cake and involve the same big colored dot with a ray
drawn to one side.

Any examples somewhere?

Chris

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