Re: [sage-support] plot(): no ticks and arrow on axes?

2011-01-31 Thread Renato Budinich
On Mon, Jan 31, 2011 at 12:48 AM, Francois Maltey fmal...@nerim.fr wrote:

 Renato a écrit :

  Hello, I can't understand how the ticks option works in plot()... I
 want to have no ticks or labels on the axis.

 Also, is it possible to show the arrows on the axis? like this:
 http://www.homeschoolmath.net/blog/few-complex-numbers.gif

 I'm using latest version of sage



 Search ticks and axes in plot? and copy/paste the examples :

 plot(sin(pi*x), (x, -8, 8), ticks=[[],[]], axes=false)
 + arrow((-8,0),(8,0), color=black)
 + arrow((0,-1),(0,1), color=black)


 If you want a grid add a function as

 def grid (xmin, xmax, ymin, ymax) :
   linesYcst = add (line ([(xmin, k), (xmax, k)]) for k in [ceil (ymin)..
 floor(ymax)])
   linesXcst = add (line ([(k, ymin), (k, ymax)]) for k in [ceil (xmin)..
 floor(xmax)])
   return linesXcst+linesYcst

 read the help about line2d? and find the right options !

 Then add to your (almost) last plot : + grid (the right area)

 F.




many thanks

renato

-- 
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: sage-64.txt

2011-01-31 Thread myildi
I have received the same problem, but I have the impression that it
stopped after having launched Sage in sudo mode once and executing a
small program (nothing special, just some stupid computation). Maybe
Sage tries to write this information in a place that needs sudo?
Otherwise, my sage folder is just inside of /Applications folder (this
could explain why we need sudo, if sage tries to write in a subfolder
of this tree).


On 31 jan, 02:56, Michael Beeson profbee...@gmail.com wrote:
 I downloaded the latest 64-bit dmg of Sage for OS X and installed it.
 It works, but I get a strange error message about sage-64.txt.
 Specifically,   if I put the following lines
 in a sage file and run sage with that file for input,  (here are the
 lines)

 L = [[cos(pi*i/100),sin(pi*i/100)] for i in range(200)]
 print 1;
 p = polygon(L, rgbcolor=(1,1,0))
 print 2;
 p.show()
 print 3

 then I do get the plot from p.show,  but in the console window I get
 the following output:

 Detected SAGE64 flag
 Building Sage on OS X in 64-bit mode
 Building Sage on OS X in 64-bit mode
 Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist
 Detected SAGE64 flag
 Building Sage on OS X in 64-bit mode
 Building Sage on OS X in 64-bit mode
 Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist
 Detected SAGE64 flag
 Building Sage on OS X in 64-bit mode
 1
 2
 3
 Michael-Beesons-iMac:~ beeson$

 The error messages repeat once for every line in the input file (yet
 the all precede the output from any of the commands).  If sage is
 started from the shell prompt,   I get this error message just once,
 and the interactive session is thereafter normal.   Googling the error
 message produced a reference to patch 9960  but I couldn't make sense
 of what to do to fix it.  Searching this site for the error message or
 for sage-64.txt produced no results.

-- 
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: Fwd: Integral functions

2011-01-31 Thread Andrea Gobbi
Thanks kcrisman!!!
Maybe the choice of the function sin(x)/x was not a good one...i would
to extend the derivation for generally integral function (F(x)=int_a^x
g(t)dt) where does't exist a primitive of g. I try with some function
and my procedure seems to work.
Thanks!

On 27 Gen, 14:41, kcrisman kcris...@gmail.com wrote:
 On Jan 27, 7:51 am, Andrea Gobbi andreamat...@gmail.com wrote:

  Hi!
  Maybe I resolve it...:

  def deriv(self, *args,**kwds): print args, kwds; return w(x)
  f(x)=-x*x*x+1
  w(x)=sin(x)/x
  tc=3
  def ef(self,x,parent=None):
      return numerical_integral(w,tc,x)[0]
  g=function('g',nargs=1,evalf_func=ef,derivative_func=deriv)

 Believe it or not, it wouldn't be too much harder to implement the
 sine integral Si(x) for Sage in general - as long as we had a reliable
 evaluation function in Pari, Scipy, mpmath, or somewhere.   mpmath at
 least has 
 it:http://mpmath.googlecode.com/svn/trunk/doc/build/functions/expintegra...

 I can't believe we don't have this already.  Am I missing something -
 can someone else confirm this (though search_src and a Google search
 revealed nothing, and none of the usual suspects in sage/functions
 have it)?

 - kcrisman In this way i can correctly compute for example the derivative of
  f(integral(w)) as:
  (diff(f(g(x)),x,1)
  And the value assumed for example in 4
  (diff(f(g(x)),x,1)(4).n())

  and this works also for n-th-derivative.

  I apologize if you waste time :-)
  Thanks!
  Andrea Gobbi

  -- Forwarded message --
  From: Andrea Gobbi andreamat...@gmail.com
  Date: 2011/1/26
  Subject: Integral functions
  To: sage-support sage-support@googlegroups.com

  Hi!
  I have a question...I'm working with integral functions:

  var('t,x')
  f(t)=t^2
  F(x)=integral(f,t,0,x)

  and obviously:

  F(x).derivative() give x^2 as result.

  Now the question is: can i have the same result if f doesn't admit a
  primitive? I think that when sage sees integral(f,t,0,x), tries to
  compute a primitive G and then assigns to F the difference between
  G(x) and G(0). In this way when i try to calculate the derivative of
  F, the result is f.
  For example:

  var('t,x')
  f(t)=t^2
  F(x)=integral(sin(t)/t,t,1,x,assume(x1))

  I look at the reference manual and I  find a section in which we can
  force a funcion to have a rule for the derivation  (pag. 252)  but I
  don't understand how to do this. Sorry for my awful english!
  Thank you!
  Best regards!
  Andrea Gobbi

  --
  Andrea Gobbi

