[sage-support] Re: problem of using surf in SAGE online server 2

2008-09-20 Thread Mike Hansen

Hello,

On Sat, Sep 20, 2008 at 3:47 PM, pong <[EMAIL PROTECTED]> wrote:
>
>
>Thanks for the reply. If I want plot an algebraic curve using
> SAGE, what should I do then? Any suggestion?

For the above example, I would do something like:

sage: var('x1,x2')
(x1, x2)
sage: implicit_plot(x1^3 - x2^2,(x1,-2,2), (x2,-2,2), plot_points=200)

--Mike

--~--~-~--~~~---~--~~
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: can't run a script on when using SAGE on Milnix.org server

2008-09-18 Thread Mike Hansen

On Thu, Sep 18, 2008 at 6:02 PM, pong <[EMAIL PROTECTED]> wrote:
>
> I have written an animation which runs fine in SAGE on my PC.
> However, when I run the same script on Milnix.org server, I got an
> error message:
>
> sh: convert: command not found
>
> what's the problem? any help?

This is because the convert command (from imagemagick) is not
installed on that system.  I have no idea who runs the milnix.org
server.

--Mike

--~--~-~--~~~---~--~~
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: bug in limit()

2008-09-18 Thread Mike Hansen

On Thu, Sep 18, 2008 at 4:54 PM, Alex Raichev <[EMAIL PROTECTED]> wrote:
>
> Now, with the above in mind, how do you write a function to evaluate
> that sine limit given a variable from the user?  We know the following
> does not work.
>
> sage: var('x')
> x
> sage: def limmy(w):
> : return limit(sin(w)/w,w=0)
> sage: limmy(x)
> sin(x)/x
>
> More generally, how do you execute functions requiring keyword
> arguments, such as limit(), when you don't know the symbolic variable
> names involved (but have references to them)?

Here's one way to do it:

sage: def limmy(w):
: return limit(sin(w)/w,**{str(w):0})
:
sage: limmy(x)
1
sage: limmy(var('w'))
1

Not the most elegant, but it works.

--Mike

--~--~-~--~~~---~--~~
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: bug in limit()

2008-09-17 Thread Mike Hansen

Hi Alex,
> sage: limit(sin(y[0])/y[0],y[0]=0)
> 
>   File "", line 1
> SyntaxError: keyword can't be an expression (, line
> 1)
>
> sage: w=x
> sage: limit(sin(w)/w,x=0)
> 1
> sage: limit(sin(w)/w,w=0)
> sin(x)/x

This is because keyword arguments are treated as strings in Python so
what you aren't passing in is a variable or expression, but a string.
For example,

sage: y = [x]
sage: w = x
sage: def f(*args, **kwds):
: return kwds
:
sage: f(y=2)
{'y': 2}
sage: f(w=y)
{'w': [x]}

--Mike

--~--~-~--~~~---~--~~
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: Is there a way to access the unsimplified form of a symbolic expression?

2008-09-16 Thread Mike Hansen

Hi Jason,

> So until hit with an explicit simplify command, symbolic expressions
> seem retain at least some information about how they were input.  Is
> there a way to get the input form of an expression back out?  Can I
> ever get sage to print something like
>
> sage: (x - x).some_devious_trick()
> x - x

Not quite so devious:

sage: a = x - x
sage: a._operator

sage: a._operands
[x, x]

--Mike

--~--~-~--~~~---~--~~
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: using "=="

2008-09-16 Thread Mike Hansen

Hi Bob,

You can use the bool() function to turn an equation in to a True/False value.

sage: q,j = var('q, j')
sage: a = (2*j*2^(18*q) + 13*2^(18*q)/27 - 13/27)
sage: b = (2^(18*q)*(2*j+0)+13*(2^(18*q)-1)/27)
sage: a == b
2*j*2^(18*q) + 13*2^(18*q)/27 - 13/27 == 2*j*2^(18*q) + 13*(2^(18*q) - 1)/27
sage: bool(_)
True

Note that that bool(equation) could return False even though an
equation is True if the system is not able to show that the equation
is True.

Hope that helps,
Mike

--~--~-~--~~~---~--~~
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: efficient determinant of matrix over polynomial ring

2008-09-10 Thread Mike Hansen

Hello,

On Wed, Sep 10, 2008 at 6:23 PM, phil <[EMAIL PROTECTED]> wrote:
> This seems to scale very poorly with the number of variables.
> Basically, it's impractical to compute determinants when there are
> more than 4 variables.

While the problem does become more computationally challenging, a
non-trivial amount of time in your benchmarks is taken up by string
conversion.  Note that what you're doing is not what Martin's patch
does.  Here are the timings with Martin's patch:

sage: R. = QQ[]
sage: C = random_matrix(R,8,8)
sage: %time d = C.det()
CPU times: user 0.18 s, sys: 0.00 s, total: 0.18 s
Wall time: 0.20 s

sage: R. = QQ[]
sage: C = random_matrix(R,8,8)
sage: %time d = C.det()
CPU times: user 0.94 s, sys: 0.00 s, total: 0.94 s
Wall time: 0.95 s

sage: R. = QQ[]
sage: C = random_matrix(R,8,8)
sage: %time d = C.det()
CPU times: user 9.54 s, sys: 0.02 s, total: 9.56 s
Wall time: 10.16 s

sage: R. = QQ[]
sage: C = random_matrix(R,8,8)
sage: %time d = C.det()
CPU times: user 128.78 s, sys: 0.18 s, total: 128.96 s
Wall time: 135.36 s

--Mike

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

2008-09-10 Thread Mike Hansen

Hello,

On Wed, Sep 10, 2008 at 5:45 PM, hypermonkey2 <[EMAIL PROTECTED]> wrote:
> unable to execute gcc: No such file or directory
> error: command 'gcc' failed with exit status 1
>
> any ideas where this gcc problem comes from?

It looks like you don't have gcc installed on your system.

--Mike

--~--~-~--~~~---~--~~
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: variable names for matrix elements

2008-09-09 Thread Mike Hansen

Hello,

On Tue, Sep 9, 2008 at 8:03 PM, phil <[EMAIL PROTECTED]> wrote:
>
> Is there a way to create a matrix whose elements are variables in a
> symbolic ring or polynomial ring without naming all the elements
> manually?
> For example, I've been doing something like:
> vars('x11,x12,x21,x22')
> X = matrix([[x11,x12],[x21,x22]]);

You'll want to get the programming language to help you out:

sage: n = 4
sage: m = matrix([[var('x_%s_%s'%(j,i)) for i in range(n)] for j in range(n)])
sage: m

[x_0_0 x_0_1 x_0_2 x_0_3]
[x_1_0 x_1_1 x_1_2 x_1_3]
[x_2_0 x_2_1 x_2_2 x_2_3]
[x_3_0 x_3_1 x_3_2 x_3_3]

You can use similar constructions to make strings:

sage: ", ".join(['x_%s_%s'%(j,i) for i in range(n) for j in range(n)])
'x_0_0, x_1_0, x_2_0, x_3_0, x_0_1, x_1_1, x_2_1, x_3_1, x_0_2, x_1_2,
x_2_2, x_3_2, x_0_3, x_1_3, x_2_3, x_3_3'

Hope that helps,
--Mike

--~--~-~--~~~---~--~~
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: Erratic behaviour with "Evaluate All" in a notebook

2008-09-07 Thread Mike Hansen

Hi Stan,

On Wed, Sep 3, 2008 at 2:14 AM, Stan Schymanski <[EMAIL PROTECTED]> wrote:
>
> Has anyone had time to verify if this is a bug? I suspect that it
> could be fixed quite easily and I think that it would be VERY helpful
> to be able to do "Evaluate All" reliably in a notebook, as this could
> save many people a lot of time if they work on long notebooks over
> several sessions.

I've posted a patch at http://trac.sagemath.org/sage_trac/ticket/3075
which should fix this issue.  Could you please apply the patch and let
me know if it works for you?

Thanks
--Mike

--~--~-~--~~~---~--~~
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: Upgrade to version 3.1.1

2008-09-05 Thread Mike Hansen

Hello,

> Okay, here's another big problem that seems to have come with version
> 3.1.1:
> "Edit a copy" doesn't work any more on published worksheets! Sage
> makes a copy, but I can't edit it. This is a big problem, as we're
> working with several users.

I fixed this a few days ago, and it will be in the next release.  You
can find the patch at http://trac.sagemath.org/sage_trac/ticket/3960

--Mike

--~--~-~--~~~---~--~~
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: Memoizing methods.

2008-09-03 Thread Mike Hansen

Hi Adrian,

I wrote some code to do this a few releases ago.  It's the
cached_method decorator in Sage.  Here's your example:


sage: class dog():
: def __init__(self, bark='guau'):
: self._bark = bark
: @cached_method
: def bark(self):
: sleep(5)
: return (self._bark + " ")*3
:
sage: sparky = dog()
sage: sparky.bark()  #5 seconds
'guau guau guau '
sage: sparky.bark()  #instant
'guau guau guau '

If you're curious, you can find the code in sage/misc/cachefunc.py

--Mike

--~--~-~--~~~---~--~~
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: Copying/moving worksheets

2008-09-02 Thread Mike Hansen

> Well, that's the thing; once one downloads the new VMWare image and
> tries to put the worksheets back where they belong, one still needs to
> look for them by hand, which of course would take an insane amount of
> time - unless I'm missing something.  So upgrading on VMWare is sort
> of like moving files to another computer, unfortunately.  Anyway, I'll
> report back to our admin.

If you copy over the whole notebook directory, then it should just
load up like it did before.

--Mike

--~--~-~--~~~---~--~~
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: Infinite sum

2008-08-30 Thread Mike Hansen

On Sat, Aug 30, 2008 at 11:15 AM, Robert Dodier <[EMAIL PROTECTED]> wrote:
> Dunno if it matters but maybe you can handle this directly in Maxima.
>
> foo : sum (1/(k + m)^3, k, 1, inf);
>
> load (simplify_sum);
> simplify_sum (foo);
>  => -psi[2](m+1)/2
>
> ev (%, m=2);
>  => zeta(3)-9/8
>
> ev (%, numer);
>  => .07705690315959424
>
> Maybe there's a convenient way to do that through Sage, I don't know.

Thanks Robert!  Here's one way to do this from Sage.

sage: maxima.load('simplify_sum')
"/opt/sage/local/share/maxima/5.16.2/share/contrib/solve_rec/simplify_sum.mac"
sage: maxima.simplify_sum(maxima('sum(1/(k+m)^3,k,1,inf)'))
-psi[2](m+1)/2

--Mike

--~--~-~--~~~---~--~~
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: convert string to sage expression

2008-08-29 Thread Mike Hansen

Hello,

On Fri, Aug 29, 2008 at 4:00 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I want to construct a set of equations using strings. For example:
>
> for i in range(0,10):
>   eq1="eq=x^"+str(i)+"-"+str(i)

Is there a reason why you wanted to do it using strings? It's a bit
cleaner/easier to do it without strings:
sage: eq = var('eq')
sage: eqs = [0== x^i - i for i in range(1,10)]
sage: eqs
[0 == x - 1,
 0 == x^2 - 2,
 0 == x^3 - 3,
 0 == x^4 - 4,
 0 == x^5 - 5,
 0 == x^6 - 6,
 0 == x^7 - 7,
 0 == x^8 - 8,
 0 == x^9 - 9]

But, I doubt that those are the actual equations you want.  you just
need to modify the eqs = ... line to be what you need.

--Mike

--~--~-~--~~~---~--~~
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: Plotting functions with asymptotes

2008-08-28 Thread Mike Hansen

Hello,

On Thu, Aug 28, 2008 at 6:47 AM, kcrisman <[EMAIL PROTECTED]> wrote:
>
> Speaking of asymptotes, any ideas on 
> http://trac.sagemath.org/sage_trac/ticket/3907
> ?  I would be glad to try it, but don't understand enough of how
> infinity and _tasteful_ticks work in Sage.
> ...
> Very good!  Any ideas on why plot(2*sin, -5, 5) doesn't (see
> http://trac.sagemath.org/sage_trac/ticket/3906)?  Again, I'd be glad
> to help if I understood anything of the symbolics.

I've put fixes up for both #3906 and #3907.  Hopefully they will be
reviewed in time for inclusion in Sage 3.1.2.

--Mike

--~--~-~--~~~---~--~~
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: getting a list of points from a plot (was: Plotting functions with asymptotes)

2008-08-27 Thread Mike Hansen

Hi Dan,

On Wed, Aug 27, 2008 at 5:13 PM, Dan Drake <[EMAIL PROTECTED]> wrote:
> The "Plotting functions with asymptotes" thread reminded me of something
> I've wondered for a while: is it possible to get access to the list of
> points that a plot object uses? It's easy enough to make up my own list,
> with something like
>
> ...
>
> Is this possible right now? Or do I smell a trac ticket? :)
>
> Dan

You can get at this now.

sage: p = plot(sin, -4, 4)
sage: p[0].xdata[:5]

[-4.0,
 -3.9983470781843895,
 -3.9966941563687794,
 -3.9950412345531694,
 -3.9933883127375589]

--Mike

--~--~-~--~~~---~--~~
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: Plotting functions with asymptotes

2008-08-27 Thread Mike Hansen

Hello,

On Tue, Aug 26, 2008 at 8:47 PM, kcrisman <[EMAIL PROTECTED]> wrote:
>
> There have been tons of great improvements to the plotting making
> their way through trac lately.  Do any of those changes for ranges
> etc. deal with the very weird output one gets for e.g.
>
> sage: plot((x-1)/(x+2),-4,4)
>
> or, worse,
>
> sage: plot(tan,-20,20)
>
> In both cases, Sage isn't "recognizing" the asymptotes, and then the
> scale gets thrown off, not to mention the non-existent-but-plotted
> connections across discontinuities.

Nope, none of these are fixed by the new changes.  I tried Maple and
it did the same thing -- I don't know what Mathematica does.  You can
do these as a workaround:

sage: plot(tan,-20,20).show(ymin=-5, ymax=5)
sage: plot((x-1)/(x+2),-4,4).show(ymin=-10, ymax=10)

I don't know the best way to be "smart" about fixing this such as how
much of the asymptote to include, etc.

> PS - related to this are two points which don't seem to fit elsewhere
> but about which I am curious:
> 1) It would be useful for those involved to put a summary of the
> plotting improvements/changes in internals on a wiki page, once the
> whole overhaul is complete.

I'll do this in the next day or two.

> 2) Specifically, will the old syntax plot(sin,-5,5) continue to be
> valid under the new plot(sin,(-5,5)) syntax, or will it be completely
> deprecated?  Despite the logic of the new syntax, the old one is
> REALLY convenient and intuitive, and it would be a shame to have to
> change all those old worksheets...

plot(sin, -5, 5) still works.

--Mike

--~--~-~--~~~---~--~~
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: Plotting and constant functions

2008-08-25 Thread Mike Hansen

Hello all,

> It would be nice if the plotting functions could be fixed. None of
> these techniques works (easily) from the user level.

I just put a patch up at #3952 which fixes many of these issues.  Now
you can do things like

sage: plot(2, -2, 2) #horizontal line at y=2

sage: parametric_plot((1, x), -2, 2) #vertical line

sage: parametric_plot((x^2, x), -2, 2) #parabola on its side

Hopefully these will get into 3.1.2.

--Mike

--~--~-~--~~~---~--~~
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: Plotting and constant functions

2008-08-21 Thread Mike Hansen

> For example, is there NO WAY to draw a horizontal or vertical line
> using parametric_plot?

This is one way:

sage: def xt(t): return t
sage: def yt(t): return 1
sage: parametric_plot((xt,yt), -2, 2)

--Mike

--~--~-~--~~~---~--~~
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: Why standalone Python/Sage scripts take longer to run ?

2008-07-19 Thread Mike Hansen

Hi Shing,

You can actually make HTTP calls to the Sage notebook using Robert
Bradshaw's simple API.  For example, the following is a (condensed)
Python script which authenticates with a running Sage notebook.

