[sage-support] Change to a local variable affects the variable outside the program

2008-12-14 Thread giovanni.marche...@ds.unifi.it
The following behavior is very confusing to me. I define a program def test(a): b=a b = a^2 return b Then if I assign x = 2 and then execute test(x) 4 I get x squared and x unchanged: x 2 However suppose now that I want the same on a single element of a matrix and define

[sage-support] Re: Change to a local variable affects the variable outside the program

2008-12-14 Thread Lars Fischer
Hello Giovanni, you have hit one of my favorite Python Pitfalls: Python does always call by value, but sometimes it behaves like call by reference . The explanation is hidden in a footnote in the tutorial. Please see Defining Functions in More Control Flow Tools in the Python Tutorial:

[sage-support] Re: The image of a matrix

2008-12-14 Thread daveloeffler
That On Dec 13, 6:50 pm, Jason Grout jason-s...@creativetrax.com wrote: That sounds the best way.  We'll make kernel_left/right (along with left/right_kernel) the global functions, and people can do kernel = left_kernel in their init.sage or at the beginning of their session, if they want.

[sage-support] Re: Lines won't show on coordinate axes

2008-12-14 Thread louie
On Dec 14, 7:16 am, David Joyner wdjoy...@gmail.com wrote: I'm guessing the asex are rendered last, so the lines get overwritten. You can use show(a1+a2+l1+l2+p,axes=False) or a1=arrow((0,0),(3,1),rgbcolor=(0,1,1)) a2=arrow((0,0),(-3.5,2.5),rgbcolor=(0,0,1))

[sage-support] Re: The image of a matrix

2008-12-14 Thread adrian
I think the following is also a source of frustration: v=vector([1,2,3]) rm=matrix(v)#This will be a row matrix cm=v.transpose()#This will be a column matrix. What would the convention be for this one? This came up in another discussion:

[sage-support] Re: Trying to find partitions of a pair of integers.

2008-12-14 Thread Mike Hansen
Hello, On Sun, Dec 14, 2008 at 4:04 PM, green351 mmamashra...@gmail.com wrote: Hi, This is my first time emailing with a question and my first time trying to use Sage (I'm a complete programming dunce). I'm trying to do the following: Given the tuple (p,q) in Z x Z and integer n I need to

[sage-support] Re: Error message on installing Sage

2008-12-14 Thread William Stein
On Sun, Dec 14, 2008 at 12:20 PM, Spencer spencercar...@gmail.com wrote: I'm running Sage 3.2.1 on Ubuntu 8.10 (hardware: Macbook 3,1 Santa Rosa with Intel Core 2 Duo). On installing Sage and starting it up for the first time I get the message: WARNING! This Sage install was built on a

[sage-support] Re: Trying to find partitions of a pair of integers.

2008-12-14 Thread Dan Drake
On Sun, 14 Dec 2008 at 05:09PM -0800, Mike Hansen wrote: On Sun, Dec 14, 2008 at 4:04 PM, green351 mmamashra...@gmail.com wrote: This is my first time emailing with a question and my first time trying to use Sage (I'm a complete programming dunce). I'm trying to do the following: Given

[sage-support] Re: help solving equations

2008-12-14 Thread William Stein
On Sun, Dec 14, 2008 at 10:53 PM, John H Palmieri jhpalmier...@gmail.com wrote: I have some code which generates a bunch of expressions of the form Sum (n_i a_i) where each n_i is an integer and each a_i is an unknown in a field, and I'm most interested in the case when the field is GF (p).

[sage-support] Re: Error message on installing Sage

2008-12-14 Thread mabshoff
On Dec 14, 7:30 pm, William Stein wst...@gmail.com wrote: On Sun, Dec 14, 2008 at 12:20 PM, Spencer spencercar...@gmail.com wrote: Hi, I'm running Sage 3.2.1 on Ubuntu 8.10 (hardware: Macbook 3,1 Santa Rosa with Intel Core 2 Duo). On installing Sage and starting it up for the first

[sage-support] Re: Error message on installing Sage

2008-12-14 Thread William Stein
On Sun, Dec 14, 2008 at 11:20 PM, mabshoff michael.absh...@mathematik.uni-dortmund.de wrote: On Dec 14, 7:30 pm, William Stein wst...@gmail.com wrote: On Sun, Dec 14, 2008 at 12:20 PM, Spencer spencercar...@gmail.com wrote: Hi, I'm running Sage 3.2.1 on Ubuntu 8.10 (hardware: Macbook