[sage-support] Re: Associated coroot depending on space

2011-05-13 Thread Jason Bandlow
I'm forwarding to the sage-combinat group, where the people who know
this code well have a better chance of seeing it.

On 05/12/2011 06:19 PM, Matthias wrote:
 Hi,
 
 i don't really know whether this is a bug, but at least it seems a bit
 odd to me (are alphacheck supposed to have different meanings in the
 spaces?):
 
 R = RootSystem(['A',3])
 wgtsp = R.weight_space()
 rootsp = R.root_space()
 
 a = wgtsp.simple_roots()[1]
 b = rootsp.simple_roots()[1]
 
 a.associated_coroot()
 4/5*alphacheck[1] - 2/5*alphacheck[2]
 b.associated_coroot()
 alphacheck[1]
 
 In general is there a way to specify a basis of a ?free module?
 (whatever is behind the spaces) and make sage express everything in
 this basis?
 
 Best regards
 Matthias
 


-- 
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: Ring Problem

2011-01-06 Thread Jason Bandlow
And two fewer than that...

sage: Zmod(5)
Ring of integers modulo 5

(Sorry, couldn't resist.)

On 01/04/2011 11:33 AM, Volker Braun wrote:
 You can even shave off two more key strokes and type:
 
 sage: ZZ.quo(5)
 Ring of integers modulo 5
 
 :-)
 
 -- 
 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: creating a test environment

2010-09-29 Thread Jason Bandlow
On 09/29/2010 01:47 PM, Johannes wrote:
 Hi list,
 is it possible to create in a given environment in sage a new one, which
 know all in the parent defined variables and values, and i i leave it
 again, ijust get back to my old values?

Is this what you're looking for?

http://www.sagemath.org/doc/tutorial/interactive_shell.html#section-save

Cheers,
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: Implication

2010-09-03 Thread Jason Bandlow
Hello,

For polynomial equations, the following should work in general.

sage: R.x,y = CC['x','y']
sage: f = x-y
sage: g = x^2 - y^2
sage: I = R.ideal([f]).radical()
sage: g in I
True

In general, to see if the equation g == 0 is implied by the equations
f1==0, f2==0, ..., fn==0 you can do

I = R.ideal([f1, f2, ..., fn]).radical()
g in I

and sage should appropriately return True or False.  I should mention
that I don't actually use this very much, so there may be some caveats
that I'm not aware of.

-Jason

On 09/03/2010 12:30 PM, tvn wrote:
 Hi, I wonder if there's any 'imply' kind of function in Sage  ?   For
 example
 
 eq1 = x -y == 0
 eq2 = x^2 - y^2 == 0
 
 eq1  implies eq2(but not the other way around).
 
 
 If no then is there any efficient way to do it ?one way I can
 think of (that might not work) is get the factor_list of eq1 and
 eq2  ,  if eq2 has a factor that is the same as eq1 then eq1 implies
 eq2-- something like that.
 


-- 
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: quickhand vector

2010-09-01 Thread Jason Bandlow
I'm not sure I completely understand your question, but maybe this
response will contain all the ingredients you need.

First, since you are working with polynomials, I suggest creating a
polynomial ring in the variables x and y, and then your polynomial f.

sage: R.x,y = QQ['x,y']
sage: f = 3*x^2 + 2*x*y - y^3

Now we can find specific coefficients and degrees as follows:

sage: f.coefficient({x:1, y:1})
2
sage: f.coefficient({x:2, y:0})
3
sage: f.degree(x)
2
sage: f.degree(y)
3

Now we can write a function that will give us a matrix entry if we pass
in i,j and f.

def matrix_entry(i,j,f):
return f.coefficient({x:i, y:j})

Now we can create a matrix as follows:

sage: M = matrix( [[ matrix_entry(i,j,f) for i in xrange(f.degree(x)+1)]
for j in xrange(f.degree(y)+1)])

sage: print M
[ 0  0  3]
[ 0  2  0]
[ 0  0  0]
[-1  0  0]

Notice that the indices (i,j) begin at 0.  Hope that helps.

Good luck,
Jason