-- 
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: Error starting sage after a source build

2011-01-31 Thread jorges
Well, some bad and good news:

The bad:
I reinstalled ubuntu (not specifically for sage, as there were other things 
I've been trying to solve for a long time, but it helped me decide to do 
it), reinstalled sage, and I get exactly the same error.

The good:
I think I am closer now to find the cause of the problem: I have ipython 
from git locally built, and thus I have PYTHONPATH defined. It seems sage is 
using my own version of ipython:

jscandal@jorges { ~/sw/sage/sage-4.6.1 }$ ./sage -python
Python 2.6.4 (r264:75706, Jan 31 2011, 12:29:16) 
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
 import IPython
 IPython.__file__
'/home/jscandal/sw/ipython/ipython-git/IPython/__init__.pyc'

What are the rules in sage regarding PYTHONPATH? I would have thought that 
sage would use its own version of every package. My use of PYTHONPATH is 
probably interfering so, how do I get my local ipyhton (and other modules 
and libraries) play nice with sage? Can it be configured a-posteriori? 
Thanks for any pointers.

jorges

-- 
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: plot(): no ticks and arrow on axes?

2011-01-31 Thread Jason Grout

On 1/30/11 5:48 PM, Francois Maltey wrote:

Renato a écrit :

Hello, I can't understand how the ticks option works in plot()... I
want to have no ticks or labels on the axis.

Also, is it possible to show the arrows on the axis? like this:
http://www.homeschoolmath.net/blog/few-complex-numbers.gif

I'm using latest version of sage


Search ticks and axes in plot? and copy/paste the examples :

plot(sin(pi*x), (x, -8, 8), ticks=[[],[]], axes=false)
+ arrow((-8,0),(8,0), color=black)
+ arrow((0,-1),(0,1), color=black)


If you want a grid add a function as

def grid (xmin, xmax, ymin, ymax) :
linesYcst = add (line ([(xmin, k), (xmax, k)]) for k in [ceil (ymin)..
floor(ymax)])
linesXcst = add (line ([(k, ymin), (k, ymax)]) for k in [ceil (xmin)..
floor(xmax)])
return linesXcst+linesYcst



We also have gridlines implemented:

http://sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot.Graphics.show

(see the gridline bullet point, or search the examples for Add grid 
lines at the major ticks of the axes. and the few examples following that)


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


[sage-support] Re: Plotting: axes with ticks but with no labels

2011-01-31 Thread Jeff


On Jan 28, 11:20 pm, kcrisman kcris...@gmail.com wrote:
 On Jan 28, 9:52 am, D. S. McNeil dsm...@gmail.com wrote:



  On Fri, Jan 28, 2011 at 9:08 PM, Jeff wrote:
   I would like to be able to plot a function, e.g. plot(sin), that has
   axes and ticks on the axes but that does not have labels for the
   ticks. I understand that I might be able to do this using a ticker
   formatter, perhaps also, by directly using matplotlib, but I do not
   know exactly how to go about doing this.

  There may be a simpler way, but:

  import matplotlib

  p = plot(sin)
  p.show(tick_formatter=(matplotlib.ticker.NullFormatter(),
                         matplotlib.ticker.NullFormatter()))

  worked for me.  The repetition is to make sure that both x and y tick
  labels are turned off.

 Yes, if you look athttp://www.sagemath.org/doc/reference/sage/plot/plot.html
 and search for tick_formatter, you will see documentation for this.

 Do you think it would be worth having the null formatter as a
 specified option?  The string null could easily have the default be
 the null formatter - that would be easy to add.

 - kcrisman