import urllib, re
def get_url(url):
h = urllib.urlopen(url); data = h.read(); h.close(); return data
session = None
def sage(expression, host="localhost", passwd = "passwd", port = 8000):
global session
if session is None:
login_page =
get_url('http://%s:%s/simple/login?username=admin&password=%s' %
(host, port, passwd))
session = re.match(r'.*"session": "([^"]*)"', login_page,
re.DOTALL).groups()[0] #extract the sessionid from the result
expression = urllib.quote(expression)
res = get_url('http://%s:%s/simple/compute?session=%s&code=%s' %
(host, port, session, expression))
return res
def test_equality(expr1, expr2):
res = sage("bool( %s == %s)"%(expr1, expr2))
dictionary, res = res.split("___S_A_G_E___")
res = res.strip()
return True if res == "True" else False

The function 'sage' takes in a Sage expression and returns the result
as a string.  You can look at sage/server/simple/twist.py for more
examples of how this is used.  Doing the same thing from Java wouldn't
be difficult.

--Mike

On Sat, Jul 19, 2008 at 2:24 PM, Shing <[EMAIL PROTECTED]> wrote:
>
> I have upgraded to 3.0.5. Now the time taken to run the factor script
> is down to 2s (with 3.0.3 it was 12s)
> I am trying to call Sage from a Java web application. So far the only
> way I know is to do it indirectly by running
> a sage script from Java.  Is there a more directly way of calling Sage
> from Java ?
> The factor script is just a test. In general, my sage script would do
> different computation.
>
> Thanks!
> Shing
>
>
>
> On Jul 19, 1:45 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
>> On Sat, Jul 19, 2008 at 1:53 PM, Shing <[EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>> >   I have tried the standalone Python/Script at
>> >http://www.sagemath.org/doc/html/tut/node55.html
>>
>> > to factorize a number.
>>
>> > #!/usr/bin/env sage
>>
>> > import sys
>> > from sage.all import *
>>
>> > if len(sys.argv) != 2:
>> >print "Usage: %s "%sys.argv[0]
>> >print "Outputs the prime factorization of n."
>> >sys.exit(1)
>>
>> > print factor(sage_eval(sys.argv[1]))
>>
>> > The script takes about 12s to factories 2006. But in the notebook,
>> > it takes  less than 1 second.
>> > I would like to use a standalone script from command line to do some
>> > computation. Is there a way to speed it up ?
>>
>> > I am using Sage 3.0.3 on a Athlon 3200 64bit PC, running OpenSuse 11.
>>
>> > Thanks in advance for any assistance!
>>
>> The Sage startup time in sage-3.0.5 is better than in 3.0.3, so you might
>> want to try upgrading.   Are you *just* factoring integers are do you plan
>> to do much more?  This is fast:
>>
>> teragon-2:~ was$ time echo "factor(2006)" | sage -gp
>>   GP/PARI CALCULATOR Version 2.3.3 (released)
>>i386 running darwin (ix86/GMP-4.2.1 kernel) 32-bit version
>> compiled: May  4 2008, gcc-4.0.1 (Apple Inc. build 5465)
>> (readline v5.2 enabled, extended help available)
>>
>>  Copyright (C) 2000-2006 The PARI Group
>>
>> PARI/GP is free software, covered by the GNU General Public License, and
>> comes WITHOUT ANY WARRANTY WHATSOEVER.
>>
>> Type ? for help, \q to quit.
>> Type ?12 for how to get moral (and possibly technical) support.
>>
>> parisize = 400, primelimit = 50
>> %1 =
>> [2 1]
>>
>> [17 1]
>>
>> [59 1]
>>
>> Goodbye!
>>
>> real0m0.388s
>> user0m0.033s
>> sys 0m0.051s
>>
>>  -- William
> >
>

--~--~-~--~~~---~--~~
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: Sage and Maple

2008-07-15 Thread Mike Hansen

>> Note that the list of completions is cached the very first time it is
>> created so you may want to delete it from your ~/.sage/ directory.
>
> I see a binary file maple_commandlist_cache.sobj. Is this one?

Yep, that's the one.

--Mike

--~--~-~--~~~---~--~~
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: Sage and Maple

2008-07-15 Thread Mike Hansen

Hello Alejandro,

> I would like to transfer these listings to a text file for a better
> analysis of this output. Is there a simple way?

If you run maple.trait_names(), you'll get a Python list where each
entry is a string of the name.  To see how that list is created,
you'll want to do

sage: maple.trait_names??
sage: maple._commands??
sage: maple.completions??

Note that the list of completions is cached the very first time it is
created so you may want to delete it from your ~/.sage/ directory.

--Mike

--~--~-~--~~~---~--~~
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: Spam bots

2008-07-15 Thread Mike Hansen

On Tue, Jul 15, 2008 at 4:55 PM, Alec Mihailovs <[EMAIL PROTECTED]> wrote:
> That could happen, with probability 20%.

I guess in the end I'm not sure what you wanted to accomplish with
this thread.  Are you saying that there is an individual associated to
the Sage project that is spamming your wiki?  Or that there is code in
Sage designed to spam your wiki? Or ...?

--Mike

--~--~-~--~~~---~--~~
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: Spam bots

2008-07-15 Thread Mike Hansen

> Still, the spam text contained it. I don't think that a bot was searching
> for the pages in the wiki and randomly chose that one.

My guess is that the spam bot wanted to assign its page to a category,
and it can easily find the already existing categories on your wiki
from http://mapleadvisor.com/cgi-bin/moin.cgi/CategoryCategory

--Mike

--~--~-~--~~~---~--~~
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: Spam bots

2008-07-15 Thread Mike Hansen

On Tue, Jul 15, 2008 at 4:03 PM, Alec Mihailovs <[EMAIL PROTECTED]> wrote:
>
> Sage seems to be used for creating spam bots. In particular, the FrontPage
> in Maple Wiki was corrupted yesterday from 193.53.87.109 with spam ending
> with CategorySage, see
>
> http://mapleadvisor.com/cgi-bin/moin.cgi/FrontPage?action=diff&rev1=3&rev2=4

I'm not sure what you mean by Sage is being used to create spam bots.
Since you already had a CategorySage on your wiki, I don't see any
evidence that this is related to Sage in any way.

--Mike

--~--~-~--~~~---~--~~
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: Performance problem, and a more basic question.

2008-07-15 Thread Mike Hansen

> Very interesting... but, I think you sent me a copy of my worksheet...
> Yours, very sincerely

While the name is the same, it's a different worksheet.  Anyways,
here's the faster code:

def NewtonInterpolation(x,y,f):
poly=f[0]
q=1
s=f[0:len(f)]
stride=1
for k in range(len(f)-1,0,-1):
for i in range(k):
s[i]=(s[i+1]-s[i])/(y[i+stride]-y[i])
q*=(x-y[stride-1])
poly+=s[0]*q
stride+=1
return poly

x = var('x')
fonc = 1/(1+25*x^2)
ffonc = fonc._fast_float_('x')
x = RDF['x'].gen()

pf = plot(fonc,-1,1, thickness=1,color='red')
@interact
def Unif(points=(3..40)):
t = cputime()
pi = RDF.pi()

y=[RDF(-1+2*i/(points-1)) for i in range(points)]
col=point([(y[i],0) for i in range(points)],rgbcolor='red',pointsize=30)

p = NewtonInterpolation(x, y, [ffonc(z) for z in y])

html('$%s$'%latex('Le phenomene de Runge'))
html('Interpolation polynomiale, points de collocation equidistants, et')
html('interpolation polynomiale aux points de Tchebychev.')
html('$f(x)\;=\;%s$'%latex(fonc))
print points,' points.'

pp= plot(p,-1,1, thickness=1)
show(col+pp+pf,ymin=-1,ymax=1.5)

ytche=[cos(i*pi/(points-1)) for i in range(points)]

coltche=point([(ytche[i],0) for i in
range(points)],rgbcolor='red',pointsize=30)

ptche=NewtonInterpolation(x,ytche,[ffonc(z) for z in ytche])

pptche= plot(ptche,-1,1, thickness=1)

show(coltche+pf+pptche,ymin=-1,ymax=1.5)
print cputime()-t

--Mike

--~--~-~--~~~---~--~~
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: problem with sum()

2008-07-10 Thread Mike Hansen

> ah. I try to avoid using __repr__ because i was told that this is
> supposed to return a string from which the object can be reconstructed
> -- and i certainly don't want to go through all that trouble just for
> what i need. Do you know what happens if __repr__ simply returns the
> same as __str__ ?

There is no problem having __repr__ and __str__ do the same thing.
Sage breaks the conventions that __repr__ is a string from which the
object can be reconstructed due to the complexity of the objects in
Sage.

If you do

sage: a

Then, the ipython interpreter will call the __repr__ method to display
the object a.

--Mike

--~--~-~--~~~---~--~~
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: problem with sum()

2008-07-10 Thread Mike Hansen

Hello,

> this is probably just a silly Python question, but let me try. I've
> designed a little class that has a __add__() method, and it works fine
> for expressions like x+y. However, sum() does not work on a list of
> such objects ! do I need to do something else ? (in the meanwhile i go
> reduce(lambda x,y : x+y, list) which is cumbersome).

The sum function starts off with the integer 0, so it tries to add one
of your objects to the integer 0.  This is probably what's going
wrong.  You can pass as a second argument the thing you want sum to
start with.  For example,

sage: sum([ [1,2,3], [4,5,6] ])
Traceback (most recent call last)
...
TypeError: unsupported operand type(s) for +: 'int' and 'list'
sage: sum([ [1,2,3], [4,5,6] ], [])
[1, 2, 3, 4, 5, 6]


>
> along the same lines, my class has a __str__() method, and 'print x'
> works. But 'print L' where L is a list of such objects does not
> work...
>
> any idea?

You need to define the __repr__ method, since that is what list is
using to display your objects.

--Mike

--~--~-~--~~~---~--~~
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: problems building matplotlib on Ubuntu 8.04

2008-07-08 Thread Mike Hansen

Hi Adam,

Sorry for the delayed reply.  I'm not exactly sure what's going on in
your case, but I'll ask Michael Abshoff about it since he probably has
a much better idea of what is going on.

--Mike

On Jul 3, 1:33 pm, Adam Webb <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have been having problems with Matplotlib on Ubuntu 8.04 (AMD-64).
> Specifically, I am having trouble with the backends. If I build
> Matplotlib separately I get the following for information about
> backends.
>
> OPTIONAL BACKEND DEPENDENCIES
>                 libpng: 1.2.15beta5
>                Tkinter: no
>                         * Tkinter present, but header files are not
> found.
>                         * You may need to install development
> packages.
>               wxPython: 2.6.3.2
>                   Gtk+: gtk+: 2.12.9, glib: 2.16.3, pygtk: 2.12.1,
>                         pygobject: 2.14.1
>                     Qt: no
>                    Qt4: no
>                  Cairo: 1.4.0
>
> In fact, I do have Tcl/Tk headers but they are not found. This is a
> known issue:http://www.mail-archive.com/[EMAIL PROTECTED]/ms...
>
> However, when I look into the install.log file of Sage I find:
>
> OPTIONAL BACKEND DEPENDENCIES
>                 libpng: 1.2.15beta5
>                Tkinter: no
>                         * Tkinter present, but header files are not
> found.
>                         * You may need to install development
> packages.
>               wxPython: no
>                         * wxPython not found
>                   Gtk+: no
>                         * Building for Gtk+ requires pygtk; you must
> be able
>                         * to "import gtk" in your build/install
> environment
>                     Qt: no
>                    Qt4: no
>                  Cairo: no
>
> It can not find anything and so does not build any and so various
> tests fail. I also tried using sage -python to build Matplotlib with
> the same result (no backends found).  I was hoping to use another
> backend until a fix for the tcl/tk problem is found.
>
> Any ideas would be welcome.
>
> Cheers,
> Adam
--~--~-~--~~~---~--~~
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: solve doesn't always solve

2008-07-08 Thread Mike Hansen

Hi Stan,

I don't think there is any other way to solve an equation such as that
in Sage.  You can do it using Sage's interface to Maple (if you have
it installed / access to it), but it's not as clean as it should be
due to bug #3610.