On 09/01/2010 10:21 AM, andrew ewart wrote:
 i dont think my previous example was clear so ill try to do a new one
 that achieves the same result
 let F=f(x,y) where degx is the degree of F wrt x and degy is the degree
 of F wrt y
 G=f(t,z)
 got vector (G^0,G^1,G^2,...,G^degx)
 G=f(t,z)=(a_0,0+a_0,1*t+..+a_0,degx-1*t^(degx-1))+(a_1,0+...)*z+(...)*z^2+...+(...)z^d
 where d=2*degx*degy
 So want matrix of of dimension ((d+1)*degx)*((degy+1)*degx+(d+1)*degx),
 and of form
 (G^0...G^0|G^1...G^1||G^(degx-1)...G^(degx-1)|Idenity((d+1)*degx))
 where each term is like the form as descibed for G
 (F and G r given so thats not a problem)
 
 -- 
 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: quickhand vector

2010-08-31 Thread Jason Bandlow
Is this what you want?

sage: v = vector(2^i for i in xrange(1,10))
sage: print v
(2, 4, 8, 16, 32, 64, 128, 256, 512)

-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: numerical evaluation

2010-08-23 Thread Jason Bandlow
Hi,

On 08/23/2010 03:42 PM, robin hankin wrote:
 I tried this:
 
 roots = solve(x^3+10*x^2+11*x+8==0,x)
SNIP
 
 The best I can do is
 
 N(roots[1].rhs())
 
 but this is just one at a time.  How do I make N() operate on all of roots? 

You may like

for r in roots:
print N(r.rhs())

or

[N(r.rhs()) for r in roots]

Cheers,
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: Permutations with itertools.chain

2010-04-14 Thread Jason Bandlow
Hello,

I think this is normal.  Perhaps you meant the following (note the *
which expands the single argument into its components):

sage: for x in itertools.chain(*itertools.imap(Permutations,range(4))):
print x
[]
[1]
[1, 2]
[2, 1]
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]

Best,
Jason

William Laffin wrote:
 Hello helpful sage-support list!
 
 Is this the following normal behavior?
 
 sage: import itertools
 sage: for x in itertools.imap(Permutations,range(4)):
 .: for y in x:
 .: print y
 .:
 []
 [1]
 [1, 2]
 [2, 1]
 [1, 2, 3]
 [1, 3, 2]
 [2, 1, 3]
 [2, 3, 1]
 [3, 1, 2]
 [3, 2, 1]
 sage: for x in itertools.chain(itertools.imap(Permutations,range(4))):
 print x
 .:
 Standard permutations of 0
 Standard permutations of 1
 Standard permutations of 2
 Standard permutations of 3
 sage:
 
 thanks,
 William Laffin
 Michigan Tech
 

-- 
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 unsubscribe, reply using remove me as the subject.


[sage-support] Re: Inverses of Large Sparse Matrices

2010-04-09 Thread Jason Bandlow
Leo Maloney wrote:
 I'm trying to compute the inverse of a 5000 x 5000 sparse matrix.  I'm
 getting an EOF error after it runs for about 5 hours, and then it
 states that sage is trying to access unallocated memory.  Is there a
 way I can increase the memory for this computation?  Every time I
 Google it, all I can find is the benefits sage(plant) has on memory.
 Thanks,
 Leo
 

Have you tried converting to a dense matrix first?

sage: m = # whatever 5000x5000 sparse matrix you want
sage: n = ~(m.dense_matrix())

IIRC there are some methods on sparse matrices which are implemented in
completely naive ways.

-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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: Substitution

2010-01-21 Thread Jason Bandlow
Hi,

I think what Minh was trying to say is that these lines:

Stochastix wrote:
 sage: a=lambda x: alpha*x-mu1+mu2
 sage: f=lambda x: (a(x)*b-c+sqrt((a(x)*b-c)^2+4.0*a(x)*b*r*mu1))/(2*a
 (x)*mu1)
 sage: g=lambda x: (r+l-mu1*f(x))/mu2
 sage: prev=lambda x: f(x)/(f(x)+g(x))
 sage: k=lambda x: diff(prev(x),x)

should instead be written as

a = alpha*x-mu1+mu2
f = (a(x)*b-c+sqrt((a(x)*b-c)^2+4.0*a(x)*b*r*mu1))/(2*a(x)*mu1)
...

Or, if you prefer,

a(x) = alpha*x-mu1+mu2
f(x) = ...

etc.  When you define functions this way, they become elements of the
'SymbolicRing' which Sage has a lot of tools to deal with.  Defining
them with 'lambda' makes them pure Python functions, which are not as
flexible.

 sage: k(x).subs(x=0.03)
 0.0262047639227205
 
 
 By the way, there is something still puzzling me. The equivalent Maple
 code gives a value of .883.
 Who should I believe ?
 