First of all thanks to you and the others for the helpful suggestions.

Whatever it ends up being called, a null formatter option would be
useful, I think. In fact, it would be nice to be able to specify
arbitrary labels for each tick mark (not necessarily corresponding to
the numbers that they represent). I don't think this done in
http://www.sagemath.org/doc/reference/sage/plot/plot.html, although
with matplotlib directly  I suppose it could be done.

So, for example, along with tick mark specifications such as [ [1,
1,2], [ 2, 3] ], there could be a corresponding tick label list:
[ ['label for tick at 1', 'label for tick at 1.2'], ['label for tick
2', 'label for tick 3'] ]. If I remember rightly there might be
something a bit like this in Mathematica.

Jeff

-- 
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: axes with ticks but with no labels

2011-01-31 Thread Jeff


On Jan 28, 10:52 pm, D. S. McNeil dsm...@gmail.com wrote:
 On Fri, Jan 28, 2011 at 9:08 PM, Jeff wrote:
  I would like to be able to plot a function, e.g. plot(sin), that has
  axes and ticks on the axes but that does not have labels for the
  ticks. I understand that I might be able to do this using a ticker
  formatter, perhaps also, by directly using matplotlib, but I do not
  know exactly how to go about doing this.

 There may be a simpler way, but:

 import matplotlib

 p = plot(sin)
 p.show(tick_formatter=(matplotlib.ticker.NullFormatter(),
                        matplotlib.ticker.NullFormatter()))

 worked for me.  The repetition is to make sure that both x and y tick
 labels are turned off.

 Doug

 --
 Department of Earth Sciences
 University of Hong Kong

Thanks Doug, I've just tried this method and it worked very well.

Jeff

-- 
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: Error starting sage after a source build

2011-01-31 Thread jorges
I did a clean install, removing from my .bashrc two lines defining the 
PYTHONPATH and the PATH variables, opening a new terminal and making sure 
there were no traces of those variables in the environment. Sage built ok, 
but I got the same error upon starting sage.
Then it occurred to me that I could move/rename the local ipython folder, 
and so I did it, and sage finally started OK! Now, how is sage picking my 
local version of ipython? Isn't it supposed to provide its own version? I 
will eventually have to start using my local copy of ipython (and other 
libraries that I build from source). How can I stop sage from looking 
outside its own directory tree?

jorges

-- 
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] Building error on Pari

2011-01-31 Thread Edgar Duéñez-Guzmán
Hello,

   I downloaded the source version of Sage and I ran into this error
while building:

gcc  -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer  -O3 -g
-I. -I../src/headers -fPIC -o base3.o ../src/basemath/base3.c
gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See http://bugs.opensuse.org/ for instructions.
make[3]: *** [base3.o] Error 1
make[3]: Leaving directory
`/home/xxx/sage-4.6.1/spkg/build/pari-2.4.3.alpha.p0/src/Olinux-x86_64'
make[2]: *** [gp] Error 2
make[2]: Leaving directory
`/home/xxx/sage-4.6.1/spkg/build/pari-2.4.3.alpha.p0/src'
Error building GP

real    9m15.553s
user    8m52.292s
sys    0m3.862s
sage: An error occurred while installing pari-2.4.3.alpha.p0

My system is as follows

OS:  Linux 2.6.31.14-0.4-desktop x86_64
 System:  openSUSE 11.2 (x86_64)
 Gnome: 2.28.2
 KDE:  4.3.5 (KDE 4.3.5) release 0

Processor (CPU):   Intel(R) Xeon(R) CPU W3570 @ 3.20GHz
 Speed:  3,200.53 MHz
 Cores:  4

Total memory (RAM):  5.8 GiB

gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]
g++ (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]
GNU Fortran (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]

On a second attempt, the compiler just hung on the same file (base3.c)
as well as attempts to build pari (pari-2.4.3.alpha.p0, version shipped
with sage) from source independently. Any thoughts on this would be much
appreciated.

Thanks,

Edgar

--
Dr. Edgar A. Duenez-Guzman
Postdoctoral Fellow
Department of Organismic
and Evolutionary Biology
Harvard University



-- 
Dr. Edgar A. Duenez-Guzman
Postdoctoral Fellow
Department of Organismic
and Evolutionary Biology
Harvard University

-- 
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: Building error on Pari

2011-01-31 Thread Volker Braun
GCC 4.4.1 is broken, and has been fixed a long time ago. Right now we have 
4.4.5 and 4.5.2. Do yourself a favor and upgrade. 

There is a patched PARI spkg on trac that will avoid the compiler error at 
the cost of decreased performance. 

Volker

-- 
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: Error starting sage after a source build

