Re: [sage-support] Real Interval Field (RIF) question

2014-10-23 Thread Jeroen Demeyer
On 2014-10-22 18:10, Robert Bradshaw wrote: I do find this behavior quite surprising--diameter should be an alias for either relative or absolute diameter, not depending on the interval. We're just calling an upstream function, it's upstream which has this strange convention. -- You received

[sage-support] Re: OT: Sage notebook as a interface for python

2014-10-23 Thread Samuel Lelievre
[cc-ing to sage-support, please answer on sage-support rather than sage-devel] You can also use one of the following tricks. - you can make a cell python by typing %python in the first line of the cell. - towards the top of every notebook worksheet, there are four

[sage-support] Re: Arbitrary precision linear programming

2014-10-23 Thread slelievre
Mike wrote: I'd like to be able to do linear programming to arbitrary precision. The documentation that I've found claims that both the glpk and PPL solvers should do this, but I haven't been able to get either to work. As an example, the following code prints c to high precision, but

[sage-support] Re: How to create and use lists of variables?

2014-10-23 Thread slelievre
You can define a function which takes a list or tuple as an argument, and then you can iterate through its elements, with tests if you like. sage: def sum_elements_whose_square_is_one(x): : return sum(a for a in x if a^2 == 1) Then for example: sage:

[sage-support] Re: OT: Sage notebook as a interface for python

2014-10-23 Thread kcrisman
- towards the top of every notebook worksheet, there are four drop-down menus: [File...][Action...][Data...][sage] You can use the last of these menus and change 'sage' to 'python'. And you can make it so that the default for the worksheet is this

[sage-support] Strange error

2014-10-23 Thread João Alberto
I am running the following Python example from the book Learning Python, from Mark Lutz and David Ascher, but Sage is returning a TypeError after presenting the correct response. Can anyone explain me why? I've found this very strange. sage: class Commuter: : def __init__(self, val):

[sage-support] Re: Strange error

2014-10-23 Thread Volker Braun
The short answer is that mathematical objects in Sage don't define addition by implementing __add__ and __radd__ by hand. If you want to learn about them make sure to not add Sage objects (like Sage integers). E.g. int(1) + y would work. On Thursday, October 23, 2014 7:46:02 PM UTC+1, João

Re: [sage-support] Re: Strange error

2014-10-23 Thread William Stein
Or type Integer = int to make Sage integers the usual Python integers in that session. On Thu, Oct 23, 2014 at 11:54 AM, Volker Braun vbraun.n...@gmail.com wrote: The short answer is that mathematical objects in Sage don't define addition by implementing __add__ and __radd__ by hand. If you

Re: [sage-support] Re: Strange error

2014-10-23 Thread kcrisman
Or, in the notebook/cell server/cloud, choose python from the drop-down menu for system and just do this example in Python! Lots of options. Or type Integer = int to make Sage integers the usual Python integers in that session. On Thu, Oct 23, 2014 at 11:54 AM, Volker Braun

Re: [sage-support] Re: Strange error

2014-10-23 Thread João Alberto Ferreira
Ok, thank you all! I was curious just because, due to the error, I did not expect a result. On Thursday, October 23, 2014 5:28:46 PM UTC-2, kcrisman wrote: Or, in the notebook/cell server/cloud, choose python from the drop-down menu for system and just do this example in Python! Lots of

[sage-support] Re: Arbitrary precision linear programming

2014-10-23 Thread Andrey Novoseltsev
On Wednesday, 22 October 2014 21:38:39 UTC-6, Mike wrote: I'd like to be able to do linear programming to arbitrary precision. The documentation that I've found claims that both the glpk and PPL solvers should do this, but I haven't been able to get either to work. As an example, the

[sage-support] Re: Arbitrary precision linear programming

2014-10-23 Thread Volker Braun
If your problem is over QQ then just use that (PPL supports exact rationals). On Thursday, October 23, 2014 4:38:39 AM UTC+1, Mike wrote: I'd like to be able to do linear programming to arbitrary precision. The documentation that I've found claims that both the glpk and PPL solvers