Re: [sage-support] Reduce all coefficients of multivariate polynomial to 1

2016-12-02 Thread D. S. McNeil
In Python generally, "X = Y" doesn't modify the *object* which is named X, it just rebinds the name, saying that "X" now refers to the object given by the expression Y. So in general, for something in someloop: something = something_else isn't going to do much. (I want to say "nothing"

Re: [sage-support] Weird comprehension behavior.

2016-05-09 Thread D. S. McNeil
Not scoping, typing. When you do i+1, this is preparsed into sage: preparse('[len(top_points(i+1)) for i in range(2,10)]') '[len(top_points(i+Integer(1))) for i in range(Integer(2),Integer(10))]' and the addition means that top_points is passed not a Python int, but a Sage Integer, and your

Re: [sage-support] Plotting a q analogue function as a challenge?

2015-08-13 Thread D. S. McNeil
While qgamma isn't a native function, there's a qgamma implementation in mpmath, one of the libraries included in Sage, so: from mpmath import qgamma plot(lambda x: qgamma(4,x), (x, 2, 10)) should give you a plot of gamma_(q=4). Doug -- You received this message because you are subscribed to

Re: [sage-support] Random sum of functions

2013-07-17 Thread D. S. McNeil
I don't think you need to make an explicit class here. You can build a function from within another function, and return that: sage: def f(n, z): : return z**n : sage: def maker(tup): : def g(z): : return sum(abs(f(a_i,z))**2 for a_i in tup) : return g

Re: [sage-support] Evaluating a symbolic expression

2012-11-03 Thread D. S. McNeil
I mean, I can of course do f(P1[0],P1[1],P1[2]), but this is highly non-elegant. You can use an asterisk: sage: f(x,y,z) = x+10*y+100*z sage: P1 = [2,3,4] sage: f(*P1) 432 Here, * behaves kind of like a dereferencing operator: f(*(x,y,z)) == f(x,y,z). See this StackOverflow question for a

Re: [sage-support] SEGV in mpmath.findroot

2012-10-01 Thread D. S. McNeil
Hmm. My backtrace showed: /home/mcneil/sagedev/sage-5.4.beta0/local/lib/libcsage.so(print_backtrace+0x3b)[0xb6bd7c49] /home/mcneil/sagedev/sage-5.4.beta0/local/lib/libcsage.so(sigdie+0x17)[0xb6bd7c89]

Re: [sage-support] randint - Maybe one bug !

2012-09-19 Thread D. S. McNeil
On Wed, Sep 19, 2012 at 12:42 PM, Christophe BAL projet...@gmail.com wrote: What I think very confusing is that 1/4 is the Sage division and not the Python standard one, so why it would be different for randint ? It's not Sage division vs. Python division, it's Sage Integers vs. Python ints.

Re: [sage-support] Re: Using find_fit() on lambert_w()

2012-09-07 Thread D. S. McNeil
Somewhere along the path the second argument to scipy.special.lambertw (0) is being converted to a float: import scipy.special scipy.special.lambertw built-in function lambertw scipy.special.lambertw(1, 0) (0.56714329040978384+0j) scipy.special.lambertw(float(1), 0) (0.56714329040978384+0j)

Re: [sage-support] Out of memory error when dividing vector by scalar

2012-07-26 Thread D. S. McNeil
After some digging -- and a fortuitous control-C at the right moment -- it looks like it's trying to construct the basis for the ambient free module. This will be a list of 10^4 vectors, each 10^4 elements long, so it's not surprising it takes a lot of memory.. adding a print statement in the

Re: [sage-support] slow symbolic computation

2012-06-22 Thread D. S. McNeil
On Fri, Jun 22, 2012 at 7:19 AM, David Harvey d.har...@unsw.edu.au wrote: -- | Sage Version 5.0, Release Date: 2012-05-14                         | | Type notebook() for the GUI, and license() for information.        |

Re: [sage-support] Divisor Riemann Roch

2012-06-18 Thread D. S. McNeil
AttributeError: 'ProjectiveCurve_finite_field' object has no attribute 'riemann_roch_basis' why?? help please! If I understand correctly, as the documentation says: Currently this only works over prime field and divisors supported on rational points. Your F is GF(4), which isn't a prime

Re: [sage-support] gauss_sum() core dump

2012-06-01 Thread D. S. McNeil
On Fri, Jun 1, 2012 at 10:59 AM, Jeroen Demeyer jdeme...@cage.ugent.be wrote: Looks like an infinite recursion, leading to stack exhaustion, leading to a SIGSEGV: I agree with the last two but not the first. I think it's just a really long LazyBinop chain, which is why I was having trouble

Re: [sage-support] gauss_sum() core dump

2012-05-31 Thread D. S. McNeil
I can push this back at least to number_field_morphisms.create_embedding_from_approx: the segfault seems to happen during the evaluation of the defining polynomial of the cyclotomic field. For my 5.0, sage: CyclotomicField(160400) [...] /Applications/sage/spkg/bin/sage: line 312:

Re: [sage-support] using a base other then base 10.

2012-05-18 Thread D. S. McNeil
The following: sage: z = pi.n(100) sage: z.str(base=4) '3.0210033310202011220300203103010301212022023200' should get you started. Doug -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

Re: [sage-support] Re: Sage 5.0 crashing, is unusable

2012-05-17 Thread D. S. McNeil
For future reference, run `md5sum filename` in a terminal to check the MD5 sum of a file. I'm pretty sure it's md5, not md5sum, on OS X (at least in 10.6). Doug -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

Re: [sage-support] Sage 5.0 crashing, is unusable

2012-05-16 Thread D. S. McNeil
I can reproduce this on my 10.6.8 macbook: sage: int(2) 2 sage: int(2.75) Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand. 0x000101723ed9 in case1 () (gdb) bt #0 0x000101723ed9 in case1 () #1 0x000103e8bba4 in parsed_string_to_mpfr () #2 0x000103e8c7fb

Re: [sage-support] Re: Sage 5.0 crashing, is unusable

2012-05-16 Thread D. S. McNeil
Doug, are you using the binary or did you compile your Sage? Deliberately the binary; I've never had problems with a Sage I've successfully compiled myself. [Haven't compiled 5.0 myself yet on the Mac, though I did at work today on ubuntu 12.04 and it went fine. Will probably try overnight.]

Re: [sage-support] Re: Sage 5.0 crashing, is unusable

2012-05-16 Thread D. S. McNeil
I was able to find a case which crashed but doesn't have to crash Sage. Doesn't tell us much new, but here it is anyway: sage: 12345678912345678912345678912345678901234567890. --- RuntimeError

Re: [sage-notebook] Re: [sage-support] Re: Exporting data from sage notebook

2012-03-25 Thread D. S. McNeil
I think you should close that.  The following works fine in the notebook.   It makes no sense to close the file -- instead, you have to delete the csv writer object, which flushes it to the file. This isn't guaranteed to flush it to the file, though, because del only deletes the name. That it

Re: [sage-support] Bug in edge_cut of undirected weighted graphs

2012-03-24 Thread D. S. McNeil
I think I have a smaller example: sage: G = Graph([(0, 3, 1), (0, 4, 1), (1, 2, 1), (2, 3, 1), (2, 4, 1)]) sage: G.edge_cut(0,1,value_only=False,use_edge_labels=True) [1, [(0, 3, 1), (1, 2, 1), (2, 3, 1)]] sage: G.edge_cut(0,1,value_only=False,use_edge_labels=True,method='LP') (1.0, [(1, 2)])

Re: [sage-support] About the solve function

2012-03-09 Thread D. S. McNeil
You're probably getting a list of dictionaries: sage: var(x y) (x, y) sage: sols = solve([x^2-4==0, y^2-9==0], x, y, solution_dict=True) sage: sols [{y: -3, x: -2}, {y: -3, x: 2}, {y: 3, x: -2}, {y: 3, x: 2}] This is just like any other list -- the fact the elements happen to be dictionaries

Re: [sage-support] Legend label problem

2012-03-09 Thread D. S. McNeil
This seems to work on test.sagenb.org (5.0.beta1) and the 5.0.beta4 I have around, so something (whether Sage-side or matplotlib-side) must have changed for the better from 4.8. Is it time-sensitive enough to track it down and make a backpatch? Doug -- To post to this group, send email to

Re: [sage-support] Question about plot

2012-02-23 Thread D. S. McNeil
I am a two-tuple vector, vet=[(1,2),(3,4),(5,6),..], i want plot this data with a line aproximation, (interpolation this points), exist any parameter in list_plot function for this. Maybe line(vet) does what you want? You can look at

Re: [sage-support] gcd's of numbers mod N

2012-02-19 Thread D. S. McNeil
sage seems to think that the gcd of 6 and (-2 mod 6) is -2 mod 6, which it converts to 4.  A mathematician would say that the gcd is 2. Is this a bug, or does sage have a higher purpose here? Sage is actually reasoning slightly differently, I think. First it decides whether there's a

Re: [sage-support] Re: speed question, numpy vs CDF

2012-02-13 Thread D. S. McNeil
Anyone using numpy from Sage should beware of the following: sage: import numpy sage: m = numpy.matrix([[1,2],[3,4]]) sage: m[:,0] matrix([[1, 3]]) sage: m[:,int(0)] matrix([[1], [3]]) That is, if you use a Sage integer to index a numpy matrix, you don't get the expected shape back. I

Re: [sage-support] sum() - TypeError: cannot evaluate symbolic expression numerically

2012-02-12 Thread D. S. McNeil
On Sun, Feb 12, 2012 at 2:13 PM, mrkvon michal.sala...@gmail.com wrote: Hello, what is wrong with this, please? I tried to sum some matrix elements and got error below. I tried to sum by other means (comment # and ## in example below) without problem. I even defined my own summation function

Re: [sage-support] finding a p-cycle of a real function

2012-02-11 Thread D. S. McNeil
Warning: I haven't thought this through, but the ideas might be useful. It looks like you'd call something a 3-cycle if for some x_0 we had f(f(f(x_0))) == x_0, right? Then we should be able to do this numerically, with some caveats: # can't remember the slick way, so brute force def

Re: [sage-support] Numerical approximation of symbolic coefficients

2012-02-05 Thread D. S. McNeil
First attempt: loop through each term and try to n() the coefficient. Madness. Based on a suggestion Mike Hansen once gave me -- http://ask.sagemath.org/question/411/substituting-expressions-for-numbers -- I tend to use subclasses of Converter when I need to do something like this, so as not to

Re: [sage-support] issue with combining sub lists into a list

2012-01-09 Thread D. S. McNeil
[[1],[2,8,4,6],[1,2,7],[9,3,4,6],...] [[1],[14,17,18,19],[1,4,11],[9,14,16,19],...] would like to figure out how to get both results like this: [1,2,8,4,6,1,2,7,9,3,4,6,...] [1,14,17,18,19,1,4,11,9,14,16,19...] Two ways come to mind: sage: a = [[1],[2,3,4],[5,6,7]] sage: a [[1], [2, 3,

Re: [sage-support] Re: help with filtering between two lists.

2012-01-02 Thread D. S. McNeil
Most of the time, filtering jobs like this can be accomplished by one- liners using the right list combination and iteration tools: [c for c in enumerate(zip(l1,l2)) if c[1][0] ==c[1][1]] You can even avoid the [1][0] stuff by using some nifty unpacking: [(c,ai) for c, (ai,bi) in

Re: [sage-support] Plotting weighted graph

2011-12-09 Thread D. S. McNeil
Hi all, I'm confused why this code results in a graph plotted with the (single) edges labeled with the weight between each pair of vertices: M = Matrix([[0,1,-1,5],[1,0,-1/2,-1],[-1,-1/2,0,2],[5,-1,2,0]]) G = Graph(M,sparse=True) G.plot(edge_labels=True) Whereas this code does not and

Re: [sage-support] sagenb down

2011-12-05 Thread D. S. McNeil
test.sagenb.org seems to be up, so if she has a saved local copy of a worksheet, she could use that.. Doug -- 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

Re: [sage-support] matrix help

2011-12-02 Thread D. S. McNeil
def U(N,M):    U=matrix(ZZ,N*M)    for i in range(N*M):        for j in range(N*M):            U[i,j]=1    return U def Q(N,M):    Q=matrix(ZZ,N*M)    for i in range(N*M):        for j in range(N*M):            Q[i,j]=U(N,M)    return Q U(N,M) is a function which returns a matrix.

Re: [sage-support] Why this difference with mpmath numerical differentiation?

2011-12-01 Thread D. S. McNeil
Normally I can differentiate analytically to get the slope and inflection points. While trying to have a quick look into these points with numerical differentiation I noticed that mpmath is giving me values quite distant from the ones obtained with analytical formulas. I think there's a

Re: [sage-support] Hole in algorhitm

2011-11-28 Thread D. S. McNeil
:-/ That's definitely a bug. The precision used in integral_points_with_bounded_mw_coeffs (100 bits) is too small to find that solution. Even bumping the precision to 120 bits suffices, although that's probably the wrong approach: [(436 : 559 : 1), (450 : 2925 : 1), (666 : 14589 : 1), (900 :

Re: [sage-support] 'unable to simplify to float approximation' error in Logistic equation

2011-11-16 Thread D. S. McNeil
The problem is that the solution that desolve returns: sage: myode = tau*diff(p,t) == p*(1-p/k) sage: sol(t) = desolve(de=myode, ivar=t, dvar=p) sage returns:  -tau*log(-k + p(t)) + tau*log(p(t)) == c + t isn't in an easy enough form for plot to display. You're setting sol(t) not to an

Re: [sage-support] Re: Error on variables used by find_fit

2011-11-15 Thread D. S. McNeil
You're assuming that the fit function is going to return the variables in the same order in both cases, so that (e.g.) a and k1 will be the first in both cases. That's not true, though. I found: [a == 3.4102956225507519, b == 0.010344876276231638, c == -0.00094076216744204172, d ==

Re: [sage-support] Re: ValueError when using np.random.seed()

2011-10-26 Thread D. S. McNeil
thread hijack but not really Most likely, the problem here is that numpy doesn't recognize Sage Integer objects as being convertable to python integers.  I think this is a failing of numpy (it should check the __index__ method to see if it can convert the Integer to a python integer).

Re: [sage-support] Letter to Number mapping

2011-10-25 Thread D. S. McNeil
Do you know about Python dictionaries? http://docs.python.org/tutorial/datastructures.html#dictionaries They're a kind of general map along the lines that you want, and you can build them in many ways. For example: import string m = dict((c, ord(c.lower())-ord('a')+17) for c in

Re: [sage-support] Re: Bessel Contour Plot problem

2011-10-21 Thread D. S. McNeil
Hi! I'm not sure what you mean by Also if I have the terms, and return on separate lines in the definition then I get this error. You _have_ to have the different statements on separate lines, like I did. (Unless you use a semicolon to separate the statements, I suppose.) Did you combine

Re: [sage-support] Re: Bessel Contour Plot problem

2011-10-20 Thread D. S. McNeil
def f(y,t): return (1+(bessel_J(0, gro)/bessel_J(2, gro)))*(r/ kro)*(bessel_J(1, r)/bessel_J(1,gro))*z.cos()-(bessel_J(0,r)/ bessel_J(2, gro))*(r**2/kro**2) if t != 0 else infinity A few things: (1) Your arguments to this function are y and t, but inside you use r and z. r and z are still

Re: [sage-support] Bessel Contour Plot problem

2011-10-17 Thread D. S. McNeil
Sage: y,t = var('y,t') Sage: contour_plot(lambda y,t: (sqrt(t^2+y^2)/(2*pi*y))*(bessel_J(0, t ).arccos()), (t, 0, 3), (y, 0, 4), fill = false, axes_labels=['$gro $','$kro$'], contours = [0.1, 0.2, 0.3, 0.5, 0.7, 1.0, 2.0, 4.0], fill=False, legend_label='qwall'); This is the error message

Re: [sage-support] Question about legend place in plot

2011-10-10 Thread D. S. McNeil
I want that legend is in left side, ... how? Try something like: p = plot(sin,legend_label=sin) p.set_legend_options(loc='upper left') p.show() After making some plot p, you can type help(p.set_legend_options) to see more information about the various things you can configure. Doug -- To

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-28 Thread D. S. McNeil
This is definitely not a bug.   The definition of the _add_ method absolutely demands that both inputs have exactly the same parent.  In the above instance, the left hand input (=1) has parent ZZ, and the right hand input (=SR(2)) has parent the symbolic ring. Yeah, I know that-- it's the

Re: [sage-support] Question about Patterson Algorithm Implementation

2011-09-27 Thread D. S. McNeil
I don't think you should need to call _add_, but this looks like a bug to me: -- | Sage Version 4.7.1, Release Date: 2011-08-11 | | Type notebook() for the GUI, and license() for information.|

Re: [sage-support] Re: error: C preprocessor /lib/cpp fails sanity check (installing sage-4.7.1 from source)

2011-09-25 Thread D. S. McNeil
The shortest way to test it my above interpretation of your logs is indeed correct is by seeing if excecuting: echo #include limits.h | cpp gives any errors. If so my interpretation is correct. And if it is, which seems likely, there's probably a kernel headers package missing. Googling

Re: [sage-support] Chinese Remainder Theorem

2011-09-22 Thread D. S. McNeil
On Fri, Sep 23, 2011 at 12:39 AM, Santanu Sarkar sarkar.santanu@gmail.com wrote: I want to find integer such that x= 1 mod 3 x=2  mod 5 x=3  mod 7 like this system of congruences using Chinese Remainder Theorem. In Sage, crt() function takes only 4 argument. sage: help(CRT) crt(a, b,

Re: [sage-support] How to write Sage code to cython code

2011-09-17 Thread D. S. McNeil
It always returns 101, not a random prime of 100 bit integer. That's because in Python/Cython, the carat ^ isn't exponentiation, it's bitwise xor. The most general solution is to use **: Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on

Re: [sage-support] Obtaining Size of a List and of elements of a List

2011-09-02 Thread D. S. McNeil
In your code, ComSet is a Python list (not a set) as are many of its components, and you use len(x) to get the size: sage: ComSet, type(ComSet), len(ComSet) ([[[0, 1], [0, 2], [1, 2]], [[0, 1, 2]], [[0, 1], [0, 2], [1, 2]]], type 'list', 3) sage: ComSet[0], type(ComSet[0]), len(ComSet[0]) ([[0,

Re: [sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread D. S. McNeil
Thanks for this.  There still seems to be a manual step in going from, say, s1 = 2*(1,8) - (1,9) to  s1 = 2*b[1] - b[2] I may be misunderstanding you. Are you saying you want to enter the line s1 = 2*(1,8)-(1,9) verbatim and have it work? That I don't think I can do (unless you're

Re: [sage-support] Re: Sums of Modular Symbols

2011-08-01 Thread D. S. McNeil
.. I suppose you could even add a convenience function def b(*x): return m[x] after which sage: s = [2*b(1,8) - b(1,9), : -b(1,0) + b(1,9), : -b(1,0) + b(1,8)] sage: s [2*(1,8) - (1,9), -(1,0) + (1,9), -(1,0) + (1,8)] would work. Doug -- To post to this group, send

Re: [sage-support] Sums of Modular Symbols

2011-07-31 Thread D. S. McNeil
We would like to know if certain sums of modular symbols span the space. Is this the sort of thing you had in mind? sage: M=ModularSymbols(11,2);M Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field sage: b = M.basis() sage: sage: s1 = 2*b[1] - b[2]

Re: [sage-support] Nearest Integer

2011-07-14 Thread D. S. McNeil
How to find the nearest integer (+ve or -ve) of a rational number (P/Q) where P,Q are very large integers? You could use the .round method of rationals. sage: q = 17+1/2+1/11**1000 sage: RR(q.numerator()), RR(q.denominator()) (2.48685403212345e10413928, 1.42105944692768e10413927) sage:

Re: [sage-support] polynomials over QQ

2011-07-03 Thread D. S. McNeil
My understanding was that 'x' was the indeterminate of the ring of polynomials over QQ, i.e. the rationals.  So how come the polynomial has coefficients which are not rational? Because the polynomial isn't living where you think it does anymore: sage: R.x = QQ['x'] sage: R Univariate

Re: [sage-support] Re: ValueError: setting an array element with a sequence. when plotting R data

2011-06-08 Thread D. S. McNeil
Thus I wonder why this doesn't work def f(x): return r.dnorm(x,mean=100,sd=25)._sage_() plot(f(x)(x,90,110)) while def f(x): return x^3 plot(f(x),(x,0,2)) works perfectly. The problem is that the f(x) calls f with the symbolic argument x _at the time you call the plot function_. In

Re: [sage-support] How can I tell if an algebraic number is rational?

2011-06-01 Thread D. S. McNeil
PolynomialRing(ZZ, 'x') This is only an aside, but I should probably warn that (unlike var, say) this doesn't change x, so it might not do what you're thinking. x is still an Expression, an element of the Symbolic Ring, and so f is also an Expression. You probably want to use something like

Re: [sage-support] weird inequality bug...

2011-05-31 Thread D. S. McNeil
The key here is understanding exactly what x[0] is: it's not a rational. If you run your code (after adding the line set_random_seed(3) at the start to make sure we're working with the same matrices), you see: sage: minx, maxx, miny, maxy (+Infinity, (3), +Infinity, (21/5)) and the odd

Re: [sage-support] Legend Options in 2D Plots? Title Options in 3D plots?

2011-05-25 Thread D. S. McNeil
1 - On 2D plots, I have been unable to use the legend() attribute and the set_legend_options() attribute. I don't think you have those methods. I think you're using an old version of sage (maybe = 4.5.2?) but reading documentation from a later version, which occasionally causes trouble. What

Re: [sage-support] Re: How to evaluate an expression numerically

2011-05-15 Thread D. S. McNeil
time[0].right().n() Not sure why time.rhs() doesn't work... That I can explain. time is a list (well, technically a Sequence) of equations, and so you'd need to type time[0].rhs(). The individual equations have right hand sides, but the list itself doesn't. FWIW, I prefer using dicts rather

Re: [sage-support] Straightforward calculation going wrong?

2011-05-02 Thread D. S. McNeil
The range function is a Python one, and it returns Python ints. Python ints have truncating division, so that 3/2 = 1, not 3/2. When you type 3/2 at the Sage command, it's preparsed to be Sage Integers: sage: 3/2 3/2 sage: preparse(3/2) 'Integer(3)/Integer(2)' sage: int(3)/int(2) 1 sage: 3r/2r 1

Re: [sage-support]

2011-04-23 Thread D. S. McNeil
Emailing this instead of newpost because of the attachment. This worksheet works well ONCE when it starts unevaluated. Reediting the data followed by ActionEvaluate all induces TypeError: 'str' object is not callable. My way out is to Delete output save and quit and reopen. But I do not

Re: [sage-support] Re: memory error

2011-04-16 Thread D. S. McNeil
TypeError: list indices must be integers, not FiniteField_ext_pariElement I see this problem on Mac OS X, so it's not specific to one type of system.   It may be due to a change in the way finite fields are handled as the size grows, but I'm not familiar with that code. Can anyone hazard

Re: [sage-support] numpy divide by zero warnings are annoying

2011-04-15 Thread D. S. McNeil
I'm not turning off warnings in numpy, though, since we use it under the hood only here. I'm confused. I was going to recommend numpy.seterr(all='ignore') before I read this, maybe wrapping plot to restore the original state after the call.. but now I'm not sure what kind of solution you

Re: [sage-support] Using scipy special functions

2011-04-10 Thread D. S. McNeil
I'm completely unable to get the scipy special functions module to work. In addition, it seems to cause chaos on my system once imported sage: import scipy sage: from scipy.special import * sage: scipy.special.lpn(1,1) I'd avoid your second line in Sage, which pulls everything in

Re: [sage-support] Qhull package installation fail

2011-04-06 Thread D. S. McNeil
I tried installing the Qhull package which is an optional package on the list at http://www.sagemath.org/packages/optional/, but i got the error below.  It appears that /usr/include/float.h can't be found, but i *do* have that file. I'm not sure whether this is a Sage-related issue. Could be

Re: [sage-support] edge labels in trees

2011-04-06 Thread D. S. McNeil
I want to show a tree  with edge labels. I tried out G1 = Graph({1:{5:0},2:{5:1},3:{6:1},4:{7:0},5:{6:0},6:{7:1}}) show(G1,edge_labels=true) show(G1,layout=tree,edge_labels=true) In the first graphic the labels are positioned on the edges but in the second one they are not. Why is this?

Re: [sage-support] timing out a function or command

2011-04-05 Thread D. S. McNeil
On Tue, Apr 5, 2011 at 1:47 PM, tvn nguyenthanh...@gmail.com wrote: Is there a timeout mechanism in Sage or Python that allows me to kill or raise an exception on a command that exceeds some time threshold ? You probably want alarm, which raises a KeyboardInterrupt. Doug -- Department of

Re: [sage-support] using random seed for sample() function

2011-03-28 Thread D. S. McNeil
On Tue, Mar 29, 2011 at 4:00 AM, tvn nguyenthanh...@gmail.com wrote: I'd like to be able to regenerate  samples by feeding a seed value to random.seed()  ,  but it seems sample() doesn't use this random seed.  Is there a way to do what I want ? help(sage.misc.randstate) explains a lot of the

Re: [sage-support] Units Package Simplification in Exponentiation/Powers

2011-03-22 Thread D. S. McNeil
sage: (a^3)^(1/3) 5*(meter^3)^(1/3) does not produce the expected units of meter.  Is there a means to force further simplification? You could try sage: m = units.length.meter sage: assume(m 0) sage: (5*m)^3 125*meter^3 sage: ((5*m)^3)^(1/3) 5*(meter^3)^(1/3) sage:

Re: [sage-support] Additionnal constraints are never enough

2011-03-07 Thread D. S. McNeil
integrate(integrate(1/16,y,-2,(z+2*x+4)/(x+2)),x,(-z-8)/4,2) Seems to work for me: -- | Sage Version 4.6.1, Release Date: 2011-01-11 | | Type notebook() for the GUI, and license() for information.|

Re: [sage-support] Re: Additionnal constraints are never enough

2011-03-07 Thread D. S. McNeil
But, after a reset() command, it does not work anymore. Confirmed. Well, that ain't proper. Could you try reset(); forget(); instead of reset()? Right now assumptions survive a reset in a broken state (try assumptions() before and after the reset and you'll see them still listed even if the

Re: [sage-support] Re: modifying a plot after creation

2011-03-04 Thread D. S. McNeil
Note that you need to use randomize=False in plot if you're doing this, because otherwise the plot positions are different each time (!), so caching the function is useless.  I don't understand the motivation for having that be the default behaviour. Better than having a set algorithm that

Re: [sage-support] sage upgrade on MacOs, Japanese envirinment.

2011-03-02 Thread D. S. McNeil
On Wed, Mar 2, 2011 at 4:55 PM, Thierry Dumont tdum...@math.univ-lyon1.fr wrote: One of my colleagues uses a Macintosh with a Japanese environment. He cannot upgrade sage (4.6.1).Here is a transcription of what happens. Any idea? I used to hit this problem myself (not with Sage, but with other

Re: [sage-support] sage upgrade on MacOs, Japanese envirinment.

2011-03-02 Thread D. S. McNeil
export HGENCODING=UTF-8 (Of course not everyone uses bash, so modify as appropriate.) Doug -- Department of Earth Sciences University of Hong Kong -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

Re: [sage-support] Counting lattice points inside convex polyhedra

2011-02-28 Thread D. S. McNeil
I was wondering if sage implements any algorithm for counting the number of points with integer coordinates inside polyhedra with rational coordinates.  even such an algorithm for polygons would be useful for me. Have a look at the integral_points method of Polyhedron objects, which might do

Re: [sage-support] Problem integrating piecewise linear function (breaks with constant piece)

2011-02-24 Thread D. S. McNeil
On Thu, Feb 24, 2011 at 1:52 PM, Ronald L. Rivest rivest@gmail.com wrote: Is posting this bug here on this list sufficient to report it so that it will (eventually) get fixed, or is there some other process for doing so that needs to be done next? I think in general you open a ticket on

Re: [sage-support] Numeric multiple integral of expression not integrable symbolically ?

2011-02-23 Thread D. S. McNeil
On Thu, Feb 24, 2011 at 1:14 PM, Ronald L. Rivest rivest@gmail.com wrote: I want a numeric integration, but numerical_integral(numerical_integral(f,0,x),0,1) doesn't work, since f takes two parameters, not one. IIUY, you could nest it, and do sage: numerical_integral(lambda x:

Re: [sage-support] Re: Isolating real roots of exact univariate polynomial

2011-02-18 Thread D. S. McNeil
A somewhat simpler test case, which I think preserves the qualitative issue: sage: from sage.rings.polynomial.real_roots import real_roots sage: sage: x = polygen(QQ) sage: f = 2503841067*x^13 - 15465014877*x^12 + 37514382885*x^11 - 44333754994*x^10 + 24138665092*x^9 - 2059014842*x^8 -

Re: [sage-support] Numpy Troubles

2011-02-14 Thread D. S. McNeil
I think it's neither Sage nor numpy that's at fault, it's a weird interaction (Sage 4.6.1): sage: import numpy sage: numpy.binary_repr(17) '' sage: numpy.binary_repr(int(17)) '10001' and I think it's rooted in this fact: sage: hex(17) '11' sage: hex(int(17)) '0x11' That is, Sage capital-I

Re: [sage-support] series Bug

2011-02-09 Thread D. S. McNeil
Sorry for the large example, but smaller examples seem to work. After some reductions, I think we can find a slightly simpler failure, of a somewhat suspicious size (4.6.1, OS X 10.6): q = var('q') for i in [1..33]: ix = 2**i f=(q+1)/(q^(ix) + 1) res = (f.series(q==0,2),

Re: [sage-support] plotting box function

2011-02-04 Thread D. S. McNeil
hello, why is the below code plotting a flat function rather than a box one? There are two things going on. First, in the line plot(box(x,1),(x,-3,3)) box(x,1) is actually being evaluated when the line is executed, and not thereafter. IOW you're computing box(x, 1), which is 0, so the above

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

2011-01-28 Thread D. S. McNeil
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

[sage-support] Re: Precision in (Real) Vector Space / Working with reflection groups

2011-01-26 Thread D. S. McNeil
(-6.66133814775094e-16, -1.00) ---??? Why isn't the first coordinate 0??? In theory it should be... Such things are basically inevitable with floating point whenever any number involved can't be perfectly represented-- and in this case sqrt(2)