If you fix the errors as above, do you still get different answers in
Maple and Sage?


Best,
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: Removing objects from lists; keeping original list unchanged?

2009-06-08 Thread Jason Bandlow

Alasdair wrote:
 This is more of a python question than a Sage question, but
 anyway...I'm trying to iterate over a list, producing a sequence of
 new lists, each of which is obtained from the original list by
 deleting one object.  I've tried:
 
 for x in lst:
lstc=copy(lst)
print lstc.remove(x)
 
 But this doesn't work - can anybody tell me what I'm doing wrong, and
 what I should be doing?  I can get the effect I want by iterating over
 the indices of the list, but I'd like to know why this little snippet
 of code doesn't work.

The problem is that

lstc.remove(x)

modifies lstc in place and doesn't return anything.  So you aren't
printing anything.  The following should do what you want:

for x in lst:
lstc = copy(lst)
lstc.remove(x)
print lstc

HTH,
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] sagenb appears to be down...

2009-05-25 Thread Jason Bandlow

...or is it just me?

TIA,
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: sagenb appears to be down...

2009-05-25 Thread Jason Bandlow

William Stein wrote:
 On Mon, May 25, 2009 at 4:58 PM, Jason Bandlow jband...@gmail.com wrote:
 ...or is it just me?

 
 it's indeed down.   I'll restart all the sagenb servers right now.
 They'll be back in 5 minutes.

Thanks!
-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: characters of the symmetric group

2009-05-13 Thread Jason Bandlow

David Joyner wrote:
 On Tue, May 12, 2009 at 6:43 PM, amps arat...@gmail.com wrote:
 I see that there is a function to compute the character table of the
 symmetric group, but is there one where you input two partitions and
 it outputs the value of the character indexed by the first partition
 evaluated at the second?  I have been searching for some time and
 can't find the answer.
 
 
 I don't know either and would be interested as well.
 Do you know how to do this in GAP?

One way is to use symmetric function theory:

sage: s = SFASchur(QQ); p = SFAPower(QQ)
sage: s(p([2,2])).coefficient([3,1])
-1

This says that the value of the irreducible character indexed by the
partition (3,1) is -1 when evaluated on a conjugacy class of size (2,2).

Cheers,
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: Strange behavior on sagenb

2009-03-28 Thread Jason Bandlow

William Stein wrote:
 On Thu, Mar 26, 2009 at 8:50 AM, Jason Bandlow jband...@gmail.com wrote:
 Hi all,

 When I start up a clean version of sage 3.4 on my local machine and
 enter the following into a notebook cell:

 M=load('http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.sobj')
 # This object is a dictionary
 key = (1, Partition([1]),Partition([2]))
 print key in M.keys()
 M[key]

 I get the following (correct) output:

 Attempting to load remote file:
 http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
 obj
 Loading: [..]
 True
 # A matrix that I won't reproduce here

 When I enter the exact same text in a notebook cell on sagenb, I get the
 following output:

 Attempting to load remote file:
 http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
 obj
 Loading: [..]
 True
 Traceback (most recent call last):
  File stdin, line 1, in module
  File
 /home/sage/sagenb/sage_notebook/worksheets/jbandlow/11/code/41.py,
 line 10, in module
M[key]
  File
 /home/sage/sage_install/sage-a/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/,
 line 1, in module

 KeyError: (1, [1], [2])

 Why am I getting a KeyError if key in M.keys() is returning True?  And
 why is the behavior on sagenb different than on my local, 3.4
 built-from-source on Ubuntu 10.8 distribution?

 Any ideas are very welcome!

 
 I'm guessing this is a subtle 32 versus 64-bit issue involving
 pickling and assumptions made somewhere in the combinat or other sage
 code involving 32/64-bit.  The notebook is 64-bit and I bet your
 computer is 32-bit.
 
 By the way, this works on the notebook in the context of your session above:
 
 for a, b in M.iteritems():
 if a == key: print b
 

Thanks William!  This does seem likely to be the problem.  I'll do more
investigation when I get a chance and see if I can find out precisely
where the problem is.


--~--~-~--~~~---~--~~
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] Strange behavior on sagenb

2009-03-26 Thread Jason Bandlow

Hi all,

When I start up a clean version of sage 3.4 on my local machine and
enter the following into a notebook cell:

M=load('http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.sobj')
# This object is a dictionary
key = (1, Partition([1]),Partition([2]))
print key in M.keys()
M[key]

I get the following (correct) output:

Attempting to load remote file:
http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
obj
Loading: [..]
True
# A matrix that I won't reproduce here

When I enter the exact same text in a notebook cell on sagenb, I get the
following output:

Attempting to load remote file:
http://www.math.upenn.edu/~jbandlow/sage_data/dic_of_kst_to_G_cob_mats.s\
obj
Loading: [..]
True
Traceback (most recent call last):
  File stdin, line 1, in module
  File
/home/sage/sagenb/sage_notebook/worksheets/jbandlow/11/code/41.py,
line 10, in module
M[key]
  File
/home/sage/sage_install/sage-a/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/,
line 1, in module

KeyError: (1, [1], [2])

Why am I getting a KeyError if key in M.keys() is returning True?  And
why is the behavior on sagenb different than on my local, 3.4
built-from-source on Ubuntu 10.8 distribution?

Any ideas are very welcome!

Cheers,
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] Coercion problem

2009-03-21 Thread Jason Bandlow

Hi all,

Is the following missing coercion known?  I couldn't find anything on
trac, but there's a lot there related to coercion, so I may have missed it.

sage: a = float(1.0)
sage: QQ(a)
TypeError: Unable to coerce 1.0 (type 'float') to Rational

Note that the following works:

sage: a = float(1.0)
sage: QQ(RR(a))
1

I'm happy to open a ticket if that's the right thing to do here.

Thanks,
Jason Bandlow


--~--~-~--~~~---~--~~
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] The preparser and nested loads

2009-03-21 Thread Jason Bandlow

Hi all,

I ran into the following unexpected behavior, which I assume is because
the preparser does not work with nested loads.  I have two files,
foo.sage and bar.sage.  Their contents are as follows:

foo.sage

def foo():
  return (-1)**(-1)


bar.sage

load foo.sage


The following sage session works as expected:
sage: load foo.sage
sage: type(foo())
type 'sage.rings.rational.Rational'

The following session does not:
sage: load bar.sage
sage: type(foo())
type 'float'

I'm guessing that in the second session the file foo.sage is not getting
preparsed (and so foo() returns a Python object and not a Sage object).
 Is this correct? If so, is there a way to force it to be preparsed?  I
like to have lots of little files with different functions, and then a
file which loads whichever of these happen to be working/relevant at the
moment.  That way I only have to load one file at the start of my session.

Any advice is much appreciated!

Thanks,
Jason Bandlow


--~--~-~--~~~---~--~~
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: Coercion problem

2009-03-21 Thread Jason Bandlow

Robert Bradshaw wrote:
 On Mar 21, 2009, at 9:06 AM, Jason Bandlow wrote:
 
 Hi all,

 Is the following missing coercion known?  I couldn't find anything on
 trac, but there's a lot there related to coercion, so I may have  
 missed it.

  sage: a = float(1.0)
  sage: QQ(a)
  TypeError: Unable to coerce 1.0 (type 'float') to Rational

 Note that the following works:

  sage: a = float(1.0)
  sage: QQ(RR(a))
  1

 I'm happy to open a ticket if that's the right thing to do here.
 
 Yes, this conversion is missing. It should be easy to implement.
 
 - Robert

This is now:   http://sagetrac.org/sage_trac/ticket/5582

Thanks,
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: How to store a result of one Sage program in a text file or other type of File?

2009-03-02 Thread Jason Bandlow

Raouf wrote:
 Hi,
 I want to store a result of one Sage program in a text file or other
 type of File, and i want know how  to use this result file  in another
 sage program.?
 
 Thank u.

Hi Raouf,

Does typing:

save?

from withing sage answer your question?  If not, can you be more
specific about what 'save' does that does not work for you?

Best,
Jason Bandlow


--~--~-~--~~~---~--~~
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: Simple Combinatorics and Probability

2008-12-09 Thread Jason Bandlow

Hi Matthew,

Matthew J wrote:
 Sage is great software that I rave about in pretty much all of my
 classes except for probability theory. I’d like to get some info on a
 few topics to clear some things up so that I can use these for classes
 and to post to an examples worksheet. Thanks in advance to anyone that
 replies.

 I am wondering how to do a few things.
 Is there a better (built-in) way to do simple combinations/
 permutations than writing a function like

 def choose(n,k): return factorial(n)/(factorial(k)*factorial((n-k)))
   