sage:
var('wcnew,epsln,ysnew,delyu,sumsunew,sunlayersnew,delyu,nlayers,ysnew,cz,zr');
sage: eq = wcnew==epsln*(ysnew + ((delyu*sumsunew +
sunlayersnew*(delyu*(1 - nlayers) + sqrt((cz - ysnew)*(cz -
zr*sqrt((cz - ysnew)*(cz - zr)))/(cz - zr))
sage: meq = maple("%s = %s"%(repr(eq.lhs()), repr(eq.rhs(
sage: ans = maple.solve(meq, ysnew)
sage: ans = sage_eval(str(ans).replace("\n",""),globals())
sage: ans

((-delyu*nlayers*sunlayersnew*(sqrt(-4*epsln*sunlayersnew*wcnew*zr +
4*epsln*wcnew*zr + 4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) +
delyu*sunlayersnew*(sqrt(-4*epsln*sunlayersnew*wcnew*zr +
4*epsln*wcnew*zr + 4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) +
delyu*sumsunew*(sqrt(-4*epsln*sunlayersnew*wcnew*zr + 4*epsln*wcnew*zr
+ 4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) + wcnew*zr -
cz*epsln*sunlayersnew*zr - cz*wcnew + cz^2*epsln*sunlayersnew)/
(epsln*(sunlayersnew - 1)*(cz - zr)),
 (-delyu*nlayers*sunlayersnew*(-sqrt(-4*epsln*sunlayersnew*wcnew*zr +
4*epsln*wcnew*zr + 4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) + delyu*sunlayersnew*(-
sqrt(-4*epsln*sunlayersnew*wcnew*zr + 4*epsln*wcnew*zr +
4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) + delyu*sumsunew*(-
sqrt(-4*epsln*sunlayersnew*wcnew*zr + 4*epsln*wcnew*zr +
4*cz*epsln^2*sunlayersnew*zr - 4*cz*epsln^2*zr +
4*cz*epsln*sunlayersnew*wcnew - 4*cz*epsln*wcnew +
delyu^2*epsln^2*nlayers^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sunlayersnew^2 +
delyu^2*epsln^2*sunlayersnew^2 -
2*delyu^2*epsln^2*nlayers*sumsunew*sunlayersnew +
2*delyu^2*epsln^2*sumsunew*sunlayersnew - 4*cz^2*epsln^2*sunlayersnew
+ delyu^2*epsln^2*sumsunew^2 + 4*cz^2*epsln^2) +
delyu*epsln*nlayers*sunlayersnew - delyu*epsln*sunlayersnew -
delyu*epsln*sumsunew)/(2*(sunlayersnew - 1)) + wcnew*zr -
cz*epsln*sunlayersnew*zr - cz*wcnew + cz^2*epsln*sunlayersnew)/
(epsln*(sunlayersnew - 1)*(cz - zr)))

--Mike
--~--~-~--~~~---~--~~
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: NTL installation

2008-07-08 Thread Mike Hansen

Hello,

What type of machine are you running this on?

--Mike

On Jul 6, 6:37 pm, Wim Verleyen <[EMAIL PROTECTED]> wrote:
> Hello,
>
> ranlib ntl.a
> make[2]: Leaving directory `/home/purplehat/tmp/sage-3.0.3/spkg/build/
> ntl-5.4.2.p3/src/src'
> make[2]: Entering directory `/home/purplehat/tmp/sage-3.0.3/spkg/build/
> ntl-5.4.2.p3/src/src'
> mkdir -p -m 755 /home/purplehat/tmp/sage-3.0.3/local/lib
> cp -p ntl.a /home/purplehat/tmp/sage-3.0.3/local/lib/libntl.a
> cp: preserving times for `/home/purplehat/tmp/sage-3.0.3/local/lib/
> libntl.a': Function not implemented
> make[2]: *** [install] Error 1
> make[2]: Leaving directory `/home/purplehat/tmp/sage-3.0.3/spkg/build/
> ntl-5.4.2.p3/src/src'
> Failed building install of NTL
>
> real    10m10.884s
> user    8m9.891s
> sys     0m20.101s
> sage: An error occurred while installing ntl-5.4.2.p3
> Please email sage-develhttp://groups.google.com/group/sage-devel
> explaining the problem and send the relevant part of
> of /home/purplehat/tmp/sage-3.0.3/install.log.  Describe your
> computer, operating system, etc.
> If you want to try to fix the problem, yourself *don't* just cd to
> /home/purplehat/tmp/sage-3.0.3/spkg/build/ntl-5.4.2.p3 and type
> 'make'.
> Instead type "/home/purplehat/tmp/sage-3.0.3/sage -sh"
> in order to set all environment variables correctly, then cd to
> /home/purplehat/tmp/sage-3.0.3/spkg/build/ntl-5.4.2.p3
> (When you are done debugging, you can type "exit" to leave the
> subshell.)
> make[1]: *** [installed/ntl-5.4.2.p3] Error 1
> make[1]: Leaving directory `/home/purplehat/tmp/sage-3.0.3/spkg'
>
> real    10m12.043s
> user    8m10.603s
> sys     0m20.357s
>
> Has somebody any idea, how to tackle this problem?
>
> Thx in advance,
> W
--~--~-~--~~~---~--~~
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: Debian Etch: Error trying to plot

2008-07-07 Thread Mike Hansen

Hello,

In order to figure things out, I think we need to know a bit more
about your install.  How did you install Sage?  Did you use one of the
binaries or did you build from source?  What processor is your
computer running?

--Mike

On Mon, Jul 7, 2008 at 3:59 PM, Alejandro Jakubi
<[EMAIL PROTECTED]> wrote:
>
> On Jul 7, 4:25 pm, Simon King <[EMAIL PROTECTED]> wrote:
>> Is there any problem up to this point? Probably not.
>
> Yes, all these examples, and much more give the same error message.
>
>> > p = polygon(L, rgbcolor=(1,1,0))
>>
>> L is not defined yet, and by consequence one gets "NameError: name 'L'
>> is not defined".
>> Could you complete your example, please?
>
> This is the example here:
> http://www.sagemath.org/doc/html/tut/node21.html
>
> The missing line is
>
> L = [[cos(pi*i/100),sin(pi*i/100)] for i in range(200)]
>
> But this is not the point. Again, whatever plot I try gives the same
> error message.
>
> Regards, Alejandro
>
> >
>

--~--~-~--~~~---~--~~
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: Accessing terms in an expression

2008-07-02 Thread Mike Hansen

Hi Phil,

I don't think there is an official way to get at the terms, but here
is something that works:

sage: var('x,y')
(x, y)
sage: t = x^2 + y^2
sage: type(t)

sage: t._operator

sage: t._operands
[x^2, y^2]
sage: t._operands[0]
x^2

--Mike

On Wed, Jul 2, 2008 at 7:49 PM, phil <[EMAIL PROTECTED]> wrote:
>
> I've looked around in the documentation but have not been able to
> figure out how to access individual terms in an symbolic expression.
> For example:
> var('x,y')
> t = x^2 + y^2
>
> How do I access the first term in t?  I want to assign it to another
> variable, like first_term = t.extract_term(t,1) to get first_term to
> be x^2.
>
> Thanks
>
> >
>

--~--~-~--~~~---~--~~
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: variable number of arguments for a function

2008-06-30 Thread Mike Hansen

Hello,

In Python you can use *args and **kwds in the function definition to
match optional arguments and keyword arguments; args will be a tuple
of the arguments and kwds will be a dictionary for the keyword
arguments.  For example, look at the behavior of the following
function:

sage: def f(*args, **kwds): print args, kwds
sage: f(1,2,3)
(1, 2, 3) {}
sage: f(1,2,3,optional=True)
(1, 2, 3) {'optional': True}
sage: f(optional=True)
() {'optional': True}
sage: f(4, 5, optional=True, cat="dog")
(4, 5) {'optional': True, 'cat': 'dog'}

--Mike

On Mon, Jun 30, 2008 at 9:14 AM, ibrahim <[EMAIL PROTECTED]> wrote:
>
> Hello !
>
> How to do so if possible ?
> Thanks.
>
> >
>

--~--~-~--~~~---~--~~
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: matrix, Singular -->SAGE

2008-06-30 Thread Mike Hansen

Hello Gema,

You just need to run the following:

sage: m.sage_matrix(QQ)
[-6  5  4  3  0]
[ 6  0 -2 -3  1]
[ 6 -1  0 -3  2]
[ 6 -1 -2  0  3]
[-6  1  2  3  0]

or you can replace ZZ with whatever ring you want the matrix to be over.

--Mike


On Mon, Jun 30, 2008 at 8:31 AM, gema m. <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I have a matrix "m" that's a Singular object and I would like to
> compute the eigenvalues via SAGE. So I have to import such a matrix to
> SAGE, am i right? But , how? could you help me , please?  Here I send
> my code:
>
> sage: singular.lib('rootsmr.lib')
> sage: singular.ring(0,'(x,y,z)','dp')
> sage: I=singular.ideal(['x2+y+z-1','y2+z+x-1','z2+y+x-1'])
>  sage: J=I.radical()
> sage: H=J.groebner()
> sage: q=H.qbase()
> sage: f=singular.poly('x+2y+3z')
> sage: m=f.matmult(q,H)
> sage: m
>
> -6,5, 4, 3, 0,
> 6, 0, -2,-3,1,
> 6, -1,0, -3,2,
> 6, -1,-2,0, 3,
> -6,1, 2, 3, 0
>
> >
>

--~--~-~--~~~---~--~~
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: group rings question

2008-06-29 Thread Mike Hansen

Hello,

Sorry I didn't get in on this sooner -- I've been really busy with
things this past week.  Anwyays, CombinatorialAlgebra is getting a bit
of an update, and the changes are on the sage-combinat patch
repository.  You can see a working group ring here:

http://sage.math.washington.edu:8837/home/pub/2/

There are a few hacks to account for the missing count and
object_class. I'll try to get the necessary changes ready to merge in
for the next release.

--Mike

--~--~-~--~~~---~--~~
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: Precision Problems

2008-06-23 Thread Mike Hansen

> Mike's solution is ok for the precision but doesn't work for our
> little example log(2+a-2), because it still says - infty and in my
> application it doesn't fit either.

Doing log(2+a-2) instead of log(2-a-2) should work assuming that you
have enough precision to avoid the cancellation problem of floating
point arithmetic.

sage: R = RealField(1000)
sage: a = R(10)^(-175)
sage: log(2+a-2)
-402.95239127395799470314...

Note that if you do log(2-2+a), you get the answer you think you'd get
since you aren't taking the difference of two approximately equal
floating point numbers.

> Harald's solution using RationalField works for this example (log),
> but when I come to sqrts or pi in my expression, it fails.
> Also in my application I don't know when my variable gets Symbolic,
> Real or Complex so it is not always possible to convert to Rational.
> So I'd have to use .n() all the time. But isn't that slowing down the
> whole computation a lot.

If you post your code, it'd be easier to work out any issues.

--Mike

--~--~-~--~~~---~--~~
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: Precision Problems

2008-06-20 Thread Mike Hansen

Hello,

> while working a little with sage I encountered some problems sage has
> concerning numerical precision at very small numbers.
> I hope I can make my point with a little example.
>
> sage: a=1e-175
> sage: log(a)
> -402.952391273958

There are a few issues at hand here.  First, you have to be careful
when working with either really large or really small floating
numbers.  You can do a.parent() to figure out the data type of a.

sage: (1e-175).parent()
Real Field with 53 bits of precision

It only had 53 bits of precision.

> sage: log(2-a-2)
> -infinity

For this particular computation, a is a positive number so 2-a-2
should be a negative number.  So, I would expect a result of -infinity
or NaN.

There are two options for working with more precision.  You can
RealField with a certain number of bits of precision like the
following:

sage: R = RealField(200); R
Real Field with 200 bits of precision
sage: a = R(10)^(-175); a
1.00e-175

or you can use a RealIntervalField which gives an interval of real
numbers that your true answer is guaranteed to be in.

sage: R = RealIntervalField(100); R
Real Interval Field with 100 bits of precision
sage: a = R(10)^(-175); a
[9.9976770e-176 ..
1.747e-175]

Let me know if that helps,
--Mike

--~--~-~--~~~---~--~~
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: coercion problem?

2008-06-02 Thread Mike Hansen

Hello,

This is definitely not a problem with coercion -- it's a problem with
the iterator for G.  For example. try this:

sage: z = iter(G)
sage: z

sage: z.next()
[0 1]
[1 0]
sage: z.next()
[0 1]
[1 1]

It takes quite a bit of time to do each .next() which makes me suspect
that something silly is going on.

--Mike


--Mike
On Mon, Jun 2, 2008 at 5:44 PM, David Joyner <[EMAIL PROTECTED]> wrote:
>
> Hi:
>
> Possibly this is a problem with coercion but I don't know.
> Does anyone know why the following takes so long?
>
>
> sage: p = 5
> sage: F = GF(p)
> sage: E. = GF(p^2,"a")
> sage: G = GL(2,p)
> sage: M = MatrixSpace(E,2,2)
> sage: V = VectorSpace(E,2)
> sage: g = G.random_element()
> sage: v = V([1,a]); v; g; M(g)*v
> (1, a)
>
> [4 0]
> [2 1]
> (4, a + 2)
> sage: G.order()
> 480
> sage: time orbit_v = [M(g)*v for g in G]
>
>
> It has not finished after several minutes. It seems like it should be
> instant.
>
> - David Joyner
>
> >
>

--~--~-~--~~~---~--~~
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: bar chart fails in pylab

2008-06-01 Thread Mike Hansen

Hi Thomas,

The issue comes from Pylab not knowing how to deal with instances of
Sage's RealNumber class.  When you do "4.0" from the command line, it
gets changed into "RealNumber('4.0')".  You can see this with the
following commands:

sage: preparse('4.0')
"RealNumber('4.0')"

In order to get Pylab to work as expected there are two easy solutions:

1) Run "RealNumber = float" to get Sage to return Python floats
instead of RealNumbers.  See below:

sage: type(4.0)

sage: RealNumber = float
sage: type(4.0)


2) Turn off the preparser when using Pylab:

sage: preparser(False)
sage: type(4.0)


Hope this helps.

--Mike

On Sun, Jun 1, 2008 at 12:57 PM, tkeller <[EMAIL PROTECTED]> wrote:
>
> Hi folks,
> Sorry to bombard the mailing list with questions, I'm starting to use
> sage for more and more things lately.  I'm trying to get a figure
> together for a paper and thought I'd try using the bar() command in
> pylab. However, the following code (modeled after an example in
> matplotlib) gives an error.  I thought maybe a problem with number
> coercion was causing the issue, but explicitly casting the numbers as
> floats has no effect. I should mention that I'm completely new to
> matplotlib, so it could be that I'm just not supplying arguments
> correctly.
>
> import pylab as p
> p.close()
> pos=p.arange(4.0,dtype=float)
> width=0.35
> dat=p.array([-2.0,10.4,30.0,29.9],dtype=float)
> p.bar(pos,dat,width,color='b')
> p.savefig('sage.png')
>
> This returns :
>  File "/home/thomas/.sage/sage_notebook/worksheets/admin/10/code/
> 2.py", line 11, in 
>p.bar(pos,dat,width,color='b')
>  File "/home/thomas/sage/local/lib/python2.5/site-packages/matplotlib/
> pyplot.py", line 1402, in bar
>ret =  gca().bar(*args, **kwargs)
>  File "/home/thomas/sage/local/lib/python2.5/site-packages/matplotlib/
> axes.py", line 3293, in bar
>self.add_patch(r)
>  File "/home/thomas/sage/local/lib/python2.5/site-packages/matplotlib/
> axes.py", line 1145, in add_patch
>self._update_patch_limits(p)
>  File "/home/thomas/sage/local/lib/python2.5/site-packages/matplotlib/
> axes.py", line 1153, in _update_patch_limits
>self.update_datalim(xys)
>  File "/home/thomas/sage/local/lib/python2.5/site-packages/matplotlib/
> axes.py", line 1180, in update_datalim
>self.dataLim.update_numerix_xy(xys, -1)
> TypeError: Bbox::update_numerix_xy expected numerix array
>
> If anyone has some insight into this, I'd greatly appreciate it.
> Thomas
> >
>

--~--~-~--~~~---~--~~
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: using parametric_plot for more than one function

2008-05-29 Thread Mike Hansen

Hi Andrew,

You can do this by saving the plots to an object and then adding them together.

sage: t = var('t')
sage: p1 = parametric_plot( (s), sin(2*t)), 0, 2*pi, rgbcolor=hue(0.6) )
sage: p2 = parametric_plot( (cos(t), cos(3*t)), 0, 2*pi, rgbcolor=hue(0.3) )
sage: (p1+p2).show()

One can do this with plots in general in Sage.

--Mike

--~--~-~--~~~---~--~~
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: Notebook insecure by default

2008-05-26 Thread Mike Hansen

This issue came up before and is being tracked here:
http://trac.sagemath.org/sage_trac/ticket/2827

--Mike

On Mon, May 26, 2008 at 4:09 PM, Greg Landweber
<[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I just noticed that as of Sage 3.0.1, the notebook has default
> secure=False. While that is all well and good for localhost use, I run
> a Sage notebook server, and I need to set secure=True. I would happily
> do so explicitly, except that I have my computer configured to
> automatically start the sage notebook from the command line, and I
> have not been able to get Sage to change the secure setting from the
> command line.
>
> My current working Sage command is:
>
> /Applications/sage/sage -notebook ~/.sage/sage_notebook 8000 greg.bard.edu
>
> but starting with Sage 3.0.1, this opens an insecure server, which on
> startup tells me that I must be crazy. According to the notebook?
> help, if I wanted to run in secure mode I would need to use the
> command
>
> /Applications/sage/sage -notebook ~/.sage/sage_notebook 8000
> greg.bard.edu 0 True
>
> However, sage is complaining about the "0", presumably for the
> port_tries parameter, giving me the traceback:
>
> Traceback (most recent call last):
>  File "/Applications/sage/local/bin/sage-notebook", line 14, in 
>notebook(*sys.argv[1:])
>  File 
> "/Applications/sage/local/lib/python2.5/site-packages/sage/server/notebook/notebook_object.py",
> line 143, in __call__
>return self.notebook(*args, **kwds)
>  File 
> "/Applications/sage/local/lib/python2.5/site-packages/sage/server/notebook/run_notebook.py",
> line 266, in notebook_twisted
>port = find_next_available_port(port, port_tries)
>  File 
> "/Applications/sage/local/lib/python2.5/site-packages/sage/server/misc.py",
> line 91, in find_next_available_port
>for port in range(start, start+max_tries+1):
> TypeError: unsupported operand type(s) for +: 'int' and 'str'
>
> Is it treating the max_tries parameter as a string?
>
> -- Greg
>
> --
> Gregory D. Landweber
> Assistant Professor of Mathematics
> Bard College
>
> >
>

--~--~-~--~~~---~--~~
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: take Sage formulas into MSWord

2008-05-22 Thread Mike Hansen

> With html(latex(sage-output) we get html code, right? And MSWord is
> among other things also a html-editor capable of reading and writing
> html. So if I could save the sage html code somehow then I could try
> whether MSWord can read and display it...
> Now I just tested that and of course... it does not work :-(

It is being rendered by the jsMath javascript library which doesn't
quite work in Word.

--Mike

--~--~-~--~~~---~--~~
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: take Sage formulas into MSWord

2008-05-22 Thread Mike Hansen

Maybe this? http://ooolatex.sourceforge.net/

--Mike

On Thu, May 22, 2008 at 2:04 AM, roleic <[EMAIL PROTECTED]> wrote:
>
> On May 22, 9:56 am, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
>> On Thu, May 22, 2008 at 12:45 AM, roleic <[EMAIL PROTECTED]> wrote:
>>
>> > I can do html(latex(sage-output))
>> > What is the best way to import it into MSWord?
>>
>> I don't have Word, but maybe this might be useful:http://www.chikrii.com/.
>>
>> There is no way to get latex for the input since it only makes sense
>> for a limited number of cases and no one has implemented it.  It'd
>> probably be easiest to just get the latex for the integrand and add
>> the \int and dx manually.
>>
>> --Mike
>
> Thanks for your link. I am working at my customer's premises and I am
> forced to use the local MSWord but unfortunately I cannot expect that
> the customer buys and installs a commercial translator as given in
> your link.
> How about a OpenOffice? Can I get the sage formulas into there?  How?
> fFor the formula transfer from OO to MSWord I found the following
> link: 
> http://www.oooforum.org/forum/viewtopic.phtml?t=66787&start=0&postdays=0&postorder=asc&highlight=
> Thanks
> roleic
> >
>

--~--~-~--~~~---~--~~
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: take Sage formulas into MSWord

2008-05-22 Thread Mike Hansen

On Thu, May 22, 2008 at 12:45 AM, roleic <[EMAIL PROTECTED]> wrote:
>
> I can do html(latex(sage-output))
> What is the best way to import it into MSWord?

I don't have Word, but maybe this might be useful: http://www.chikrii.com/ .

There is no way to get latex for the input since it only makes sense
for a limited number of cases and no one has implemented it.  It'd
probably be easiest to just get the latex for the integrand and add
the \int and dx manually.

--Mike

--~--~-~--~~~---~--~~
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: calling SAGE from C or Mathematica

2008-05-06 Thread Mike Hansen

I think you might have an easier time getting Pythonika (
http://dkbza.org/pythonika.html ) to do what you want.

--Mike

On Tue, May 6, 2008 at 11:41 PM, Amir <[EMAIL PROTECTED]> wrote:
>
>
>  Can I start a Sage session from C? I would need to pass commands, set
>  and get variables, and cleanly terminate the session. I would like to
>  do this as a mathlink module to call Sage from Mathematica. I'm new to
>  Sage and python.
>
>  Thanks,
>  Amir.
>
>  >
>

--~--~-~--~~~---~--~~
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: How to tell the installation script of setup for Sage not to installed python packages

2008-04-25 Thread Mike Hansen

Sage uses Python 2.5 while your system installation looks like 2.4.

--Mike

On Fri, Apr 25, 2008 at 6:25 PM, Hector Villafuerte <[EMAIL PROTECTED]> wrote:
>
>  On Fri, Apr 25, 2008 at 7:20 PM, Hector Villafuerte <[EMAIL PROTECTED]> 
> wrote:
>  > On Wed, Apr 2, 2008 at 6:36 AM, William Stein <[EMAIL PROTECTED]> wrote:
>  >  [...]
>  >
>  > >  By the way, you can modify sys.path in Sage so that it's possible
>  >  >  to use your existing system-wide Python modules in some cases...
>  >  [...]
>  >
>  >
>  >  I tried just that, since I want to use Graphviz
>  >  (http://www.graphviz.org/) through a Python binding (yapgvb). Here's
>  >  what I've tried so far...
>  >
>  >
>  >  sage: import yapgvb
>  >  Traceback (most recent call last):
>  >  ...
>  >  ImportError: No module named yapgvb
>  >
>  >  sage: import sys
>  >  sage: sys.path.append('/usr/lib/python2.4/site-packages')
>  >  sage: import yapgvb
>  >  /usr/lib/python2.4/site-packages/yapgvb/__init__.py:20:
>  >  RuntimeWarning: Python C API version mismatch for module _yapgvb: This
>  >  Python has API version 1013, module _yapgvb has version 1012.
>  >   from _yapgvb import *
>  >
>
>
>  I forgot to mention this...
>
>  sage: version ()
>  'SAGE Version 3.0, Release Date: 2008-04-22'
>
>  [EMAIL PROTECTED]:~$ uname -a
>  Linux sage 2.6.17-12-386 #2 Tue Dec 18 02:08:33 UTC 2007 i686 GNU/Linux
>
>  And you would need to apt-get the package:
>  [EMAIL PROTECTED]:~$ sudo apt-get install yapgvb
>
>
>
>  --
>   Hector
>
>  >
>

--~--~-~--~~~---~--~~
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: parenthesis matching in notebook environment

2008-04-22 Thread Mike Hansen

Hi,

Do you know a good example of an javascript text editor that does
this?  If you could search around, that would be most helpful.  The
biggest concern is probably the impact on performance; it's the same
issue with things like syntax highlighting.

--Mike

On Tue, Apr 22, 2008 at 1:21 AM, pong <[EMAIL PROTECTED]> wrote:
>
>  I wonder if there is any parenthesis matching function in SAGE
>  notebook environment (like that in Emacs). It is helpful in typing an
>  instruction with severals nested parenthesis.
>
>  If this has been implemented, how how to invoke it? If not, I hope
>  this will be implemented in later versions of SAGE.
>  >
>

--~--~-~--~~~---~--~~
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: Python decorators to implement Maple's "options remember"

2008-04-21 Thread Mike Hansen

Hello,

Sage already has two decorators that provide this functionality.

@func_persist will remember the computed values across Sage sessions
since the results are written to a file
@CachedFunction just stores the results in memory

Note that all of the arguments to the function whose results you want
to cache must be hashable.

--Mike


On Mon, Apr 21, 2008 at 1:40 PM, BFJ <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  I ran across the following post and thought I would pass it along.
>
>  http://avinashv.net/2008/04/python-decorators-syntactic-sugar/
>
>  For those of us who were weened on Maple, the post describes a very
>  nice way to get the "options remember" functionality that is built
>  into Maple in python (and Sage). Maybe there is another (or a better)
>  way to do this in Sage proper, but I couldn't find one looking through
>  the documentation.
>
>  For those that don't know what "options remember" does in Maple, it is
>  a declaration in a proc which tells Maple to build an "input" ->
>  "output" dictionary for the proc. So if you call a proc you've defined
>  with an input for the first time, it calculates it as usual. The
>  second time you call the proc with the same input, it just looks up
>  the output from the table, bypassing the possibly time consuming
>  calculation. This is very useful in alot of computational situations,
>  especially combinatorial functions that are defined recursively (like
>  the fibonacci example given and profiles in the post above).
>
>  -BFJ
>
>  >
>

--~--~-~--~~~---~--~~
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: Evaluate matrix

2008-04-20 Thread Mike Hansen

Hi Aleks,

You can just treat m as any symoblic expression and call it as a function.

sage: x,y = var('x,y')
sage: m = matrix([[cos(x),0],[0,-sin(y)]])
sage: m
[ cos(x)   0]
[  0 -sin(y)]
sage: m(x=1, y=2)
[ cos(1)   0]
[  0 -sin(2)]
sage: m.variables()
(x, y)
sage: m(1,2)
[ cos(1)   0]
[  0 -sin(2)]

--Mike

--~--~-~--~~~---~--~~
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: Posets or others

2008-04-16 Thread Mike Hansen

On Wed, Apr 16, 2008 at 5:40 PM, kcrisman <[EMAIL PROTECTED]> wrote:
>
>  Dear Group,
>
>  What support is there for posets and/or totally ordered sets in Sage?
>  It doesn't seem to be in the Reference manual.  Nor is it in the
>  Python documentation, but it seems like in order to do sorting Python
>  must have some sort of built-in ordering support, so my guess is I'm
>  just missing something, either in Sage or Python.
>
>  I'm just looking for a URL pointing to any info on this.  Thanks,
>  - kcrisman

What do you want to do with posets?

Franco Saliola and Peter Jipsen have been working on adding some
support for working with posets in Sage, but I don't know the status
of their work.

--Mike

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

2008-04-07 Thread Mike Hansen

Hi Becky,

Did you have a particular group in mind?

--Mike

On Mon, Apr 7, 2008 at 3:19 PM, Becky <[EMAIL PROTECTED]> wrote:
>
>  Is there a command for SAGE to write an element of a group in terms of
>  the group's generators?
>  -Becky
>  >
>

--~--~-~--~~~---~--~~
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: code to find roots no longer works

2008-04-07 Thread Mike Hansen

Hi,

The issue is that .roots() now returns tuples with the root and its
multiplicity.  You can see this if you look at v.  You need to select
the 0th entry of the tuple to raise to a power.

sage: RDF = RealDoubleField()
sage: R. = PolynomialRing(RDF)
sage: # Let y be x^(1/9).
sage: f = y + RDF(2^(8/9) - 2^(1/9))*(y^9-1) - y^8
sage: v = f.roots(); v
[(0.925874712287, 1), (1.0, 1), (1.08005973889, 1)]
sage: [a[0]^9 for a in v]
[0.5, 1.0, 2.0]

--Mike


On Mon, Apr 7, 2008 at 2:06 PM, John P. Burkett <[EMAIL PROTECTED]> wrote:
>
>  Last September I asked how to use SAGE to find the roots of
>  f = x^(1/9) + (2^(8/9) - 2^(1/9))*(x - 1) - x^(8/9).
>  William Stein then kindly offered the following code:
>  sage: RDF = RealDoubleField()
>  sage: R. = PolynomialRing(RDF)
>  sage: # Let y be x^(1/9).
>  sage: f = y + RDF(2^(8/9) - 2^(1/9))*(y^9-1) - y^8
>  sage: v = f.roots(); v
>  sage: [a^9 for a in v]
>
>  This code worked well on my machines when I first tried it.  However,
>  today in SAGE 2.11 the same code running on the same machines produces
>  the following error message:
>
>   Traceback (most recent call last)
>
>  /home/john/ in ()
>
>  /home/john/integer.pyx in sage.rings.integer.Integer.__pow__()
>
>  : unsupported operand type(s) for ** or
>  pow(): 'tuple' and 'int'
>
>  I would be very grateful for ideas about what has gone wrong and how to
>  fix it.
>
>  Best regards,
>  John
>  --
>  John P. Burkett
>  Department of Environmental and Natural Resource Economics
>  and Department of Economics
>  University of Rhode Island
>  Kingston, RI 02881-0808
>  USA
>
>  phone (401) 874-9195
>
>  >
>

--~--~-~--~~~---~--~~
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: [sage-devel] Re: [sage-support] PDE and Finite Element methods

2008-04-07 Thread Mike Hansen

On Mon, Apr 7, 2008 at 6:25 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>  Yes, I did. This is the code developed by people at Simula. It works
>  nice, but it's quite difficult to install. I generally prefer smaller
>  tools, if I can get the job done.
>
>  Ondrej

Other than size and build issues, are the two projects equivalent
feature / speed-wise?

--Mike

--~--~-~--~~~---~--~~
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: Getting Started Questions

2008-04-06 Thread Mike Hansen

Hi James,
Hello,

On Sun, Apr 6, 2008 at 1:33 PM, James Hart <[EMAIL PROTECTED]> wrote:
>
>  How should I be formatting this tuple if I want it to plot each graph
>  in a different color but in the same plot graph?
>  It works when it's all the same color i.e.

The idiom that Sage uses is to construct all of the individual graphs
separately and then combine them together with "+".  Here is some code
that will produce the plot you want:

sage: a = (sin(x)^2, cos(x)^2, sin(x)^2+cos(x)^2)
sage: color = ('red', 'blue', 'purple')
sage: min_x = 0
sage: max_x = 2*pi
sage: y = sum([plot(a[i], min_x, max_x, rgbcolor=color[i]) for i in range(3)])
sage: y.show()

>  Also: How do I comment out a line of code in the command line?
>  i.e. in PHP or java it is
>
>// Line of code here is commented

To comment out a line in Python, you use "#".

--Mike

--~--~-~--~~~---~--~~
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: sage -notebook

2008-04-06 Thread Mike Hansen

Hi Chris,

The problem is due to the way sage -notebook is handling options
passed to it.  This was pointed out to me by stefanv on IRC last
night.  I've made the following ticket for it
http://trac.sagemath.org/sage_trac/ticket/2827.

You can pass arbitrary strings to run with "sage -c".  For example,

[EMAIL PROTECTED]:~$ sage -c "s = SFASchur(QQ); print s([2,1])^2"
s[2, 2, 1, 1] + s[2, 2, 2] + s[3, 1, 1, 1] + 2*s[3, 2, 1] + s[3, 3] +
s[4, 1, 1] + s[4, 2]

--Mike

On Sun, Apr 6, 2008 at 2:55 AM, Chris Chiasson <[EMAIL PROTECTED]> wrote:
>
>  I would like to use
>
>  sage -notebook
>
>  or a similar command to start my sage notebook server on boot from a
>  startup script. However, just using sage -notebook won't work. I need
>  to pass the address option on the command line.
>
>  sage -notebook address="$(cat /etc/hostname)"
>
>  ain't workin. I keep running into OSError, permission denied, etc.
>
>  Neither is
>
>  sage -notebook address=chiasson.name
>
>  Any ideas?
>
>  In general, how can arbitrary commands be passed to sage from the
>  command line? I'm not talking about communicating with an already
>  running sage process, just passing commands to execute at startup.
>
>  Thank you for your time.
>  >
>

--~--~-~--~~~---~--~~
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: feature request ...

2008-04-03 Thread Mike Hansen

Hello,

>  sage: r = matrix(SR, 4, 4, [[21,17,6,8], [-5,-1,-6,-3], [4,4,16,2],
>  [2,3,-4,-1]])
>  sage: r.exp()
>  .

This is happening since Maxima is failing to do the computation for
reasons that I don't know.  I suppose it wouldn't be too difficult to
write our own matrix exponentiation.

--Mike

--~--~-~--~~~---~--~~
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: Genus calculation

2008-04-03 Thread Mike Hansen

Hello,

I think something like the following should get you going in the right
direction:

sage: delta = lambda m, n: (m-1)*(n-1)/2 + gcd(m,n)-1/2
sage: m = 3
sage: n = 2
sage: for m_part in Partitions(m):
:for n_part in Partitions(n):
:print "%s, %s"%(m_part, n_part)
:for mi in m_part:
:for ni in n_part:
:print "delta(%s,%s) = %s"%(mi,ni,delta(mi,ni))
:
[3], [2]
delta(3,2) = 3/2
[3], [1, 1]
delta(3,1) = 1/2
delta(3,1) = 1/2
[2, 1], [2]
delta(2,2) = 2
delta(1,2) = 1/2
[2, 1], [1, 1]
delta(2,1) = 1/2
delta(2,1) = 1/2
delta(1,1) = 1/2
delta(1,1) = 1/2
[1, 1, 1], [2]
delta(1,2) = 1/2
delta(1,2) = 1/2
delta(1,2) = 1/2
[1, 1, 1], [1, 1]
delta(1,1) = 1/2
delta(1,1) = 1/2
delta(1,1) = 1/2
delta(1,1) = 1/2
delta(1,1) = 1/2
delta(1,1) = 1/2

You just need to combine the individual deltas in the appropriate way.

--Mike

On Thu, Apr 3, 2008 at 3:17 PM, Erick Galinkin <[EMAIL PROTECTED]> wrote:
>
>  Mike,
>  Thank you for responding!
>
>  delta is calculated by taking:
>
>  delta(m,n) = ((m-1)(n-1)/2)+(gcd(m,n)-1/2)
>
>  The issue I'm running into is getting sage to cycle these partitions
>  through this calculation. I can get the partitions and do it all by
>  hand, but that's an awful pain.
>
>  ~Erick
>
>
>
>  On Apr 3, 5:51 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
>  > Hi Erick,
>  >
>  > How do you calculate the delta invariant?  (This is not my area of
>  > math.)  How large of m and n do you want to work with?  For example,
>  > here is some Sage code to generate all the integer partitions of 40:
>  >
>  > sage: time l = Partitions(40).list()
>  > CPU times: user 0.50 s, sys: 0.03 s, total: 0.53 s
>  > Wall time: 0.56
>  > sage: len(l)
>  > 37338
>  > sage: l[:5]
>  > [[40], [39, 1], [38, 2], [38, 1, 1], [37, 3]]
>  >
>  > --Mike
>
>
> >
>

--~--~-~--~~~---~--~~
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: Genus calculation

2008-04-03 Thread Mike Hansen

Hi Erick,

How do you calculate the delta invariant?  (This is not my area of
math.)  How large of m and n do you want to work with?  For example,
here is some Sage code to generate all the integer partitions of 40:

sage: time l = Partitions(40).list()
CPU times: user 0.50 s, sys: 0.03 s, total: 0.53 s
Wall time: 0.56
sage: len(l)
37338
sage: l[:5]
[[40], [39, 1], [38, 2], [38, 1, 1], [37, 3]]


--Mike

--~--~-~--~~~---~--~~
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: feature request ...

2008-04-02 Thread Mike Hansen

Hi Georg,

There is currently support for taking the matrix exponential of a
symbolic matrix already in Sage since it is using Maxima in the
background.  I suppose that this should be extended to other types of
matrices.

sage: matrix(SR, 3, 3, [[21,17,6],[-5,-1,-6],[4,4,16]]).exp()

[  (13*e^16 - e^4)/4 (13*e^16 - 5*e^4)/4  (e^16 - e^4)/2]
[   (e^4 - 9*e^16)/4  (5*e^4 - 9*e^16)/4  (e^4 - e^16)/2]
[ 4*e^16  4*e^16e^16]


What functionality did you envision having in a symmetric matrix class?

--Mike

--~--~-~--~~~---~--~~
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: SAGE-2.10.4 Install Problems

2008-03-31 Thread Mike Hansen

Hi Daryl,

>  ---
>  Problem 1: TEST FAILURE

This was a known problem (
http://trac.sagemath.org/sage_trac/ticket/2722 ). It was fixed in Sage
2.11 which was released today.

>  
> --
>  Problem 2: SELinux
>
>  The following command will allow this access:
>  chcon -t textrel_shlib_t /home/daryl/sage-2.10.4/local/lib/libpari-
>  gmp.so.2

Thanks, I've added this to the FAQ at http://wiki.sagemath.org/faq


>  ---
>  Problem 3 Documentation build
>
>  Finally I build the documentation with:
>  cd sage-2.10.4/devel/doc
>  ./rebuild
>

I'm not exactly sure what's going on here.  Someone more familiar with
the documentation system might be able to shed some insight.

--Mike

--~--~-~--~~~---~--~~
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: Problem to access C code

2008-03-30 Thread Mike Hansen

Hello,

What version of Sage are you using?  I tried this on my local machine
and can't duplicate the error that you're getting.

--Mike

On Sun, Mar 30, 2008 at 12:44 PM, bourba <[EMAIL PROTECTED]> wrote:
>
>  Hello.
>
>  I would like to access external C code so I have
>  exactly followed the example exposed in
>  http://www.sagemath.org/doc/html/tut/node51.html
>  (5.2.1 Accessing C Functions in Separate Files)
>
>  My directory "/home/mainuser/test_sage" contains
>  "test.c" plus "test.spyx" and when I type :
>
>  sage : load "/home/mainuser/test_sage/test.spyx"
>
>  then sage returns this error message:
>
>  Loading of file "/home/mainuser/test_sage/test.spy" has type not
>  implemented.
>
>  Thanks.
>
>  >
>

--~--~-~--~~~---~--~~
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: typesetting matrices

2008-03-29 Thread Mike Hansen

AFAIK, you can't use LaTeX packages with jsmath.  It just implements
the standard mathmode.

--Mike

On Sat, Mar 29, 2008 at 1:18 PM, Jason Grout
<[EMAIL PROTECTED]> wrote:
>
>  gerhard wrote:
>  > closely related question:
>  > I wanted to use easymat for a matrix display. jsmath seems to support
>  > it.
>  > Is there an easy way to add the required \usepackage command?
>  >
>
>  The easymat package looks great!  I'll probably be using it soon.
>
>  When you say jsmath seems to support it, what do you mean?  Can you give
>  an example?
>
>  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: random questions

2008-03-27 Thread Mike Hansen

Hello,

>  1.  The solve wrapper of maxima does some nice stuff symbolically, but
>  of course it can't handle everything, like
>
>  sage: solve(x^5-x-12,x)
>  [0 == x^5 - x - 12]
>
>  which makes sense!  But I poked around a little for a numerical
>  approximation of solutions command and didn't find it.  This probably
>  means I just didn't look in the right places - any ideas?  I
>  understand Mathematica calls this sort of thing nsolve, but I really
>  don't know.

Your best is to use Sage's actual polynomial objects instead of
symbolic expressions (if you're just interested in polynomial
expressions).

sage: R. = ZZ[]
sage: a = y^5 - y - 12
sage: a.roots(RR)
[(1.68758384186451, 1)]
sage: a.roots(CC)

[(1.68758384186451, 1),
 (0.472524075221555 + 1.59046294160722*I, 1),
 (0.472524075221555 - 1.59046294160722*I, 1),
 (-1.31631599615381 + 0.922151856490895*I, 1),
 (-1.31631599615381 - 0.922151856490895*I, 1)]

If you want to use symbolic expressions, you can use the .find_root() method.

sage: a = x^5 - x - 12
sage: a.find_root(0,2)
1.6875838418645157


>  2.  How far does Sage recognize complex numbers a priori?  For
>  instance,
>
>  sage: abs(1+i)
>  sqrt(2)
>
>  but pretty much anything else doesn't seem to recognize it, as indeed

Sage on startup predefines i in the same way it predefines x. (This is
in sage.all_cmdline and sage.all_notebook.) Here's what's going on:

sage: j = I()
sage: abs(1+j)
sqrt(2)


>  A followup would be to ask if any of those functions have functional
>  notation; there are lots of functions for CC, but they mostly seem to
>  use object notation.

What methods did you have in mind?

>
>  3.  I remember that at some point implicit coefficient multiplication
>  was implemented, e.g.

Implicit multiplication is turned off by default.  You can turn it on:

sage: implicit_multiplication(True)
sage: 2x
2*x

--Mike

--~--~-~--~~~---~--~~
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: solve()

2008-03-24 Thread Mike Hansen

I don't know of any way to do it using solve().  What you're really
wanting to do is use the Chinese Remainder Theorem.  After removing
redundant equations, you can do the following:

sage: a = [2,3,4]
sage: b = [3,4,5]
sage: CRT_list(a,b)
59
sage: lcm(b)
60

That being said, I think the behavior of CRT_list should be the following:

sage: CRT_list([1,2,3,4,5],[2,3,4,5,6])
(59, 60)

--Mike

On Mon, Mar 24, 2008 at 3:37 PM, felix <[EMAIL PROTECTED]> wrote:
>
>  Hello,
>
>  I have a system of 5 equations:
>
>  x=2*a+1
>  x=3*b+2
>  x=4*c+3
>  x=5*d+4
>  x=6*e+5
>
>  a,b,c,d,e,x are integers variables.
>
>
>  I would solve the system with solve().
>
>  1)How to declare that solve have to assume x,a,b,c,d,e as integers?
>
>  The answer is k*60+59  k integer.
>
>  Can Sage with the solve function resolve this type of system?
>
>  Thank you.
>
>
>  >
>

--~--~-~--~~~---~--~~
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: MAC PC configuration problem.

2008-03-05 Thread Mike Hansen

Hi Neal,

When you start up the notebook on the Mac, pass the option
server='192.168.1.103' and then you should able to access it on you
Windows box by going to https://192.168.1.103:8000 .  Let me know if
that works.

--Mike

On Wed, Mar 5, 2008 at 8:06 AM, Neal <[EMAIL PROTECTED]> wrote:
>
>  I have just installed SAGE on my MAC book, and it works fine there.
>  But I would like to use it from my desk PC (Windows XP). The PC has a
>  bigger display. I opened Firefox on the PC, entered the local IP
>  address of the MAC (192.168.1.103) and I get an acknowledgment from
>  the Apache Web server. Then I tried 192.168.1.103:8000, trying to
>  connect with the SAGE session running on my MAC. No luck. It times
>  out.
>
>  I have tried variations like 192.168.1.103/localhost:8000 and several
>  other combinations, but no luck. The Apache response tells me
>  something is working; I just haven't managed to reach SAGE yet.
>
>  >
>

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

2008-03-04 Thread Mike Hansen
On Tue, Mar 4, 2008 at 8:03 PM, dean moore <[EMAIL PROTECTED]> wrote:
> I'm trying to spline the unit circle.  The graph looks like a polynomial,
> not a fit to
> the unit circle.
>

Well, you're going to have some problems using spline since it does a
univariate polynomial spline interpolation.  What you really want to
do is do a spline on each of the coordinates and then do a parametric
plot of those two splines:

v = []  # Will hold points
step  = 0.5 # "Fineness" of my approximation
for x in srange(0, 2*pi, step): # Fill parameter *v* with points
   v.append((cos(x), sin(x)))   # on the unit circle.

x_spline = spline([(RDF(i)/len(v), v[i][0]) for i in
range(len(v))]+[(1,v[0][0])])
y_spline = spline([(RDF(i)/len(v), v[i][1]) for i in
range(len(v))]+[(1,v[0][1])])
parametric_plot((x_spline, y_spline),0,1)

--Mike

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

2008-03-04 Thread Mike Hansen

Maybe I'm missing something, but what is your question?

--Mike

On Tue, Mar 4, 2008 at 12:00 PM, dean moore <[EMAIL PROTECTED]> wrote:
> Playing with splines for other reasons, I found what I beat down to the
> following snippet (see attached)
>
> v = []  # Will hold points
> step  = 0.5 # "Fineness" of my approximation
>  for x in srange(0, 2*pi, step): # Fill parameter *v* with points
>v.append((cos(x), sin(x)))   # on the unit circle.
>
> show(points(v, rgbcolor=(1,0,0), pointsize=20) +
>  plot(spline(v), rgbcolor=(0,0,1)))
>
> "Aha!", I thought, "I'm being clueless.  No one splines a parametric curve."
> But curious, I did some
> googleing.
>
> At < http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ > there is a nice
> example at "Figure 3," as there is at
>  < http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ > at "Curve fitting
> and fairing using conic splines."
>
> Glanced at a couple SAGE pages, <
> http://www.sagemath.org/doc/html/ref/module-sage.plot.plot.html > &
>  <
> http://www.sagemath.org/doc/html/ref/module-sage.plot.plot3d.list-plot3d.html
> >, but nothing seemed
> helpful.
>
> Thanks for any ideas.
>
> Dean
>
>
>  >
>

--~--~-~--~~~---~--~~
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: Why does "==" not return True or False?

2008-02-08 Thread Mike Hansen

Hello,

> You and John explained that "x==x" returns an equation since the
> underlying maxima system does.
> So, why does maxima('x')==maxima('x') return True?
> And why maxima('x==x') freezes?

When John said that the underlying system (maxima) uses that
construction, he didn't mean it _literally_.  "x==x" isn't even valid
Maxima syntax -- it gives a syntax error.  Sage is having trouble
detecting it for some reason so that is indeed a bug, but probably not
what you were thinking of.  I've made a ticket for this at
http://trac.sagemath.org/sage_trac/ticket/2109 .

If you have a better proposal for handling symbolic equations, I'm
sure people would be more than willing to listen to it.  While I don't
really use the symbolic stuff, I personally think the current way of
handling things is very natural and quite usable.

> Automatic simplification is one thing. But is there an explicit way to
> explicitly change an element of the fraction field of QQ[x] into a
> canonical form (i.e., two elements are equal iff the canonical forms
> are identic)? Note that "simplify" doesn't do it.

Like I mentioned in my previous email, no such canonical form has been
decided on.  (If you look at the implementation for equality testing
in that ring, it cross multiplies numerators and denominators and
check for equality in QQ['x'].)

--Mike

--~--~-~--~~~---~--~~
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: Why does "==" not return True or False?

2008-02-08 Thread Mike Hansen

Hi Simon,

> That's to say, the expressions are displayed in the same canonical
> form, but "==" does not return True.

This is the desired behavior in Sage with symbolic objects -- it
returns the equation you specified.  You can get a Boolean with
bool().

sage: eq = ((-x^4-1)/(x^2)) == ((x^4+1)/((-1)*x^2)); eq
(-x^4 - 1)/x^2 == (-x^4 - 1)/x^2
sage: bool(eq)
True
sage: if eq:
: print "This is True."
:
This is True.

> sage: Ring=PolynomialRing(QQ,'x')
> sage: x=Ring('x')
> sage: ((-x^4-1)/(x^2))
> (-x^4 - 1)/x^2
> sage: ((x^4+1)/((-1)*x^2))
> (x^4 + 1)/-x^2
> Why are these expressions not turned into a canonical form, in
> contrast to above? And how can i achieve such canonical form?

The objects you are working with here are elements of a generic
implementation of fraction fields.  I'm actually dealing with this
issue now since I'm doing some work with rational functions.  For
Frac(QQ['x']), I'm just clearing denominators and removing common
non-unit integers in order to keep coefficients "small".  But, this is
just a choice for a canonical form.  Magma, for example, makes it so
that the denominator is always monic.  No such choice has been made in
Sage primarily because it (nor the best way to implement it) has not
been discussed.

--Mike

P.S. The "Sage way" to make your ring would probably be the following:

sage: R. = QQ[]
sage: R
Univariate Polynomial Ring in x over Rational Field
sage: x.parent()
Univariate Polynomial Ring in x over Rational Field

or in pure Python:

sage: R = QQ['x']; x = R.gen()

--~--~-~--~~~---~--~~
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: Help with Sage install

2008-02-06 Thread Mike Hansen

Hi Jimmy,

It looks like you downloaded the 10.5 (Leopard) binary when you are
running OS X 10.4 (Tiger).  If this is the case, then you should try
downloading the binary for 10.4.

--Mike

On Feb 6, 2008 5:09 PM, Jimmy Crockett <[EMAIL PROTECTED]> wrote:
>
> > I downloaded Sage and followed steps in "Read Me" file and get the
> following:
> >
> >
> >
> > Last login: Sat Jan 19 19:05:11 on console
> > /Applications/sage/sage; exit
> > Welcome to Darwin!
> > Macintosh-2:~ z$ /Applications/sage/sage; exit
> > --
> > | SAGE Version 2.10, Release Date: 2008-01-18|
> > | Type notebook() for the GUI, and license() for information.|
> > --
> >
> ---
> >Traceback (most recent call
> last)
> >
> >
> > /Applications/sage/local/bin/ in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/preparser_ipython.py
> in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/interpreter.py
> in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/log.py
> in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/latex.py
> in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/misc.py
> in ()
> >
> >
> > :
> dlopen(/Applications/sage/local/lib/python2.5/site-packages/sage/misc/misc_c.so,
> 2): Symbol not found: _close$UNIX2003
> >   Referenced from: /Applications/sage/local/lib//libpari-gmp.dylib
> >   Expected in: flat namespace
> >
> >
> > WARNING: Failure executing code: 'import sage.misc.preparser_ipython;
> sage.misc.preparser_ipython.magma_colon_equals=True'
> > WARNING: Readline services not available on this platform.
> > WARNING: The auto-indent feature requires the readline library
> > WARNING: Proper color support under MS Windows requires the pyreadline
> library.
> > You can find it at:
> > http://ipython.scipy.org/moin/PyReadline/Intro
> > Gary's readline needs the ctypes module, from:
> > http://starship.python.net/crew/theller/ctypes
> > (Note that ctypes is already part of Python versions 2.5 and newer).
> >
> >
> > Defaulting color scheme to 'NoColor'
> >
> ---
> >Traceback (most recent call
> last)
> >
> >
> > /Applications/sage/local/bin/ in ()
> >
> >
> >
> /Users/was/build/sage-2.10/local/lib/python2.5/site-packages/sage/misc/misc.py
> in ()
> >
> >
> > :
> dlopen(/Applications/sage/local/lib/python2.5/site-packages/sage/misc/misc_c.so,
> 2): Symbol not found: _close$UNIX2003
> >   Referenced from: /Applications/sage/local/lib//libpari-gmp.dylib
> >   Expected in: flat namespace
> >
> >
> > 
>
>
>  >
>

--~--~-~--~~~---~--~~
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: Error calling plots.

2008-02-04 Thread Mike Hansen

Hello,

> /usr/lib/firefox/firefox-bin: symbol lookup error: /usr/lib/libxml2.so.
> 2: undefined symbol: gzopen64

This looks like this bug:
https://bugs.launchpad.net/ubuntu/+source/libxml2/+bug/151045

--Mike

--~--~-~--~~~---~--~~
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: Taylor series of a matrix

2008-02-02 Thread Mike Hansen

> To easily see the coefficients of each
> term in the taylor polynomial?

Yes, that would be the reason why in this case.

--Mike

--~--~-~--~~~---~--~~
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: Taylor series of a matrix

2008-02-02 Thread Mike Hansen

Hello,

Here is an example of the underlying problem

sage: a = -x/(2*x-4)
sage: e = lambda e: taylor(e,x,3,4)
sage: e(a)
-3/2 + x - 3 - (x - 3)^2 + (x - 3)^3 - (x - 3)^4
sage: type(_)

sage: b = e(a)._maxima_(); b
x-(x-3)^4+(x-3)^3-(x-3)^2-9/2

What happens is that is able to construct a SymbolicArithmetic object
that has things like they should be.  When it then reconstructs a
maxima object from that, maxima performs the simplification.

See ticket #2025

--Mike

On Feb 2, 2008 2:00 PM, pgdoyle <[EMAIL PROTECTED]> wrote:
>
>
>
> On Feb 1, 8:59 am, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > On Jan 31, 2008 7:59 AM, pgdoyle <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > On Jan 31, 12:29 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> >
> > > > On Jan 30, 2008 3:48 PM, pgdoyle <[EMAIL PROTECTED]> wrote:
> >
> > > > > I would like to take the Taylor series of a matrix.  But I find I
> > > > > can't even put a Taylor polynomial into a matrix without its being
> > > > > simplified.
> >
> > > > > sage: f=-x/(2*x-4); f
> > > > > -x/(2*x - 4)
> > > > > sage: g=taylor(f,x,1,1); g
> > > > > 1/2 + x - 1
> > > > > sage: matrix(1,[g])
> > > > > [x - 1/2]
> > > > > sage: m=matrix(1,[f]); m
> > > > > [-x/(2*x - 4)]
> > > > > sage: m.apply_map(lambda e: taylor(e,x,1,1))
> > > > > [x - 1/2]
> >
> > > > > Any suggestions?
> >
> > > > You're already doing it exactly correctly.  Try a higher degree
> > > > approximation to avoid confusion:
> >
> > > > sage: m = matrix(1,[-x/(2*x-4)])
> > > > sage: m.apply_map(lambda e: taylor(e,x,1,4))
> > > > [x + (x - 1)^4 + (x - 1)^3 + (x - 1)^2 - 1/2]
> >
> > > William:
> >
> > > Sorry - I didn't make the issue clear enough.  When I ask for the
> > > Taylor polynomial at x=1, I want a polynomial in x-1.  And that's what
> > > I get, except that when I put this polynomial into a matrix, 1/2 + x -
> > > 1 gets simplified to x-1/2.  Your example shows this behavior very
> > > clearly.
> >
> > That's weird.  Most of the polynomial is not simplified except the -1/2 is
> > moved to the end.  Note that the rest of the terms stay put.  I wonder
> > why Maxima does that.  (No clue.)  Note that it isn't a complete loss; all
> > the other terms remain exactly as you wanted.
> >
>
> It's not just that the constant term gets moved:  The 1/2 gets
> combined with the -1 in the linear term x-1.
>
> Also, I don't see how this could be the fault of Maxima:
>
> sage: %maxima
> sage: f:taylor(-x/(2*x-4),x,1,5)
> sage: m:[f]
> sage: m*2
> 1/2+(x-1)+(x-1)^2+(x-1)^3+(x-1)^4+(x-1)^5
> [1/2+(x-1)+(x-1)^2+(x-1)^3+(x-1)^4+(x-1)^5]
> [1+2*(x-1)+2*(x-1)^2+2*(x-1)^3+2*(x-1)^4+2*(x-1)^5]
>
> Note how Maxima has the terms in the expected order for a power
> series, and preserves this order, without doing any simplification,
> when putting it the expression into a matrix.
>
> Cheers,
>
> Peter
>
> > sage: m = matrix(1,[-x/(2*x-4)])
> > sage: m.apply_map(lambda e: taylor(e,x,0,4))
> > [x^4/32 + x^3/16 + x^2/8 + x/4]
> > sage: m.apply_map(lambda e: taylor(e,x,0,4))
> > [x^4/32 + x^3/16 + x^2/8 + x/4]
> > sage: m.apply_map(lambda e: taylor(e,x,1,4))
> > [x + (x - 1)^4 + (x - 1)^3 + (x - 1)^2 - 1/2]
> > sage: m.apply_map(lambda e: taylor(e,x,2,4))
> > [-1/(x - 2) - 1/2]
> > sage: m.apply_map(lambda e: taylor(e,x,3,4))
> > [x - (x - 3)^4 + (x - 3)^3 - (x - 3)^2 - 9/2]
> > sage: m[0,0].taylor(x,3,4)
> > -3/2 + x - 3 - (x - 3)^2 + (x - 3)^3 - (x - 3)^4
> >
> > I'm sure this can be fixed, so I've made a bug report:
> >
> > http://trac.sagemath.org/sage_trac/ticket/2025
> >
> >  -- William
> >
>
>
> >
>

--~--~-~--~~~---~--~~
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: old SAGE link at MSRI

2008-01-24 Thread Mike Hansen

I will ask people in the computing department tomorrow.

--Mike

On Jan 24, 2008 5:15 PM, David Joyner <[EMAIL PROTECTED]> wrote:
>
> Hi:
> Just curious if there a way to update the SAGE link at
> http://www.msri.org/about/computing/mathdocs
> - David Joyner
>
> >
>

--~--~-~--~~~---~--~~
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: Putting parentheses around -1.

2008-01-23 Thread Mike Hansen

It is due to the fact that ^ has a higher precedence than - in Python.
n(-1^(1/3)) is the same as n((-1^(1/3))).
--Mike

On Jan 23, 2008 5:04 PM, Ted Kosan <[EMAIL PROTECTED]> wrote:
>
> Does anyone have any thoughts on why the following 2 code samples give
> different results?:
>
> #SAGE Version 2.10, Release Date: 2008-01-18
>
>
> sage: n(-1^(1/3))
> -1.00
>
> sage: n((-1)^(1/3))
> 0.500 + 0.866025403784439*I
>
> The only difference between them is that parentheses have been placed around 
> -1.
>
> Thanks,
>
> Ted
>
> >
>

--~--~-~--~~~---~--~~
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: Elementary symmetric function expansion (bug?)

2008-01-20 Thread Mike Hansen

Hello,

It turns out that symmetrica internal representation of the result has
three variables (although the last one isn't used).  The wrappers for
symmetrica live under sage/libs/symmetrica .  I've made this
http://trac.sagemath.org/sage_trac/ticket/1873 and posted a patch
there.  The solution was to provide a way to override the
"autodetection" of the number of variables.  You can see this at the
end of the patch (the changes were made to symmetrica.pxi).

--Mike

On Jan 20, 2008 12:34 PM, BFJ <[EMAIL PROTECTED]> wrote:
>
> After looking into this a little bit, and getting my hands dirty
> looking through the code, I've tracked the problem to the following
> example. The expand() method in
> SymmetricFunctionAlgebraElement_elementary calls
> symmetrica.compute_elmsym_with_alphabet([3],3,'x') and it seems to me
> that the return value of the call is being interpreted in a ring
> that's too big. Consider:
>
> sage: r=symmetrica.compute_elmsym_with_alphabet([3],3,'x')
> sage: r
> x0*x1*x2
> sage: r.parent()
> Multivariate Polynomial Ring in x0, x1, x2, x3 over Integer Ring
>
> Maybe someone can look into this, or if everyone is busy, maybe
> someone can tell me where to look at how values returned from
> symmetrica are interpreted and perhaps I can provide a patch.
>
> Thanks,
> BFJ
>
>
> >
>

--~--~-~--~~~---~--~~
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: SAGE at ISP etc

2008-01-19 Thread Mike Hansen

Hello,

>I happen to have lots of space on an ISP site which I administer.
> Is it possible to unarchive the sage package in the public_html folder
> and start sage with a .php script to host educational notebooks?

If you have shell acess on your ISP's machine than it's probably possible.

>I used  to use Texmacs for the rendering of formulas generated by
> any of the softwares , including scilab.  Why is it not possible to
> render formulaes ( I guess using TeX fonts ) as in Texmacs in Sage
> without the jsMath fonts?

I wrote a TeXmacs plugin for Sage which should now be included in the
latest version of TeXmacs.  See http://wiki.sagemath.org/TeXmacs

--Mike

--~--~-~--~~~---~--~~
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: exponentiation bug?

2008-01-18 Thread Mike Hansen

On Jan 18, 2008 12:24 PM, Georg Grafendorfer
<[EMAIL PROTECTED]> wrote:
> OK, thanks, so sage-python just refers to the "sage-version" of python
> instead of the systems own python version and nothing else !?

Correct.

--Mike

--~--~-~--~~~---~--~~
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: exponentiation bug?

2008-01-18 Thread Mike Hansen

Hello,

When you call, ./example.sage, it is being run by the Python
interpreter with no preparsing done at all.  Thus, 2^3 corresponds is
interpreted as Python interprets it (not exponentiation).  When you do
"load example.sage", then it is preparsed by Sage, and your '^' gets
changed to a "**" in the background.  When it is preparsed, you should
be able to find an example.py file which can then be run by a normal
Python interpreter.

--Mike

On Jan 18, 2008 11:55 AM, Georg <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> following script example.sage (sage-2.9.3):
>
> #!/usr/bin/env sage-python
> print 2^3
> print 2**3
>
> outputs:
> $ ./example.sage
> 1
> 8
>
> while
>
> sage:load "example.sage"
> 8
> 8
>
> works as expected.
>
> Is this a bug or something one should consider when writing sage
> scripts?
> Or is it due to the problem that "#!/usr/bin/env sage -python" as
> first line (note the space between sage and -python) does not work on
> my system (Debian Etch)...
>
> thanks, Georg
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: show doesn't work under Ubuntu 7.10

2008-01-17 Thread Mike Hansen

Hello,

It looks like this was fixed in 2.10 which will be out in a few hours.
 The ticket can be found here:
http://sagetrac.org/sage_trac/ticket/975  The Sage Trac server is
where we keep track of issues and development related things.

--Mike

On Jan 17, 2008 9:03 PM, Rick Pember <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am a Sage "newbie" but I'm convinced this is not a newbie issue:
>
> Just today, I both built version 2.9.3 and downloaded binary versions
> 2.9.1 and 2.9.2 to
> on an Intel Core Duo box running  Ubuntu 7.10.
>
> The symptom is that a command like
>
> show(g)
>
> simply returns with no action occurring. sage otherwise appears to
> work.
>
> I saw that the same problem was reported under sage-devel a couple of
> months ago
>
> http://groups.google.com/group/sage-devel/browse_thread/thread/78f8b6afea8ca8c8/bdaed94e646dca0a?lnk=gst&q=Ubuntu#bdaed94e646dca0a
>
> but did not see any resolution, other than a ticket number being
> assigned
> (How do tickets work? I couldn't find any info.)
>
> I was able to download sage on a remote machine and successfully
> execute "show" remotely, so I'm convinced the problem is not just an X
> display problem or a problem with my installation procedure.
> These other machines are not running Ubuntu.
>
> >
>

--~--~-~--~~~---~--~~
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: hang problem and type question

2008-01-17 Thread Mike Hansen

Hi Kate,

I actually just put a patch up for #1289 last night which should make
it into 2.10.  Here is the behavior with the patch:

sage: madness(10.0, exp)
 
'Life is sane.'
sage: madness(10, exp)
 
'Life is sane.'
sage: madness(10.0, log)
 
'Life is sane.'
sage: madness(10, log)
 
'Life is sane.'

Ahh... sanity :)

--Mike

On Jan 17, 2008 9:40 AM, Kate <[EMAIL PROTECTED]> wrote:
>
> The following function demonstrates a hang problem in 2.9.3 (and
> 2.10.alpha4)
> and a question about return types.
>
> Kate
>
> --
>
> def madness(n, func):
>   r"""
>   Test floor(func(n)) for strange behaviour...
>
>   EXAMPLES:
> sage: version()
> 'SAGE Version 2.9.3, Release Date: 2008-01-05'
>
> # one hangs
> sage: madness(10.0,exp)
>   'sage.rings.integer.Integer'>
> 'Life is sane.'
> sage:madness(10,exp)
>   'sage.rings.integer.Integer'>
> ... hangs indefinitely ...
>
> # One says Integer other says SymbolicComposition - is this
> expected?
> sage: madness(10.0,log)
>   'sage.rings.integer.Integer'>
> 'Life is sane.'
> sage: madness(10,log)
>   'sage.rings.integer.Integer'>
> 'This is madness.'  # In sage-2.10.alpha4 returns 'Life is sane'
>   """
>
>   ff = floor(func(n))
>   Iff = Integer(ff)
>   assert ff == Iff
>   print type(ff), type(Iff)
>
>   f = 0
>   while f < ff:
> f = f + 1
>
>   if f == ff:
> return "Life is sane."
>   else:
> return "This is madness."
>
> >
>

--~--~-~--~~~---~--~~
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: Elementary symmetric function expansion (bug?)

2008-01-16 Thread Mike Hansen

Hello,

It was an "on purpose" fix :)  I've added another doctest at
http://sagetrac.org/sage_trac/ticket/1797 .

--Mike

On Jan 16, 2008 1:30 PM, mabshoff
<[EMAIL PROTECTED]> wrote:
>
>
>
> On Jan 16, 10:23 pm, BFJ <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > First of all, I don't know whether to post about this here, or file a
> > bug report, or something else. I'm new to community developed
> > software. Let me know if this isn't the right place to report the
> > following.
> >
> > I'm using sage 2.9.2 and 2.9.3 on different (both PPC) machines, both
> > running OS X 10.4.
> > Consider the following commands which should expand an elementary
> > symmetric function as a polynomial in 3 variables:
>
> 
>
> Hi BJF,
>
> I can reproduce the problem with 2.9.3, but it is fixed in
> 2.10.alpha3:
>
> --
> | SAGE Version 2.10.alpha3, Release Date: 2008-01-14 |
> | Type notebook() for the GUI, and license() for information.|
> ------
>
> sage: sage: k=SFAElementary(QQ)
> sage: sage: f=k([2])
> sage: sage: f.expand(3)
> x0*x1 + x0*x2 + x1*x2
> sage:
>
> Mike Hansen did post a patch that was merged early on in 2.10.alpha2
> or so. He might be able to tell you if the bug was fixed "on purpose"
> or "by accident". 2.10 should be out by the weekend or maybe Monday.
> Alpha3 is available at
>
> http://sage.math.washington.edu/home/mabshoff/release-cycles-2.10/sage-2.10.alpha3.tar
>
> Mike: could you add a doctest that tests this behavior?
>
> > Similar commands, but on objects from SFASchur, SFAPower, SFAMonomial,
> > etc.., work perfectly. It seems to be only SFAElementary that has a
> > problem.
>
> > Thanks,
> >
> > BFJ
>
> 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Computations with Lie algebras?

2008-01-14 Thread Mike Hansen

Hi Kiran,

Adding good Lie algebra support to Sage has been something on my list
for awhile. I just made it out here to Berkeley and am going to be
here all semester for the program at MSRI.  I was that you were
registered for the workshop next week.  What time do you get in?  We
can discuss things there.  Also, if there is anything in symmetrica
that you'd like exposed just let me know and I can do that right away.

--Mike


On Jan 14, 2008 6:31 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Does SAGE currently include any functionality for manipulating Lie
> algebras? (I only need reductive Lie algebras, because I'm using them
> to study compact Lie groups.) For instance, I'd like to be able to
> manipulate irreducibles (encoded by their highest weights), so that I
> can form a tensor product and decompose it into irreducibles
>
> In specific instances (like GL_n) I know in principle to translate
> such questions into terms compatible with the combinatorics
> functionality we have from Symmetrica. But I want to experiment with
> other cases (like Sp_n) and I'd rather simply work at the Lie algebra
> level, without having to keep track of the combinatorics myself.
>
> In any case, I'm likely to be bugging people about this at SAGE Days
> 7...
>
> Kiran
>
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Symbolic computation is slow

2007-12-31 Thread Mike Hansen

Hello,

Sympy provides it's own matrices.  As mentioned before, there needs to
be more work done with sympy in Sage so that what you tried does work.
 In the meantime, look at the following example:

sage: import sympy
sage: x = sympy.Symbol('x')
sage: m = sympy.Matrix([[1,x],[x,1]])
sage: m
1 x
x 1
sage: m^int(2)
1 + x**2 2*x
2*x 1 + x**2

--Mike

On Dec 31, 2007 11:00 AM, pgdoyle <[EMAIL PROTECTED]> wrote:
>
>
> > > sage: var(x)
> > > x
> > > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).rational_simplify() for i
> > > in xrange(100))
> > > 200
> > > CPU time: 5.29 s, Wall time: 39.10 s
> > > sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,100)')
> > > 200
> > > CPU time: 0.02 s, Wall time: 0.55 s
> >
> > Those times above are really weird. On my laptop (OSX 10.5.1):
> >
> > sage: var(x)
> > x
> > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).rational_simplify() for i
> > in xrange(100))
> > 200
> > Time: CPU 0.97 s, Wall: 3.20 s
> > sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,100)')
> > 200
> > CPU time: 0.01 s, Wall time: 0.34 s
> >
> > Thus it takes 3.2 seconds wall time instead of 39.10 seconds for me.
> >
>
> This was on an old, slow machine, and maybe there is thrashing because
> there isn't much RAM.
>
>
> >
> > But sympy is still way faster and is symbolic:
> >
> > sage: from sympy import Symbol, sin
> > sage: x = Symbol('x')
> > sage: time sum(((x+sin(i))/x+(x-sin(i))/x).expand() for i in xrange(100))
> > 200
> > Time: CPU 0.09 s, Wall: 0.09 s
> >
> > which is why it's a good thing that sympy is the future of symbolic
> > computation in Sage :-).
> >
>
> This sounds promising.
>
> > And since Sympy comes with Sage, maybe you can use it for
> > your intended application right now?!
> >
>
> My intended application involves working with matrices, and I it looks
> like this isn't going to work with sympy:
>
> sage: from sympy import Symbol
> sage: x = Symbol('x')
> sage: m=matrix([[x]])
> Traceback (most recent call last):
> ...
> AssertionError: 
>
>
> Cheers,
>
> Peter Doyle
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Symbolic computation is slow

2007-12-27 Thread Mike Hansen

Hello,

The reason why the symbolic stuff in Sage is slow is that it uses a
psuedo-tty interface to talk to Maxima.  There is a lot of overhead
with this due to  waiting, synchronization, parsing the string output,
etc.  One way to get the symbolic stuff to be faster is to make using
Sympy since it won't have that overhead (even though it is slower than
native maxima at the moment).

--Mike

On Dec 27, 2007 2:53 PM, pgdoyle <[EMAIL PROTECTED]> wrote:
>
> I'm having problems doing symbolic computations in Sage.  Calls to
> rational_simplify() seem to take about .2 seconds each.  Working
> directly in Maxima is about 100 times faster.  Mathematica is
> something like 500 times faster.
>
> In Sage, where does the time go?  Is there something I can do right
> now to speed things up?  Is this something that will eventually go
> faster?
>
> Cheers,
>
> Peter Doyle
> -
> sage: var(x)
> x
> sage: time sum(((x+sin(i))/x+(x-sin(i))/x).rational_simplify() for i
> in xrange(100))
> 200
> CPU time: 5.29 s,  Wall time: 39.10 s
> sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,100)')
> 200
> CPU time: 0.02 s,  Wall time: 0.55 s
> sage: time mathematica('Sum[Simplify[(x+Sin[i])/x+(x-Sin[i])/x],{i,
> 1,100}]')
> 200
> CPU time: 0.00 s,  Wall time: 0.09 s
> sage: time maxima('sum(ratsimp((x+sin(i))/x+(x-sin(i))/x),i,1,1)')
> 2
> CPU time: 0.01 s,  Wall time: 30.21 s
> sage: time mathematica('Sum[Simplify[(x+Sin[i])/x+(x-Sin[i])/x],{i,
> 1,1}]')
> 2
> CPU time: 0.01 s,  Wall time: 2.20 s
> sage: time mathematica('Sum[Simplify[(x+Sin[i])/x+(x-Sin[i])/x],{i,
> 1,10}]')
> 20
> CPU time: 0.00 s,  Wall time: 70.05 s
> sage: time mathematica('Sum[Evaluate[Simplify[(x+Sin[i])/x+(x-Sin[i])/
> x]],{i,1,10}]')
> 20
> CPU time: 0.00 s,  Wall time: 0.03 s
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: kernel function documentation is misleading

2007-12-26 Thread Mike Hansen

I had made this a ticket a few days ago:
http://sagetrac.org/sage_trac/ticket/1587

--Mike

On 12/26/07, William Stein <[EMAIL PROTECTED]> wrote:
>
> On Dec 26, 2007 7:35 PM, Marshall Hampton <[EMAIL PROTECTED]> wrote:
> >
> > At least in the United States, and I assume some other places as well,
> > matrices are usually considered to act from the left.  So the kernel
> > of a matrix A would be the set of vectors x such that Ax = 0.  In
> > sage, the kernel is given for the matrix acting from the right, i.e.
> > the set of vectors y such that yA  = 0.  If there is compelling
> > argument as to why that makes sense, I can live with it.
>
> There are 2 or 3 reasons why things are as they are with matrix
> actions on vectors in Sage.
>
> 1. In Sage vectors are row vectors:
> sage: v = vector([1,2,3])
> sage: v
> (1, 2, 3)  # <-- that's a row
>
> Matrices act naturally from the right on row vectors.
>
> Nonetheless, we now allow both actions in Sage for convenience:
>
> sage: A = random_matrix(QQ,3)
> sage: A*v
> (5, -4, 3)
> sage: v*A
> (6, 3/2, -1)
>
> 2. David Kohel and I made the decision about which side matrices would act on
> when I started Sage, i.e., back when Sage was called "Software for Arithmetic
> Geometry Experimentation", and the main goal of Sage was to provide a viable
> open source alternative to the subset of Magma that David Kohel and I used, 
> and
> to do so in a way that made it as easy as possible to port our code from 
> Magma,
> and to go back and forth between Sage and Magma.
> In Magma matrices act from the right, probably because vectors are row vectors
> and also because Magma is Australian.
>
> 3. At some point I was about to change everything to matrices acting from the
> left, and David Kohel stopped me.
>
> I don't know if that is a compelling enough reason.   A fourth reason is that
> changing things now would be really really really hard, and would likely
> introduce numerous bugs all over the place.
>
> A Magma example:
> -
>
> sage: A = random_matrix(QQ,3)
> sage: v = vector([1,2,3])
> sage: v*A
> (9, 4, 3/2)
> sage: A*v
> (-5, 2, 15/2)
> sage: aa = magma(A)
> sage: vv = magma('VectorSpace(RationalField(),3)![1,2,3]')   # trac
> 1605 -- I'm on it.
> sage: vv*aa
> (  9   4 3/2)
> sage: aa*vv
> ... (boom!)
> : Error evaluation Magma code.
> IN:_sage_[7] := _sage_[4] * _sage_[5];
> OUT:
> >> _sage_[7] := _sage_[4] * _sage_[5];
>   ^
> Runtime error in '*': Arguments are not compatible
> Argument types given: AlgMatElt[FldRat], ModTupFldElt[FldRat]
>
>
> > But the
> > documentation for kernel() obscures, rather than clarifies, this
> > issue:
> >
> > Docstring:
> >
> > Return the kernel of x.
> >
> > EXAMPLES:
> > sage: M = MatrixSpace(QQ,3,3)
> > sage: A = M([1,2,3,4,5,6,7,8,9])
> > sage: kernel(A)
> > Vector space of degree 3 and dimension 1 over Rational Field
> > Basis matrix:
> > [ 1 -2  1]
> >
> > The problem with this example is that A is quite an unusual matrix:
> > its left-kernel is equal to its right-kernel.  I recommend that a non-
> > square example be given that makes the current behavior clearer.
>
> Good idea.  Please create a trac ticket, then put in some examples.
> You'll modify the file
> sage/matrix/matrix_rational_dense.pyx
> Please put in a bunch (i.e., maybe 4 or 5) of examples to illustrate all
> kinds of things, including edge cases (0 by n or n by 0 matrices,
> denominators, etc.).
>
>  -- William
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Can't find my way around Sage source code

2007-12-23 Thread Mike Hansen

Hello Bill,

sage: E = EllipticCurve('5077a'); E
Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field
sage: E?
Type:   EllipticCurve_rational_field
Base Class: 
String Form:Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over
Rational Field
Namespace:  Interactive
Docstring:

Elliptic curve over the Rational Field.

If you look at the base class, you can see what class your object
belongs to.  The Python code for that class is  in
$SAGE_ROOT/devel/sage-main/sage/schemes/elliptic_curves/ell_rational_field.py
.  Another way to have found this is

sage: E.point_search?
Type:   instancemethod
Base Class: 
String Form:
Namespace:  Interactive
File:
/opt/sage/local/lib/python2.5/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py
Definition: E.point_search(self, height_limit, verbose=True)

Finally, there is the search_src function that can be used to search
from within Sage.

sage: search_src('def point_search')
schemes/elliptic_curves/ell_rational_field.py:def
point_search(self, height_limit, verbose=True):

If you want to play around with changing that code, I would make a new
branch by using "sage -clone ell".  Then, you can make changes to the
files in $SAGE_ROOT/devel/sage-ell/ .  To test them out, you can do
"sage -br ell" which will build them and run the 'ell' branch.  This
makes things easier when it comes time to upgrade since no changes
will have been made to the sage-main repository.  It also allows you
to isolate changes for submitting patches.  I will probably make a
blog post here shortly on my workflow for doing Sage development.

--Mike






On Dec 23, 2007 12:18 PM, bill purvis <[EMAIL PROTECTED]> wrote:
>
> I'm new to Sage and haven't found my way around yet.
> I've downloaded 2.9 source and compiled it.
> For those who collect statistics it reported taking 4H 17M on my
> Toshiba Equium (Intel Celeron, 2.9GHz).
>
> I'm interested in adapting John Cremona's code for finding rational
> points on elliptic curves to handle integer points and have located
> the source code for this in cremona.spkg. However, this is all
> C++ code and I need to locate the Python code that invokes this
> so as to extend or supplement the calling sequence. Can anyone tell
> me where to look for this? Where is the EllipticCurve stuff defined?
> The particular function is .point_search.
>
> Many thanks,
>
> Bill
> --
> +---+
> | Bill Purvis, Amateur Mathematician|
> |  email: [EMAIL PROTECTED]  |
> |  http://bil.members.beeb.net  |
> +---+
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Accessing a windows installation remotely

2007-12-11 Thread Mike Hansen

> One more question not related to this topic.  I already use maxima
> some by itself.  I use a package called wxmaxima or something like
> that, and it formats the output in a pretty way.  Will sage do that?
> I see in the reference manual that I can tell it to give me output in
> latex, but it doesn't render it.

You can run " lprint() " in a cell to turn on LaTeX rendering mode.
You can also call show(x) to render an object x.

--Mike

>
> On Dec 11, 10:20 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> > On Dec 11, 2007 8:09 PM, Adam <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I did what you suggested (switched ethernet connection to bridged and
> > > restarted the vmware machine) and now it works.  Thanks.  My next
> > > question is, can I set the server up to listen on a different port?
> >
> > Yes, that's possible.  You will have to login to the sage-vmware machine,
> > by typing
> >login: manage
> >
> > Once logged in, type
> >
> >$ sudo su
> >passwd: sage
> >
> > then edit the file
> >
> >/usr/local/bin/notebook
> >
> > using vi or pico (you can apt-get another editor if you want).
> > Somewhere in /usr/local/bin/notebook it says port=80.  You can
> > change that to port=whatever_you_want.
> >
> > William
> >
> >
> >
> >
> >
> > > William Stein wrote:
>
> > > > On Dec 9, 2007 3:13 PM, Adam <[EMAIL PROTECTED]> wrote:
> >
> > > > > I'd like to install Sage on a Windows machine, then access it
> > > > > remotely.  I'm a complete beginner at using both Sage and vmware.  Is
> > > > > this possible?
> >
> > > > Actually this definitely possible.  You have to configure
> > > > "bridged networking" in vmware player -- check elsewhere
> > > > online about how to do that -- it might be obvious from the
> > > > graphical interface, e.g., just click on the network interface
> > > > icon and change a setting on the icon that pops up.
> > > > After you do that, you should completely reset the vmware
> > > > machine, e.g., hit control-c to stop the notebook server, then
> > > > type
> > > > login: off
> > > > at the login prompt.  Then start the sage back up again
> > > > and start the notebook:
> > > > login: notebook
> >
> > > > I think you'll get a URL and with luck you'll be able to
> > > > connect to it from anywhere.
> >
> > > > This depends of course some on what network your computer
> > > > is connected to and how, what firewall software you might have,
> > > > etc., etc.  But it is definitely possible.   Please familiarize yourself
> > > > some more with vmware player, try the above, and report back.
> >
> > > > Sorry if the above is somewhat vague, but I don't have access
> > > > to vmware player right now, so I'm working from memory.
> >
> > > > William
> >
> > --
> > William Stein
> > Associate Professor of Mathematics
> > University of Washingtonhttp://wstein.org
>
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Is this a memory problem?

2007-12-09 Thread Mike Hansen

In case you're curious, here are some timings for higher powers along
with memory usage.

sage: s = SFASchur(QQ)
sage: f = s([2,1])
sage: get_memory_usage()
515.17578125

sage: time a = f^10
CPU times: user 6.64 s, sys: 0.03 s, total: 6.67 s
Wall time: 6.74
sage: get_memory_usage()
526.26171875  #11MB

sage: time a = f^11
CPU times: user 30.18 s, sys: 0.05 s, total: 30.23 s
Wall time: 30.98
sage: get_memory_usage()
536.171875 #21MB

sage: time a = f^12
CPU times: user 116.47 s, sys: 0.13 s, total: 116.60 s
Wall time: 119.75
sage: get_memory_usage()
554.5 #39MB

sage: time a = f^13
CPU times: user 437.49 s, sys: 0.44 s, total: 437.94 s
Wall time: 444.04
sage: get_memory_usage()
585.796875  #70MB
sage: len(a)
30641


I believe that there is eventual room for improvement in the memory usage.

--Mike

On Dec 9, 2007 10:44 PM, BFJ <[EMAIL PROTECTED]> wrote:
>
> That was fast!
>
> Thanks for looking into the problem. I'll be doing more extensive
> calculations over the next couple of weeks (I'm porting some Maple
> code). I'll let you know if I run into any other problems. I'm excited
> about the prospect of a 17-fold performance increase.
>
> Thanks very much,
>
> --
> [EMAIL PROTECTED]
>
>
> On Dec 9, 11:34 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > The actual issue was that I forgot to covert symmetrica's LONGINT type
> > ( 22 ) over to the correct Sage type.  I hadn't actually tested it
> > with calculations that got up to numbers that big.  I made a ticket
> > for this and posted a patch:http://sagetrac.org/sage_trac/ticket/1445
> > It will be in the next version ( 2.9 ) which will come out in about 3
> > days.
> >
> > --Mike
> >
> > On Dec 9, 2007 10:01 PM, [EMAIL PROTECTED]
>
> >
> > <[EMAIL PROTECTED]> wrote:
> >
> > > I'm trying to use the combinatorics features in Sage to do some Chern
> > > class calculations. When I run the commands below, I get exceptions
> > > that I don't know how to interpret.
> >
> > > The same calculation in Maple using John Stembridge's SF package
> > > completes successfully using roughly 149 MB and 7.08 s CPU time.
> >
> > > Is this just an issue of memory limitation? If so, can (and how do) I
> > > lift the limitation to access more of the 2 GB I have on the machine
> > > I'm running this on?
> >
> > > code follows:
> > > I'm using Sage 2.8.15 on an i386 Linux platform. I also tried this on
> > > an Intel OS X 10.5 machine with the same result. Also, all the powers
> > > of "f" from 1 to 7 work fine. f^8 and higher powers fail.
> > > ---
> >
> > > sage: s=SFASchur(QQ)
> > > sage: f=s([2,1]); f
> > > s[2, 1]
> > > sage: f^8
> > > ---
> > >Traceback (most recent call
> > > last)
> >
> > > /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> > >  in ()
> >
> > > /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> > > local/lib/python2.5/site-packages/sage/combinat/sfa.py in
> > > __pow__(self, n)
> > > 881 z = A(Integer(1))
> > > 882 for i in range(n):
> > > --> 883 z *= self
> > > 884 return z
> > > 885
> >
> > > /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> > > element.pyx in sage.structure.element.RingElement.__imul__()
> >
> > > .
> > > .
> > > .
> > > .
> >
> > > /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> > > symmetrica.pxi in sage.libs.symmetrica.symmetrica._py()
> >
> > > : 22
> > > sage:
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Is this a memory problem?

2007-12-09 Thread Mike Hansen

Hello,

The actual issue was that I forgot to covert symmetrica's LONGINT type
( 22 ) over to the correct Sage type.  I hadn't actually tested it
with calculations that got up to numbers that big.  I made a ticket
for this and posted a patch: http://sagetrac.org/sage_trac/ticket/1445
It will be in the next version ( 2.9 ) which will come out in about 3
days.

--Mike

On Dec 9, 2007 10:01 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I'm trying to use the combinatorics features in Sage to do some Chern
> class calculations. When I run the commands below, I get exceptions
> that I don't know how to interpret.
>
> The same calculation in Maple using John Stembridge's SF package
> completes successfully using roughly 149 MB and 7.08 s CPU time.
>
> Is this just an issue of memory limitation? If so, can (and how do) I
> lift the limitation to access more of the 2 GB I have on the machine
> I'm running this on?
>
> code follows:
> I'm using Sage 2.8.15 on an i386 Linux platform. I also tried this on
> an Intel OS X 10.5 machine with the same result. Also, all the powers
> of "f" from 1 to 7 work fine. f^8 and higher powers fail.
> ---
>
> sage: s=SFASchur(QQ)
> sage: f=s([2,1]); f
> s[2, 1]
> sage: f^8
> ---
>Traceback (most recent call
> last)
>
> /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
>  in ()
>
> /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> local/lib/python2.5/site-packages/sage/combinat/sfa.py in
> __pow__(self, n)
> 881 z = A(Integer(1))
> 882 for i in range(n):
> --> 883 z *= self
> 884 return z
> 885
>
> /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> element.pyx in sage.structure.element.RingElement.__imul__()
>
> .
> .
> .
> .
>
> /Users/benjaminjones/Desktop/sage-2.8.15-osx10.5-intel-i386-Darwin/
> symmetrica.pxi in sage.libs.symmetrica.symmetrica._py()
>
> : 22
> sage:
>
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Questions about solve()

2007-12-08 Thread Mike Hansen

http://www.sagemath.org:9002/sage_trac/ticket/1235 should be faster.

--Mike

On Dec 8, 2007 12:50 PM, Ted Kosan <[EMAIL PROTECTED]> wrote:
>
> William wrote:
>
> > As a start I've implemented find_root (and some minizing and
> > maximizing functions)
> > and posted a patch here:
> > http://trac.sagemath.org/sage_trac/ticket/1235 
>
> This is great :-)  I will try the code as soon as the slashdot traffic
> subsides from the server.
>
> Ted
>
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Weaning

2007-12-07 Thread Mike Hansen

> It means 5.+N applied to 5.85987.  (In Mathematica f[x] is how you
> would express applying f to x).

I think what confusing is the following:

In[1]:= Pi // N
Out[1]= 3.14159
In[2]:= Pi // N + 2
Out[2]= (2 + N)[Pi]

What does it mean in Mathematica to add 2 to N?  Does it just treat N
as a formal symbol when you add 2 to it N?

--Mike

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Weaning

2007-12-07 Thread Mike Hansen

> Is there some easy way I could have figured out that m would respond
> to the message `apply_map'?
> (Or whatever messages are called in the post-Smalltalk era.)

In Python, they're known as methods and they come associated with an
object based on its type.  To get a list of all the methods that m
has, you would type in m. and then press tab.

> However,
> 1.rational_simplify()
> causes an error.  The explanation is that
> type(((x^2-1)/(x-1)-x).rational_simplify())
> is
> 
> whereas
> type(1)
> is
> 

You are correct on this.


> But it seems like this could be a more natural and useful way to
> handle an operation like ratsimp.

This is because there is a pretty clean split in Sage between the
symbolic stuff (which is using Maxima) and everything else.  All the
symbolic stuff lives in the SymbolicExpressionRing.

sage: SR = SymbolicExpressionRing()
sage: a = SR(1)
sage: type(a)

sage: a
1
sage: a.rational_simplify()
1


>
> Maybe the problem is that I just don't have a model yet that would
> allow me to predict, for example, that
> to find the length of something I should feed it to the function len,
> rather than sending it the message len(),
> whereas if I want to do something to each entry of a matrix, I should
> send a message apply_map to the
> matrix, rather than feeding the matrix to a function called apply_map.

Pretty much everything is in the methods (or at least should be).
There are some global level functions for convenience that basically
just call the object's method.  len() is a builtin Python function and
will call the objects .__len__() method.

> to know or care, as apparently they do in sage.  In which case I think
> it might work better to try to stick with functions
> rather than messages, where possible.

Under Python's object-oriented approach, the objects and methods are
the preferred way of handling things. And, when it comes to working
with a wide range of types as Sage does, the code is much cleaner and
easier to work with.

>
> One thing I know I'm going to miss from Mathematica is the loosely
> binding operator \\, as in f \\ g, which is another way of writing
> g[f].  This allows you to build up a computation by writing first
> things first.  And because of the loose binding, you can write
> longcomplicatedexpression \\ ratsimp
> without fear that ratsimp will stingily only simplify the denominator
> of the expression.

Because Sage adopts Python's syntax, nothing exactly like that will be
added to Sage.  On the other hand, the Python interpreter regards _ as
the last object.  You could do something like this:

sage: (x^2-1)/(x-1)-x
(x^2 - 1)/(x - 1) - x
sage: _.rational_simplify()
1

--Mike

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Weaning

2007-12-03 Thread Mike Hansen

Hello,

> 1)  Taylor series of a rational function.
>
> This works:
> sage: cos(x).taylor(x,0,2)
>
> This doesn't:
> sage: x/(1+x).taylor(x,0,2)
>
> This is very confusing:
> sage: var('x')
> sage: x/(1+x).taylor(x,0,2)

This is due to the fact that '.' binds tighter than '/'.  For example,
sage: x/(1+x).taylor(x,0,2)
x/(x + 1)
sage: x/((1+x).taylor(x,0,2))
x/(x + 1)
sage: (x/(1+x)).taylor(x,0,2)
x - x^2

In Sage, "(x/(1+x))" creates an object and the you call the taylor()
method on that object.

>
> 2)  Map for matrices.  This works:
>
> sage: x=polygen(QQ)
> sage: m=(1-x*matrix([[1,1],[1,0]]))^-1; m
> sage: matrix([[m[i,j].subs(x=1) for j in range(2)] for i in range(2)])
>
> But, surely there is a direct way substitute x=1 for all entries?

If you just need to substitute, you can do:

sage: m.subs(x=1)
[-1 -1]
[-1  0]

If you want to apply a more general map to the coefficients, then you can do:

sage: m.apply_map(lambda e: e.subs(x=1))
[-1 -1]
[-1  0]

> Another thing I found confusing was that this slight variation gave
> division by 0.
>
> sage: var('x')
> sage: m=(1-x*matrix([[1,1],[1,0]]))^-1; m
> sage: matrix([[m[i,j].subs(x=1) for j in range(2)] for i in range(2)])
> The problem is that sage hasn't simplified the entries of m.  It
> thinks

Yep, maybe Sage should try and do some simplification of the maxima
expression before trying the simplification.  There is a ticket for
implementing a symbolic matrix class which should take care of that
issue.

> 3)  How do I get access to maxima's ratsimp?

sage: n = m.apply_map(lambda e: e.rational_simplify()); n
[ -1/(x^2 + x - 1)  -x/(x^2 + x - 1)]
[ -x/(x^2 + x - 1) (x - 1)/(x^2 + x - 1)]
sage: n.subs(x=1)
[-1 -1]
[-1  0]

In the new symbolic matrix class ( when it gets written ;-] ), you
should be able to do m.rational_simplify().

Hope that helps,
--Mike

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Nasty bug in Calculus?

2007-11-30 Thread Mike Hansen

I tested your function up to 100,000 with all the variations of f, and
they all worked after applying the patch for #847.

--Mike

On Nov 30, 2007 10:01 PM, john_perry_usm <[EMAIL PROTECTED]> wrote:
>
> Thanks (I really like that!) but... While this approach worked well
> with the numbers given, it generated the same error on larger values
> of n.
>
> regards
> john perry
>
>
> On Nov 30, 3:58 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > > In Maple one typically write f:=x->x if one means a function instead
> > > of an expression. Doing something similar in SAGE makes a *lot* of
> > > sense, so I don't object inherently to the lambda notation, although
> > > the default Python syntax ("lambda") is not intuitive to an "ordinary"
> > > math student. A nice solution might be to introduce an intuitive SAGE
> > > construction for functions. -- My $.02 (US $ so not as much lately as
> > > it used to be...)
> >
> > Actually, now that I think about it, there is a "nice" way to create
> > the function in Sage which I completely forgot about.
> >
> > sage: f(x) = x
> > sage: Midpoint_Riemann_Sums(0,5,f,1000)
> > 12.52500
> >
> > I also put a patch up that make Sage work when you use "f = x".  It
> > should get into the next release,
> >
> > --Mike
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Nasty bug in Calculus?

2007-11-30 Thread Mike Hansen

Hello,

> In Maple one typically write f:=x->x if one means a function instead
> of an expression. Doing something similar in SAGE makes a *lot* of
> sense, so I don't object inherently to the lambda notation, although
> the default Python syntax ("lambda") is not intuitive to an "ordinary"
> math student. A nice solution might be to introduce an intuitive SAGE
> construction for functions. -- My $.02 (US $ so not as much lately as
> it used to be...)

Actually, now that I think about it, there is a "nice" way to create
the function in Sage which I completely forgot about.

sage: f(x) = x
sage: Midpoint_Riemann_Sums(0,5,f,1000)
12.52500

I also put a patch up that make Sage work when you use "f = x".  It
should get into the next release,

--Mike

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Nasty bug in Calculus?

2007-11-30 Thread Mike Hansen

Hello,

This is an instance of http://trac.sagemath.org/sage_trac/ticket/847 .
 I / we haven't had time to fix that one, but hopefully we can get to
it tomorrow.  For now, you should make sure that f is an actual Python
function.

sage: f = lambda x: x
sage: Midpoint_Riemann_Sums(0, 5, f, 1000)
12.52500
sage: def f(x):
: return x
:
sage: Midpoint_Riemann_Sums(0, 5, f, 1000)
12.52500


--Mike

On Nov 30, 2007 10:08 AM, David Joyner <[EMAIL PROTECTED]> wrote:
>
> Again, I don't understand the bug but piecewise seems to work better using
> lambda functions.
>
> sage: f = lambda x: x
> sage: fp = Piecewise([[(10,20),f]])
> sage: fp.riemann_sum_integral_approximation(993)
> 148900/993
>
> Next semester, when I have more time, I plan to revise piecewise.
> Maybe I can look into the bug more then...
>
>
>
>
> On Nov 30, 2007 10:49 AM, john_perry_usm <[EMAIL PROTECTED]> wrote:
> >
> > Thank you! The following code produces the same error.
> >
> > f = x
> > fp = Piecewise([[(10,20),f]])
> > fp.riemann_sum_integral_approximation(993)
> >
> > The student is doing this as an assignment for a class on how to write
> > programs to solve problems in mathematics. (Newton's Method, Riemann
> > sums, Fibonacci numbers, Traveling Salesman, etc.) She's not doing
> > this because she needed SAGE to approximate a Riemann sum. They
> > started with Maple, and now we're working on SAGE; I'd like to teach
> > the class exclusively in SAGE one day.
> >
> > regards
> > john perry
> >
> > On Nov 30, 9:00 am, "David Joyner" <[EMAIL PROTECTED]> wrote:
> > > I'm not sure what the cause of the error is but, FYI, some Riemann sum 
> > > stuff is
> > > already implemented in piecewise.py.
> > >
> >
> > > On Nov 30, 2007 9:41 AM, john_perry_usm <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > > Hi,
> > >
> > > > One of my students was writing a procedure to implement a Midpoint
> > > > Riemann Sum in SAGE. The procedure that she devised is given below,
> > > > and it looks reasonable enough to me. Unfortunately it generates a
> > > > SAGE exception (AttributeError, line 2051 of calculus.py) under
> > > > certain bizarre circumstances; try for example a=10,b=20,f=x,n=991
> > > > (which works fine) then n=992 with the same a,b,f.
> > >
> > > > Any assistance would be appreciated. Maybe I don't know Python well
> > > > enough? :-) I have verified the exception using both SAGE-2.8.7 on
> > > > Fedora Core 7 and SAGE-2.8.13 on Windows.
> > >
> > > > regards
> > > > john perry
> > >
> > > > Her procedure:
> > >
> > > > def Midpoint_Riemann_Sums(a,b,f,n):
> > > >delta_x = (b-a)/(n*1.0)
> > > >result = 0
> > > >for i in range(1, n+1):
> > > >  xi = ((delta_x/2)+a)+(i*delta_x)
> > > >  result = result+f(xi)*delta_x
> > > >return result
> > >
> > > > The error message:
> > >
> > > > Traceback (most recent call last):
> > > >   File "/atlas/perry/sage_notebook/worksheets/apetrinec55/1/code/
> > > > 71.py", line 4, in 
> > > > exec
> > > > compile(ur'Midpoint_Riemann_Sums(Integer(10),Integer(20),f,Integer(1000))'
> > > > + '\n', '', 'single')
> > > >   File "/usr/local/sage-2.8.7-fedora_core_7-i686-Linux/data/extcode/
> > > > sage/", line 1, in 
> > >
> > > >   File "sage_object.pyx", line 87, in sage_object.SageObject.__repr__
> > > >   File "/usr/local/sage-2.8.7-fedora_core_7-i686-Linux/local/lib/
> > > > python2.5/site-packages/sage/calculus/calculus.py", line 2896, in
> > > > _repr_
> > > > return self.simplify()._repr_(simplify=False)
> > > >   File "/usr/local/sage-2.8.7-fedora_core_7-i686-Linux/local/lib/
> > > > python2.5/site-packages/sage/calculus/calculus.py", line 2051, in
> > > > simplify
> > > > S =
> > > > evaled_symbolic_expression_from_maxima_string(self._maxima_init_())
> > > >   File "/usr/local/sage-2.8.7-fedora_core_7-i686-Linux/local/lib/
> > > > python2.5/site-packages/sage/calculus/calculus.py", line 3044, in
> > > > _maxima_init_
> > > > return '(%s) %s (%s)' % (ops[0]._maxima_init_(),
> > >
> > > > ...and then several hundred more of that last line.
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



[sage-support] Re: Questions about solve()

2007-11-26 Thread Mike Hansen

Hello,

I've posted a patch for # -- http://sagetrac.org/sage_trac/ticket/

--Mike

On Nov 26, 2007 3:34 PM, Ted Kosan <[EMAIL PROTECTED]> wrote:
>
> William wrote:
>
> > I think one student working for two weeks could greatly enhance solve,
> > but making it:
> >
> >(1) try the maxima solve, and
> >(2) if the maxima solve returns no solutions, do something further that
> >  involves numerics, e.g., calling to scipy's iterative solver.
> >
> > In particular, if you could give a list of the sort of problems you want to 
> > make
> > sure solve could solve, we can make sure it does.
> >
> > Students here work for about $13/hour for up to 19 hours/week, so two weeks
> > would be $494.  Possibly Bobby and/or Josh would be interested?
>
> I just received permission from my University to spend $1000 to have
> the SAGE project fix the following bug:
>
> http://trac.sagemath.org/sage_trac/ticket/1235
>
> and add the following enhancement:
>
> http://sagetrac.org/sage_trac/ticket/
>
> The only difficulty is that the money needs to be sent in the form of
> a Purchase Order.  If this is possible then I can begin the paperwork
> immediately :-)
>
> Ted
>
>
> >
>

--~--~-~--~~~---~--~~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---



<    1   2   3   4   5   >