[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
I'm relying on the fact that __getattr__ is only called if the attribute is missing from the matrix class. I was of the opinion that this would completely avoid raising an AttributeError in the first place. This (should?) mean that the currently defined simplify_ methods on the matrices will

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Sorry, all the suggestions I've put below are for proposal one. Joal Heagney -- 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

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Should have noted that this was for proposal one. I kinda prefer it to proposal two myself - will be almost invisible in use. Joal Heagney -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-26 Thread ancienthart
Hah hah. This get's close to desirable behaviour in pure python. class Test: def __init__(self,seq): self.seq = seq def __repr__(self): return Test(%s) % self.seq def apply_map(self,function): newseq = map(function,self.seq) return Test(newseq) def

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-25 Thread ancienthart
My current path of research involves giving the Matrix class a __getattr__ method with argument *missing_method*, that returns a callable object. The callable object then returns the matrix result of .apply_map(lambda x: getattr(x,*missing_method*)) Still having some fun ironing out the

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-25 Thread Simon King
Hi Joal, On 26 Jan., 08:06, ancienthart joalheag...@gmail.com wrote: My current path of research involves giving the Matrix class a __getattr__ method with argument *missing_method*, that returns a callable object. The callable object then returns the matrix result of .apply_map(lambda x:

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-24 Thread ancienthart
Eeeeggg. Working on it. I'm currently investigating using getters and setters to pull attributes from matrix or it's contents. My current idea looks something like this: def map(self, function): try: logic to return self.apply_map(function) except

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-22 Thread ancienthart
*sigh* Which is why I put the comment about how it was likely I'd missed something in the documentation. Nice to know that I'm at least right about that. :P Hmmm. My matrix is based on SR (Symbolic Ring), which doesn't have any simplify methods, which suggests my idea of exposing element

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-22 Thread ancienthart
This tip, which seems the most effective and least likely to blow up, has made it to the following blog. http://doxdrum.wordpress.com/2011/01/22/sage-tip-simplifying-a-matrix/ So is it possible that this could become an approach to matrices, either automagically, or by a smarter map function?

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-22 Thread Robert Bradshaw
On Sat, Jan 22, 2011 at 8:19 PM, ancienthart joalheag...@gmail.com wrote: This tip, which seems the most effective and least likely to blow up, has made it to the following blog. http://doxdrum.wordpress.com/2011/01/22/sage-tip-simplifying-a-matrix/ So is it possible that this could become an

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-21 Thread ancienthart
Since several objects have these defined as methods, would the following approach work? sage: D [-(e^3 + 2)/(e^3 - 1) + (2*e^3 + 1)/(e^3 - 1) 1] [ 2 0] I then defined the following function: def mysimplify(obj): try:

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-21 Thread ancienthart
A possible approach for my proposed (mega) simplify method is outlined below. Since several objects have these defined as methods, would the following approach work? sage: D [-(e^3 + 2)/(e^3 - 1) + (2*e^3 + 1)/(e^3 - 1) 1] [ 2

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-21 Thread Jason Grout
On 1/21/11 3:19 AM, ancienthart wrote: A possible approach for my proposed (mega) simplify method is outlined below. Since several objects have these defined as methods, would the following approach work? sage: D [-(e^3 + 2)/(e^3 - 1) + (2*e^3 + 1)/(e^3 - 1) 1] [ 2 0] I then defined the

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-20 Thread Robert Bradshaw
On Wed, Jan 19, 2011 at 10:16 AM, kcrisman kcris...@gmail.com wrote: On Jan 19, 8:24 am, ancienthart joalheag...@gmail.com wrote: Attempting to use this on my matrix, I end up with the following results (D is my matrix): I personally wish that sage simplify functions worked as follows:

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-20 Thread kcrisman
More important is the option to apply a lot of things to a matrix. Simon's got the right idea (lambda functions) for what you want to do.  But we should make this easier.  My guess is that even the 'magic' decorator for turning methods into functions wouldn't help here, and that is too

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-19 Thread ancienthart
Attempting to use this on my matrix, I end up with the following results (D is my matrix): D.apply_map(simplify_full) Traceback (most recent call last): File stdin, line 1, in module File _sage_input_61.py, line 10, in module exec compile(u'open(___code___.py,w).write(# -*- coding:

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-19 Thread kcrisman
On Jan 19, 8:24 am, ancienthart joalheag...@gmail.com wrote: Attempting to use this on my matrix, I end up with the following results (D is my matrix): I personally wish that sage simplify functions worked as follows: simplify_rational and simplify_trig work as currently implemented.

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-17 Thread Jason Grout
On 1/15/11 4:21 PM, Ivan Andrus wrote: On Jan 15, 2011, at 10:13 PM, Mike Hansen wrote: On Sat, Jan 15, 2011 at 12:57 PM, Ivan Andrusdarthand...@gmail.com wrote: Perhaps Matrix (and other classes) should have a method .map() that does this, They already have an .apply_map() method which

[sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-15 Thread Francois Maltey
Hello, Any chance that we can add simplify_full on matrices? So that each element is simplified if possible? /1/ I suppose you know the map function that operate over each term of a list. map (lambda x: 3*x, [1,2,3]) # computes [3,6,9] # you can replace 3*x by the function

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-15 Thread Ivan Andrus
Hello, Any chance that we can add simplify_full on matrices? So that each element is simplified if possible? /1/ I suppose you know the map function that operate over each term of a list. map (lambda x: 3*x, [1,2,3]) # computes [3,6,9] # you can replace 3*x by the function

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-15 Thread Mike Hansen
On Sat, Jan 15, 2011 at 12:57 PM, Ivan Andrus darthand...@gmail.com wrote: Perhaps Matrix (and other classes) should have a method .map() that does this, They already have an .apply_map() method which does this. --Mike -- To post to this group, send email to sage-support@googlegroups.com To

Re: [sage-support] Re: [sage-devel] simplify_full on matrices.

2011-01-15 Thread Ivan Andrus
On Jan 15, 2011, at 10:13 PM, Mike Hansen wrote: On Sat, Jan 15, 2011 at 12:57 PM, Ivan Andrus darthand...@gmail.com wrote: Perhaps Matrix (and other classes) should have a method .map() that does this, They already have an .apply_map() method which does this. And that is why you should