[sage-support] Re: Warnings from JsMath

2008-01-25 Thread Timothy Clemans

See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
There are install instructions for PC, Mac OS X, and Unix users.

On Jan 24, 11:45 pm, bill purvis [EMAIL PROTECTED] wrote:
 On Friday 25 January 2008, William Stein wrote:

  On Jan 24, 2008 8:52 PM, Timothy Clemans [EMAIL PROTECTED] wrote:
   In the first versions of the Sage Notebook that message was actually
   hidden.

  (1) If one wants to disable the font message, comment out (with /* */) line
  253 of SAGE_ROOT/devel/sage/sage/server/notebook/js.py and do sage -br:

  /* jsMath = {Font: {Message: function () {}}} */

  I do not think this should be the default in Sage.  However, a nicer error
  message would be good, which provides a link to a _local_ download page
  for the jsmath fonts, which is much easier to understand and follow than
  the official jsmath page.

  (2) Any typesetting in the notebook basically looks like crap without the
  jsmath fonts, so it would be bad to encourage people to completely remove
  the warning message.

  (3) The fonts are tiny (120KB) and fairly easy to install:

 http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html

   -- William

 The fonts I downloaded are 80Mb!

 And where should they be installed? I can't work out where the
 notebook server expects to find them.

 I thought they were included as part of the Sage distribution, anyway?

 Bill
 --
 +---+
 | Bill Purvis, Amateur Mathematician|
 |  email: [EMAIL PROTECTED]  |
 |  http://bil.members.beeb.net |
 +---+
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Warnings from JsMath

2008-01-25 Thread William Stein

On Jan 25, 2008 4:49 AM, bill purvis [EMAIL PROTECTED] wrote:

 On Friday 25 January 2008, Timothy Clemans wrote:
  See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
  There are install instructions for PC, Mac OS X, and Unix users.
 
  On Jan 24, 11:45 pm, bill purvis [EMAIL PROTECTED] wrote:
 Yes, but what about Sage users?

 They say unpack them in the server tree. I know where my Apache server
 keeps things, and I've installed them in there.

??!  There is nothing about server trees here:
http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html

You just download a 120KB zipped font file, extract it and install it
as explained there.
It has nothing whatever to do with servers.

 Where is the server tree for the notebook server?

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



[sage-support] Re: Putting parentheses around -1.

2008-01-25 Thread John Cremona

On 25/01/2008, Paul Zimmermann [EMAIL PROTECTED] wrote:

  In previous versions of Mathematica, there was a RealOnly package
  which defined odd roots as negative and printed Nonreal anytime a
  complex number was unavoidable.  The idea was that you could simplify
  things for high school students or in situations in which you knew you
  were only interested real numbers.  That package has apparently been
  deprecated now in version 6.0, being replaced by the functionality to
  Reduce an equation over the reals, etc.  For details, you can see the
  package at http://library.wolfram.com/infocenter/MathSource/6771/

 the problem with such a package, which basically simplifies (-1)^(1/3) to -1,
 is that it might have side effects with internal computations, and thus give
 wrong results.

 Imagine for example that for a given computation, which involves real numbers
 only at the user interface level, SAGE needs to compute internally over the
 complex numbers. If such an internal algorithm working on the complex numbers
 was designed for the classical branch choice, i.e., (-1)^(1/3) = 1/2 +
 sqrt(3)/2*I, then changing the rules will surely make this algorithm fail,
 and thus return inconsistent or wrong results.

 If one wants that (-1)^(1/3) simplifies to -1, the only clean solution I see
 is to write a special function simplify_real to do that, but be prepared to
 see inconsistent results.


+1

This is an ancient question which all CAS have to wrestle with at some
point (I remember when it was Maple's turn).   What seems
superficially to be the elementary solution to the question of
odd'th roots of negative reals just leads to horrendous internal
problems if followed through.  Maths is not always simple.

John

 Paul Zimmermann

 



-- 
John Cremona

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



[sage-support] Re: [Re: forwarded message from William Stein about R]

2008-01-25 Thread Jacob Hicks

I am kind of newbie on both sage and R, but since I have been playing
with both of these all week, here is my take.

 In particular I haven't a clue how R interfaces with SAGE.  For
 example, setting plot parameters via par(ann=0) would be persistent
 in an R session, ie you wouldn't have to repeat this with every
 subsequent plot.  When calling R from SAGE is there an R session that
 persists until it is killed explicitly or by exiting SAGE?

It calls R from a shared library (R compiled with --enable-R-shlib)
through open source interface between python and R called rpy.

 In R I usually make the plot first, then copy to ps,png,or pdf with
 dev.copy.  I infer from the duscussion below that one doesn't see the
 plot directly in an R graphics window, but it is copied into the SAGE
 cell, whatever that is.  [I assume the os.curdir+'/out.ps' is
 directing it to the SAGE cell?]

There are two ways (maybe more) to run sage.  The issue being
discussed is when working on the sage notebook interface, which is
through a web browser.  Images (png, jpeg) written to os.curdir are
grabbed by the notebook and displayed on the appropriate cell in the
web browser.

 Would it be helpful to have the R graphics window, allowing use of
 interactive graphical functions like locator() and identify(),
 plus the ability to construct a graph in steps and make additions
 before copying?

It is not entirely true that you cannot see the output in an R
graphics window.  Running the console interface to sage on a computer
with an X server, you can do anything that works in native R or more
specifically anything you can do in rpy.  The code you wrote works
exactly as expected with only a couple minor changes in console sage.

 import r from rpy
 r.X11()
 r.par(ann=0)
 values = [x for x in srange(0,float(pi),.1)]
 r.plot(values, [sin(x) for x in values], type='lines',lty=1, col=blue)
 r.lines(values, [cos(x) for x in values],col=red,lty=2)
 r.legend(r.locator(1),legend=r.c(sin,cos),lty=r.c(1,2),col=r.c(blue,red))
 r.dev_copy(r.postscript,os.curdir+'/out.ps')
 r.dev_off()

When I run that code in the sage notebook interface from a browser on
the same computer as the server it works just like the console version
by popping up a window.  However, a user accessing the server from
another machine doesn't have that option (It seems just calling
r.X11() caused an infinite loop in this case). This eliminates access
to all the locator and identify interactive features and complicates
seeing the intermediate forms of a plot while building it (though I
can probably make that work with dev_copy).