2011-01-31 Thread Volker Braun
There might be something in ~/.ipythonrc that pulls in your own ipython.

-- 
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: Error starting sage after a source build

2011-01-31 Thread Volker Braun
I mean ~/.ipython/

-- 
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] Bug with ending line in question mark in NB

2011-01-31 Thread kcrisman
I think this is known, but I couldn't find the Trac ticket.

If you end a line with a question mark in the notebook, even after a #
(comment sign), the nb interprets this as a request for documentation,
ending with (potentially) amusing/destructive results.

is_prime(5) # Is this number prime?
unknown object 'prime'

or something like that.  Interestingly, one of my students noted that


is_prime(5) # Is this number prime'?'
True

works.  I guess that's not totally surprising.  Still, it's
unfortunate.  So if it isn't known, I'm reporting it.  Would it be
quite easy to fix?  (?)

- 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


Re: [sage-support] Re: Error starting sage after a source build

2011-01-31 Thread jorges
There seem to be nothing special in ~/.ipython:

jscandal@jorges { ~/sw }$ ls /home/jscandal/.ipython/
Crash_report_ipython.txt  history   ipython_config_pylab.py
dbhistory.json  ipython_config_pysh.py

I have even moved ~/.ipython elsewhere, but sage will load the ipython from 
my local directory, if it is available, and thus give the import error. It's 
like if the path was hardcoded somewhere, but I don't see where. It's not in 
the environment, as $ env | grep -i python returns nothing.

Wait! I think it's picking up ~/.local/bin/ipython, which has hardcoded the 
location:

jscandal@jorges { ~/.local_disabled/bin }$ cat ipython
#!/usr/bin/python
# EASY-INSTALL-DEV-SCRIPT: 'ipython==0.11.dev','ipython'
__requires__ = 'ipython==0.11.dev'
from pkg_resources import require; require('ipython==0.11.dev')
del require
__file__ = '/home/jscandal/sw/ipython/ipython-git/IPython/scripts/ipython'
execfile(__file__)

I think that is what is going on. ~/.local/bin must be a standard place to 
look for binaries? Is it expected to be like that? How does sage avoids, for 
example, picking up on the system's python? Shouldn't it be the same here? 
Well, at least I have an idea now, let's see if I can figure out a 
workaround.

jorges






-- 
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] real part incorrectly simplified away

2011-01-31 Thread Michael Beeson
Here are the contents of a sage file.

var('z')
C = ComplexField()
i = C(0,1)
X = real(integral(z,z))
print X
X = simplify(X)
print X


Here is the corresponding output

1/2*real_part(z)^2 - 1/2*imag_part(z)^2
1/2*z^2

The first line is already surprising as I expected 1/2 *
real_part(z^2).   But it's mathematically correct!
The second line, however, is not correct.

-- 
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: real part incorrectly simplified away

2011-01-31 Thread Michael Beeson
It seems that var('z') makes sage think z is real.

simplify(real(z))  returns z  and simplify(imag(z)) returns 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
URL: http://www.sagemath.org


Re: [sage-support] Re: Error starting sage after a source build

2011-01-31 Thread Volker Braun
$HOME/.local/bin is not a standard place to look for executables. It will 
only be searched if you put it into the PATH yourself.


-- 
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: real part incorrectly simplified away

2011-01-31 Thread Burcin Erocal
On Mon, 31 Jan 2011 14:19:51 -0800 (PST)
Michael Beeson profbee...@gmail.com wrote:

 It seems that var('z') makes sage think z is real.
 
 simplify(real(z))  returns z  and simplify(imag(z)) returns 0.

This is #6862 on trac:

http://trac.sagemath.org/sage_trac/ticket/6862

It's one of the major bugs remaining in the maxima interface.


Cheers,
Burcin

-- 
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: real part incorrectly simplified away

2011-01-31 Thread Jeff
On Feb 1, 12:01 pm, Burcin Erocal bur...@erocal.org wrote:
 On Mon, 31 Jan 2011 14:19:51 -0800 (PST)

 Michael Beeson profbee...@gmail.com wrote:
  It seems that var('z') makes sage think z is real.

  simplify(real(z))      returns z  and simplify(imag(z)) returns 0.

 This is #6862 on trac:

 http://trac.sagemath.org/sage_trac/ticket/6862

 It's one of the major bugs remaining in the maxima interface.

 Cheers,
 Burcin

I would like to add what is perhaps a related issue.

If I do

var('a')
assume(a, 'real')

I would like to have the imaginary part returned as zero. However

imag(a)

returns imag(a), as though it is a symbol, I believe because
type(imag(a) returns  type 'sage.symbolic.expression.Expression'.

To be consistent with the assumption, though, I think that iimag(a)
should return zero.

Jeff

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