Entering: binomial(5,2)
will return: 10

Is this what you want? (This is much more efficient than the 'choose'
function you have above.)
 or equivalent for permutations?
   

I'm not sure exactly what you mean here. factorial(n) counts the number
of permutations of 'n' elements very efficiently.  Perhaps you mean

sage: permutations([1,2,2])   
[[1, 2, 2], [2, 1, 2], [2, 2, 1]]

Type permutations? for more information on this command.  You may also
be interested in the command 'combinations'.

 -

 Is there a way to get the Standard Normal CDF other than writing the
 function explicitly like below?

 def normalCDF(z):
 t = var('t')
 return N(integrate((1/sqrt(2*pi))*e^((-t^2)/2), t,  -infinity, z))
 -

 Also, are there any distributions built into sage? I don’t quite know
 what working with a distribution symbolically would be like, but as an
 example, perhaps being able to do something like
 X ~ BIN(n, p) and then get the expected value, variance, or PDF of X?
 Assume that n and p are given.
   

*Lots* of statistics is built into sage with the 'R' package.  I don't
know it well, but you can try typing R? inside sage and see what you can
work out from there.

Cheers,
Jason

 Thanks,
 -Matthew J
 

   


--~--~-~--~~~---~--~~
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] manipulating dictionaries (bug?)

2008-11-04 Thread Jason Bandlow

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Stan,

I think I saw one question you asked that hasn't been answered yet:

Stan Schymanski wrote:

snip

 If I construct a list out of two other lists, I usually don't
 expect the original lists to change if I manipulate the resulting
 list. How can I break such links?
snip

The way I usually do this is:
sage: L = [1, 2, 3]
sage: LL = L[:]

This makes LL a copy of L instead of reference to it.  As such, I can
manipulate the two completely independently.

Best,
Jason
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJEM7b8gPPTTURhZkRApk4AJ9672d9EekPoCdG7Z0qh/LLsPYXSwCfd1Ga
652K4qgYDuKgabqmz6keAYk=
=Y3HM
-END PGP SIGNATURE-


--~--~-~--~~~---~--~~
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] Bug in plot?

2008-09-26 Thread Jason Bandlow

Hi all,

A student of mine noticed the following and it looks like a bug to me
(at least with the documentation).

From the notebook with 3.1.2 (sage prompts added for readability):

sage: plot?

File:
/home/jason/sage/local/lib/python2.5/site-packages/sage/plot/plot.py
Type:type 'function'
Definition:  plot(funcs, *args, **kwds)
Docstring: 

Use plot by writing 

plot(X, ...)

where X is a SAGE object (or list of SAGE objects) that either is
callable and returns numbers that can be coerced to floats, or has
a plot method that returns a GraphicPrimitive object.

Type plot.options for a dictionary of the default
options for plots.  You can change this to change
the defaults for all future plots.  Use plot.reset()
to reset to the default options.

SNIP

sage: plot.options

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/jason/.sage/sage_notebook/worksheets/admin/32/code/44.py, line 
6, in module
plot.options
  File 
/home/jason/sage/local/lib/python2.5/site-packages/zope.interface-3.3.0-py2.5-linux-i686.egg/,
 line 1, in module

AttributeError: 'function' object has no attribute 'options'


sage: plot.reset() 

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/jason/.sage/sage_notebook/worksheets/admin/32/code/46.py, line 
6, in module
plot.reset()
  File 
/home/jason/sage/local/lib/python2.5/site-packages/zope.interface-3.3.0-py2.5-linux-i686.egg/,
 line 1, in module

AttributeError: 'function' object has no attribute 'reset'


Cheers,
Jason


--~--~-~--~~~---~--~~
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] Maxima problems in sage 3.1.1

2008-09-15 Thread Jason Bandlow

Thanks Michael,
 Check your home
 directory for any file with an accent or Umlaut and you likely found
 the culprit you need to rename. 
This fixed the problem.  Good luck with ecls.

Cheers,
Jason