In conclusion, having these same features available in the notebook
interface that the R graphics window allows in the console interface
would be helpful to me.

Jacob

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



[sage-support] Re: Warnings from JsMath

2008-01-25 Thread bill purvis

On Friday 25 January 2008, Timothy Clemans wrote:
 See http://www.math.union.edu/~dpvc/jsmath/download/jsMath-fonts.html.
 There are install instructions for PC, Mac OS X, and Unix users.

 On Jan 24, 11:45 pm, bill purvis [EMAIL PROTECTED] wrote:
Yes, but what about Sage users?

They say unpack them in the server tree. I know where my Apache server
keeps things, and I've installed them in there.

Where is the server tree for the notebook server?

Bill
-- 
+---+
| Bill Purvis, Amateur Mathematician|
|  email: [EMAIL PROTECTED]  |
|  http://bil.members.beeb.net  |
+---+

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



[sage-support] Re: Warnings from JsMath

2008-01-25 Thread Ted Kosan

Bill wrote:

 Where is the server tree for the notebook server?

The fonts are installed in the computer that is running the browser,
not the one that is running the Sage server :-)  The idea is that the
browser loads the fonts from the hard drive that it was launched from
when it visits a web page that uses jsMath.  For example, here is a
web page that uses jsMath and it will also show the warning message if
your system does not have the fonts installed:

http://www.math.union.edu/~dpvc/jsmath/examples/TeXbook16.html

Ted

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



[sage-support] [Re: forwarded message from William Stein about R]

2008-01-25 Thread Albyn Jones

William asked me to post a copy of an off-line discussion to
this list.  Here it is:


Since I still haven't gotten around to learning SAGE, I am
operating from a purely R-centric perspective here.

In particular I haven't a clue how R interfaces with SAGE.  For
example, setting plot parameters via par(ann=0) would be persistent
in an R session, ie you wouldn't have to repeat this with every
subsequent plot.  When calling R from SAGE is there an R session that
persists until it is killed explicitly or by exiting SAGE?

In R I usually make the plot first, then copy to ps,png,or pdf with
dev.copy.  I infer from the duscussion below that one doesn't see the
plot directly in an R graphics window, but it is copied into the SAGE
cell, whatever that is.  [I assume the os.curdir+'/out.ps' is
directing it to the SAGE cell?]

Would it be helpful to have the R graphics window, allowing use of
interactive graphical functions like locator() and identify(),
plus the ability to construct a graph in steps and make additions
before copying?

For example, (just making stuff up :-)

r.X11()
r.par(ann=0)
values = [x for x in srange(0,float(pi),.1)]
r.plot(values, [sin(x) for x in values], type='lines',lty=1, col=blue)
r.lines(values, [cos(x) for x in values],col=red,lty=2)
r.legend(locator(1),legend=c(sin,cos),lty=c(1,2),col=c(blue,red))
r.dev.copy(postscript,os.curdir+'/out.ps')
r.dev_off()

albyn


On Thu, Jan 24, 2008 at 02:40:26PM -0500, David Perkinson wrote:
 - Forwarded message from William Stein [EMAIL PROTECTED] -

 Date: Thu, 24 Jan 2008 11:38:40 -0800
 From: William Stein [EMAIL PROTECTED]
 To: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: [sage-newbie] Re: [sage-devel] Re: R and rpy


 On Jan 24, 2008 9:24 AM, mhampton [EMAIL PROTECTED] wrote:
 
  OK I think I have learned a little.  The following code seems to flush
  the output properly, and sends it to the current cell.
 
  r.postscript(os.curdir+'/out.ps')
  r.par(ann=0)
  values = [x for x in srange(0,float(pi),.1)]
  r.plot(values, [sin(x) for x in values], type='lines')
  r.dev_off()
 

 Cool.  The following slight variant plots perfectly in any cell, etc.,
 and doesn't
 display any funny cruft:

 from rpy import r
 r.png(os.curdir+'/sage.png')
 r.par(ann=0)
 values = [x for x in srange(0,float(pi),.1)]
 r.plot(values, [cos(x^2) for x in values], type='l')
 _ = r.dev_off()

 Now somebody needs to start on the nice usage of R from Sage package for
 Sage, which will have a plot wrapper, etc., etc.,  This would likely go in 
 *the*
 already existing directory

 SAGE_ROOT/devel/sage/sage/stats/

 In fact, it would be best if like with symbolic calculus we view this
 as a general
 package for doing statistics, which just happens to built almost entirely on 
 R.
 But we could also provide hooks into some of the very formidable (or
 not?) statistics
 capabilities of SciPy.

  -- William
 

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