mabshoff wrote:

 On Sep 15, 6:34 pm, Jason Bandlow [EMAIL PROTECTED] wrote:
   
 Hello,

 I've been happily '$ sage -updgrade'ing since sage 2.10 or so, and
 recently noticed that I couldn't use Maxima (details below).  I'm not
 sure for how long I've had this problem.   Knowing the disclaimer that
 applies to upgrading, I downloaded the linux 32-bit binaries for 3.1.1
 from sagemath.org and still had the same problem.   I'm running Ubuntu
 Hardy on an AMD laptop.

 If I try any command that calls Maxima, I have to wait for a timeout,
 and then get an error.   Specific system information and a traceback are
 below.

 Thanks very much for any help,
 Jason Bandlow

 

 SNIP

 Hi Jason,

   
 *** - invalid byte #xFD in CHARSET:UTF-8 conversion, not a Unicode-16
 

 this is #2841 and clisp riding on the short bus. Check your home
 directory for any file with an accent or Umlaut and you likely found
 the culprit you need to rename. This has been open on the clisp end
 forever and has never been fixed. That is why we are moving to ecls,
 hopefully in the 3.1.3 release cycle.


 Cheers,

 Michael
 

   


--~--~-~--~~~---~--~~
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] Doctest question

2008-04-15 Thread Jason Bandlow

Hello all,

Regarding doctesting, I'd like to work with the following setup:
1. Create a file work.sage (or work.py) somewhere in my home directory.
2. Start a notebook session, and attach work.sage.
3. Use the notebook for generating and staring at data, while using a 
text editor to modify my code.
4. Periodically run: $ sage -t work.sage  to make sure that I 
haven't completely fouled things up.

Step 4 seems not to work (on Sage 2.11 on Ubuntu).  For example,
I created the following file, foo.py, in my ~/.sage directory:

def foo(x):
r
Shows how doctests don't work.

EXAMPLES:
sage: 2+2
5
sage: foo(3)
4

print(x)

And then
$ sage -t --verbose ~/.sage/foo.py

--
All tests passed!
Total time for all tests: 0.0 seconds

$ sage -coverage ~/.sage/foo.py
--
foo.py
SCORE foo.py: 100% (1 of 1)
--


Can someone explain to me what's going on here?

Thanks,
Jason


--~--~-~--~~~---~--~~
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: Doctest question

2008-04-15 Thread Jason Bandlow

William Stein wrote:
 On Tue, Apr 15, 2008 at 9:11 AM, Jason Bandlow [EMAIL PROTECTED] wrote:
   
  Hello all,

  Regarding doctesting, I'd like to work with the following setup:
  1. Create a file work.sage (or work.py) somewhere in my home directory.
  2. Start a notebook session, and attach work.sage.
  3. Use the notebook for generating and staring at data, while using a
  text editor to modify my code.
  4. Periodically run: $ sage -t work.sage  to make sure that I
  haven't completely fouled things up.

  Step 4 seems not to work (on Sage 2.11 on Ubuntu).  For example,
  I created the following file, foo.py, in my ~/.sage directory:
 

 As a workaround do not put foo.py in .sage; put it in *any*
 other directory that does not start with a dot.   Then everything
 should work fine.

  -- William

   
Thanks!  That seems to work.  However the following is an annoyance:

If the file has extension .sage, sage -t works great, but sage 
-coverage does nothing.  If the file has extension .py, sage -coverage 
works well, but sage -t fails to find the methods in the file  (an 
example is below).   This isn't a big deal for me, since I tend to work 
with .sage files and I can find the coverage by hand, but it still seems 
worth mentioning.
Example:

[EMAIL PROTECTED]:~$ more good.sage
def foo(x):
r
Shows how doctests don't work.

EXAMPLES:
sage: foo(3)
3

print x
[EMAIL PROTECTED]:~$ sage -t good.sage
sage -t  good.sage 
Example 0 (line 5)
 [2.6 s]
 
--
All tests passed!
Total time for all tests: 2.6 seconds
[EMAIL PROTECTED]:~$ cp good.sage good.py
[EMAIL PROTECTED]:~$ sage -t good.py
sage -t  good.py
**
File good.py, line 6:
sage: foo(3)
Exception raised:
Traceback (most recent call last):
  File /home/jason/sage/local/lib/python2.5/doctest.py, line 1212, 
in __run
compileflags, 1) in test.globs
  File doctest __main__.example_0[0], line 1, in module
foo(Integer(3))###line 6:
sage: foo(3)
NameError: name 'foo' is not defined
**
1 items had failures:
   1 of   1 in __main__.example_0
***Test Failed*** 1 failures.
For whitespace errors, see the file .doctest_good.py
 [1.7 s]
exit code: 1024
 
--
The following tests failed:


sage -t  good.py
Total time for all tests: 1.7 seconds




Cheers,
Jason





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