Re: [sage-support] Is there any way to get old VMware versions?

2010-04-19 Thread William Stein
On Sat, Apr 3, 2010 at 4:08 PM, Rob  wrote:
> I've officially given up on ever getting VirtualBox to work properly
> on my netbook (I'm pretty sure it's just a memory issue), so I'd like
> to go back to the last VMware version (4.1.2, I guess).
>
> I can find where to find the source code for the old versions, but
> I've looked all over sagemath.org and can't find anywhere to download
> prebuilt copies.  I suppose it has to be possible theoretically to
> build it from source, but that type of stuff is well beyond me.
>
> Is there anyway to get a copy of 4.1.2?  Or, alternately, a very
> detailed list of instructions written for total idiots describing how
> to create one from the source code?

Hi,

I have now posted a brand new VMWare Sage-4.4 image:


http://boxen.math.washington.edu/home/wstein/binaries/sage-vmware-4.4.alpha0.zip

It's something I made from scratch using a different approach than before.
Please try it out and let me know if it works at all for you.

 -- William

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: How convert sage matrix to numpy array?

2010-04-19 Thread Jason Grout

On 04/19/2010 07:18 PM, Jason Grout wrote:

On 04/16/2010 05:41 AM, Bastian Weber wrote:

Hi,


what is the proper way to convert a sage matrix to a numpy 2d-array?

The obvious way, i.e.

a=np.array(matrix([3 4]))

produces a 0d-array (thus a.shape is an empty tuple) which is not what I
want.




The patch at http://trac.sagemath.org/sage_trac/ticket/8719 now fixes this:


sage: import numpy as np
sage: a=np.array(matrix([3, 4]))
sage: a.shape
(1, 2)
sage: a
array([[3, 4]])
sage: a.dtype
dtype('int64')

Thanks,

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: How convert sage matrix to numpy array?

2010-04-19 Thread Jason Grout

On 04/16/2010 05:41 AM, Bastian Weber wrote:

Hi,


what is the proper way to convert a sage matrix to a numpy 2d-array?

The obvious way, i.e.

a=np.array(matrix([3 4]))

produces a 0d-array (thus a.shape is an empty tuple) which is not what I
want.



To answer your original question, I think if we defined __array__ in the 
top-level Sage matrix class, we could get this to work.


However, it still seems odd, since "a" does print out okay.

sage: import numpy as np
sage: a=np.array(matrix([[3, 4]]))
sage: a
array([3 4], dtype=object)
sage: a.shape
()

So I can print a, and it looks okay.  What is going on there?  Is that a 
bug in numpy?


Thanks,

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: How convert sage matrix to numpy array?

2010-04-19 Thread Jason Grout

On 04/19/2010 12:58 PM, Bastian Weber wrote:


The question is: Where should I have found the information about the
existence of .numpy? And where will the next one with that problem find
it? Is there something like the scipy cookbook for sage where this could
be added?



In Sage, you can use tab completion to discover methods:

sage: m=random_matrix(RDF,4,4)
sage: m.

will list all the methods of m, including m.numpy

I just found that adding this line in the class definition in 
matrix_double_dense.pyx:


__array__=numpy

makes it so that this now works:

sage: m=random_matrix(RDF,4,4)
sage: numpy.array(m)
array([[ 0.95041375, -0.93413188, -0.34801206, -0.81931649],
   [-0.83999126, -0.35074003,  0.26855088, -0.6917416 ],
   [ 0.22118328, -0.24463205,  0.98608149, -0.52649223],
   [-0.01629823,  0.22644043, -0.29993975, -0.46477457]])
sage: numpy.array(m).dtype
dtype('float64')

which is certainly more natural (for a numpy person) than m.numpy()

(note that numpy.array(m) worked before, but gave back an array with 
python objects, while the float64 array is more natural for matrices 
over RDF).


This patch is now up at http://trac.sagemath.org/sage_trac/ticket/8719 
and is ready for review!


Thanks,

Jason


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: list vs. integer instances

2010-04-19 Thread wb


On Apr 20, 12:25 am, Robert Bradshaw 
wrote:
> On Apr 19, 2010, at 2:50 PM, wb wrote:
>
> > coming from C I'm confused about this behavior in assignment:
>
> Since you know C, it may make sense to think of lists as being similar  
> to pointers.
>

that makes sense - I guess I was expecting lists to behave like list
*classes* which have an overloaded assignment operator.
Turning this around: is there a 'list-like' data type in sage which
has 'true' assignment, i.e. copying all its content ?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] list vs. integer instances

2010-04-19 Thread Robert Bradshaw

On Apr 19, 2010, at 2:50 PM, wb wrote:


coming from C I'm confused about this behavior in assignment:


Since you know C, it may make sense to think of lists as being similar  
to pointers.




1) using only integers --
sage: a=2
sage: b=2
sage: b=b+a
sage: b
4
sage: a
2

so (at least), after b=b+a, 'b' seems to have gotten its own instance,
however

2) using lists 
sage: a=[1,2]
sage: b=a
sage: b[0]=b[0]+a[0]
sage: b
[2, 2]
sage: a
[2, 2]   <--- ?!?

(which results also if done directly in python). So, after
b[0]=b[0]+a[0], 'b' does not seem to get its own instance and 'a'
therefore also gets modified  ..!? ... which somehow seems
inconsistent with 1) and very strange anyway ...

Finally

3) -
sage: a=[1,2]
sage: b=a+[]   < ! Trying to force (maybe?) an own
instance for 'b'
sage: b[0]=b[0]+a[0]
sage: b
[2, 2]
sage: a
[1, 2]  < ok

in exmpl. 3) the list behaves similar to the integers in exmpl. 1).

Question: is the assignment b=a+[] the only way to achieve this ?

Thanks,
wb

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: list vs. integer instances

2010-04-19 Thread D. Monarres
Here is the way that I do this when I want copy vs reference for
lists.

>>> a = [1,2]
>>> b = a[:]
>>> b[0] = a[0] + b[0]
>>> b
[2, 2]
>>> a
[1, 2]
>>>


the a[:] does a copy of the list while a=b creates a reference. It is
a little hard to get used to at first.

On Apr 19, 2:50 pm, wb  wrote:
> coming from C I'm confused about this behavior in assignment:
>
> 1) using only integers --
> sage: a=2
> sage: b=2
> sage: b=b+a
> sage: b
> 4
> sage: a
> 2
>
> so (at least), after b=b+a, 'b' seems to have gotten its own instance,
> however
>
> 2) using lists 
> sage: a=[1,2]
> sage: b=a
> sage: b[0]=b[0]+a[0]
> sage: b
> [2, 2]
> sage: a
> [2, 2]       <--- ?!?
>
> (which results also if done directly in python). So, after
> b[0]=b[0]+a[0], 'b' does not seem to get its own instance and 'a'
> therefore also gets modified  ..!? ... which somehow seems
> inconsistent with 1) and very strange anyway ...
>
> Finally
>
> 3) -
> sage: a=[1,2]
> sage: b=a+[]           < ! Trying to force (maybe?) an own
> instance for 'b'
> sage: b[0]=b[0]+a[0]
> sage: b
> [2, 2]
> sage: a
> [1, 2]  < ok
>
> in exmpl. 3) the list behaves similar to the integers in exmpl. 1).
>
> Question: is the assignment b=a+[] the only way to achieve this ?
>
> Thanks,
> wb
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/sage-support
> URL:http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: sage 4.3.4 or 4.3.5 on solaris sparc

2010-04-19 Thread adrian
IT WORKED!!!

I just heard from the systems administrator, and the problem was,
indeed, the path to the gcc libraries.  Everything works so far.

Thank you very much for your patience and prompt answer.

-Adrian.
On Apr 2, 1:58 pm, "Dr. David Kirkby"  wrote:
> adrian wrote:
> > We did not compile sage, but used the one that was pre-compiled.  The
> > error is
> > ---
> > ImportError: ld.so.1: python: fatal: relocation error: file /opt/local/
> > src/sage-4.3.4-Solaris-sun4u-SunOS/local/lib//libntl.so: symbol
> > _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i:
> > referenced symbol not found
> > WARNING: Failure executing code: 'import sage.misc.preparser_ipython;
> > sage.misc.preparser_ipython.magma_colon_equals=True'
> > ---
>
> > We did put the paths for some libraries, and tried to make it work.
> > Interestingly, it can compute 1+2, but not much more than that.
>
> > This is what the output says:
>
> A few thoughts on this.
>
> 1) What version of 'tar' is first in your path? If it is the Sun version of 
> tar,
> it is incapable of extracting the tar file correctly.
>
> If so, try this, which will use a GNU version of tar.
>
> $ /usr/sfw/bin/gtar xfz sage-4.3.4-Solaris-sun4u-SunOS.tar.gz
>
> 2) Can you try
>
> $ rm -rf $HOME/.sage
>
> which will clear out any debris which might be left from previous failed
>
> When you try to run sage for the first time, you should get a message about
> rebuilding parts of sage,
>
> The Sage install tree may have moved.
> Regenerating Python.pyo and .pyc files that hardcode the install PATH
> (please wait at most a few minutes)...
> Do not interrupt this.
>
> and I believe it calls 'ranlib', 'ar' or similar. If /usr/ccs/bin is not in 
> the
> path, it will not find them which might result in a corrupted installation.
>
> If these are not found, it would be sensible that we report an error and exit,
> but I don't think that happens.
>
> 3) If that does not work, can you try the binary from this URL - use p7zip to
> decompress it, which is standard with recent releases of Solaris 10, though a
> patch (only available with a contract), is needed for older updates of 
> Solaris 10.
>
> http://boxen.math.washington.edu/home/kirkby/Solaris-binaries/sage-4
>
> It was built a Sun Blade 1000 and has been used on a Sun T5240 too.
>
> Dave

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] list vs. integer instances

2010-04-19 Thread wb
coming from C I'm confused about this behavior in assignment:

1) using only integers --
sage: a=2
sage: b=2
sage: b=b+a
sage: b
4
sage: a
2

so (at least), after b=b+a, 'b' seems to have gotten its own instance,
however

2) using lists 
sage: a=[1,2]
sage: b=a
sage: b[0]=b[0]+a[0]
sage: b
[2, 2]
sage: a
[2, 2]   <--- ?!?

(which results also if done directly in python). So, after
b[0]=b[0]+a[0], 'b' does not seem to get its own instance and 'a'
therefore also gets modified  ..!? ... which somehow seems
inconsistent with 1) and very strange anyway ...

Finally

3) -
sage: a=[1,2]
sage: b=a+[]   < ! Trying to force (maybe?) an own
instance for 'b'
sage: b[0]=b[0]+a[0]
sage: b
[2, 2]
sage: a
[1, 2]  < ok

in exmpl. 3) the list behaves similar to the integers in exmpl. 1).

Question: is the assignment b=a+[] the only way to achieve this ?

Thanks,
wb

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] power function with runtime error

2010-04-19 Thread Mike Hansen
On Mon, Apr 19, 2010 at 11:52 AM, bb  wrote:
> I get a runtime error, but just would expect infinity! Is there something
> wrong or any explanation?

This is because when you do 2^3^4^5 you are computing that number
exactly as an integer, and that number is definitely not infinity.  If
you wanted to use floating point arithmetic, then you should start
with something like 2.0:

sage: 2.0^3^4^5
+infinity

Doing something like float(2^3^4^5) computes 2^3^4^5 as an integer and
then tries to convert that to a float.

Also, note that when you type in such an expression, the operations
are done in the following manner:

var(sage: var('x, y, z')
(x, y, z)
sage: x^y^z
x^(y^z)

which is different than

sage: (x^y)^z
(x^y)^z

Since exponentiation is non-associative, you need to be careful with
such differences.

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] power function with runtime error

2010-04-19 Thread bb

bb schrieb:

sage: 2^3^4^5
--- 

RuntimeError  Traceback (most recent call 
last)


/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage: float(2^3^4^5)
--- 

RuntimeError  Traceback (most recent call 
last)


/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage: long(2^3^4^5)
--- 

RuntimeError  Traceback (most recent call 
last)


/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage:

I get a runtime error, but just would expect infinity! Is there 
something wrong or any explanation?


This works:
sage: 2^3^4^2
and results in a huge number!


Tnx & Regards BB


With another input Sage can do the job.
sage: ((2^3)^4)^5
1152921504606846976
sage:
The same with maxima! maxima crashes without parenteses.
I did some experiments with different systems with the statement with 
FreeMat:


--> 2^3^4^5

ans =

0

--> 

I wonder about the last result? I would expect infinity or such a thing. 
It works this way:


--> ((2^3)^4)^5

ans =

1152921504606846976

-->

Something strange happens with this:

--> 2^3^4

ans =

2,4179e+24

--> 2^3^4^3

ans =

0

--> 2^3^4^2

ans =

  inf

--> 


One might calculate with another calculator, that 2^3^4 should give 4096.

In Octave I get the following:

octave3.2:15> 2^3^4^5
ans =  1.1529e+18
octave3.2:16>

Maxima crashes and ends the program unexpected with an error message. 
Maxima as well can handle it in this expression:

(%i1) ((2^3)^4)^5
;
(%o1) 1152921504606846976
(%i2)


Regards BB

The exponent will be set high by the Mail-Program!

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] power function with runtime error

2010-04-19 Thread bb

sage: 2^3^4^5
---
RuntimeError  Traceback (most recent call last)

/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage: float(2^3^4^5)
---
RuntimeError  Traceback (most recent call last)

/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage: long(2^3^4^5)
---
RuntimeError  Traceback (most recent call last)

/home/bb/sage-4.3.5/ in ()

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/rings/integer.so 
in sage.rings.integer.Integer.__pow__ (sage/rings/integer.c:12114)()


RuntimeError: exponent must be at most 9223372036854775807
sage:

I get a runtime error, but just would expect infinity! Is there 
something wrong or any explanation?


This works:
sage: 2^3^4^2
and results in a huge number!


Tnx & Regards BB

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage/Maxima desolve_rk4 problem

2010-04-19 Thread Robert Dodier
Looks like the rk function in Maxima doesn't try hard enough to
float-ify its argument. I haven't looked at the code, but
maybe rk can call COERCE-FLOAT-FUN to construct a
function to evaluate the expression. At least that would
bring it into line with other Maxima functions which
evaluate expressions to numbers (e.g. plotting, quadpack).

Follow-ups to the Maxima mailing list. I've appended
the original message below.

best

Robert Dodier

PS.

On Apr 19, 8:38 am, jvkersch  wrote:

> Technically, this is not a Sage problem, but I figured I would post it
> here anyway since others might have run into the same problem, and I'm
> also trying to solve the problem using some Sage/python trickery.
>
> The problem concerns the use of symbolic constants such as pi in
> numerical integration with desolve_rk4.  The following code is adapted
> from the manual page for desolve_rk4 -- note especially the constant
> pi in the specification of the ODE:
>
>   x, y = var('x y')
>   desolve_rk4(x*y*(2-y) + pi, y, ics=[0, 1], end_points=1, step=0.5)
>
> and raises the following error:
>
>   TypeError: Error executing code in Maxima
>   CODE:
> sage1 : rk(%pi-x*(y-2)*y,y,1,[x,0,1,0.500])$
>   Maxima ERROR: Inconsistent set of equations and variables
>
> This same error occurs whenever you have an ODE with pi in it, no
> matter how simple. The error persists when directly running this
> command in Maxima, but works fine (both in Sage and Maxima) when
> manually replacing pi by 3.14...   Since I don't know any Maxima, I
> have no idea of what the problem could be or where to look.
>
> So, I was wondering if there is a way to have Sage replace the %pi
> when invoking Maxima by the corresponding numerical value?  I guess I
> could store my ODE in a string and use a regular expression to get rid
> of any pi's myself, but that seems very inelegant.  Is there anything
> you would recommend?
>
> Thanks a lot,
> Joris

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Hensel lifting

2010-04-19 Thread Simon King
Hi!

On 19 Apr., 03:33, vdelecroix <20100.delecr...@gmail.com> wrote:
> My two attempts were the followings
> {{{
> sage: K. = PolynomialRing(QQ,'t')
> sage: A2 = QuotientRing(K, Ideal(t^2))
> sage: A3 = QuotientRing(K, Ideal(t^3))
> sage: P = A2(t^4 + 3*t + 1)
>
> }}}
>
> First method: try to coerce
> {{{
> sage: A3(P)
> Traceback (click to the left of this block for traceback)
> ...
> TypeError: Unable to coerce 3*tbar + 1 ( 'sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotie
> \
> ntRingElement'>) to Rational

This works:
  sage: A3(P.lift())
  3*tbar + 1

P.lift() returns the unique polynomial (in K!) mapping to P of degree
less then the modulus of the quotient.

Alternatively (although this is probably just a very nasty work-
around) you could use multi-variate polynomial rings. Here, the
conversion works (it is not coercion, since there is no ring map from
A2 to A3 mapping A2(t) to A3(t)).

sage: K. = QQ[]
sage: A2 = QuotientRing(K, Ideal(t^2))
sage: A3 = QuotientRing(K, Ideal(t^3))
sage: P = A2(t^4 + 3*t + 1)
sage: A3(P)
3*tbar + 1

I often found that multivariate polynomial rings are much better
implemented in Sage than univariate rings. And I find it annoying that
both provide different methods.

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: How convert sage matrix to numpy array?

2010-04-19 Thread Bastian Weber
Hi Minh,

Minh Nguyen wrote:
> 
>> (Where should I have looked in the documentation to find out by myself?,
>> Maybe there are more useful hints.)
> 
> The numpy() method you are referring to is in the file
> 
> SAGE_ROOT/devel/sage-main/sage/matrix/matrix_real_double_dense.pyx

Thanks for that hint.

> 
> Unfortunately, at the moment that file is not in the reference manual
> [1] so you can't find documentation for numpy() in the reference
> manual.

Thats a pity.

> However, you could still get the relevant documentation as
> demonstrated in the following command line transcript. Notice that the
> question mark "?" means to get the documentation of the relevant
> method, function, or class.
> 

Thats clear. I love and use the "?"-feature of ipython since I the
beginning of my python usage some years ago.

The question is: Where should I have found the information about the
existence of .numpy? And where will the next one with that problem find
it? Is there something like the scipy cookbook for sage where this could
be added?

At least this thread is tracked by search engines, hence someone who
uses the right keywords will stumble on it.

Many Thanks again.

Bastian.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Hensel lifting

2010-04-19 Thread John Cremona
A3(list(P)) works here -- answering the easier of your two questions!

John Cremona


On Apr 19, 2:33 am, vdelecroix <20100.delecr...@gmail.com> wrote:
> Hello,
>
> I'm trying to implement an algorithm for factorization of bivariate
> polynomials. A step of the algorithm is Hensel lifting and I was not
> able to coerce a Taylor development of degree k into a Taylor
> development of degree k+1. More precisely, I have a polynomial in the
> quotient ring R[t] / (t^k) and I want to see it in R[t] / (t^(k+1)). I
> would like to use the quotient rings because many calculus are done in
> each of them.
>
> My two attempts were the followings
> {{{
> sage: K. = PolynomialRing(QQ,'t')
> sage: A2 = QuotientRing(K, Ideal(t^2))
> sage: A3 = QuotientRing(K, Ideal(t^3))
> sage: P = A2(t^4 + 3*t + 1)
>
> }}}
>
> First method: try to coerce
> {{{
> sage: A3(P)
> Traceback (click to the left of this block for traceback)
> ...
> TypeError: Unable to coerce 3*tbar + 1 ( 'sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotie
> \
> ntRingElement'>) to Rational
>
> }}}
>
> Second method substitute
> {{{
> sage: P.substitute(t=A3.gen()).parent()
> sage: P.parent()
> Univariate Quotient Polynomial Ring in tbar over Rational Field with
> modulus t^2
>
> }}}
>
> Is Hensel lifting yet implemented in Sage ? Does anybody have a
> solution for this particular problem ?
>
> Thanks,
> Vincent
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/sage-support
> URL:http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] allocation in a list?

2010-04-19 Thread Alex Leone
In python, assignment is a statement, not an expression (it has no
return value).

This is unlike many other programming languages, such as C:
if ( (r = result()) == 3) {
  // do something with r
}

In python:
>>> (a = 10) + 2
  File "", line 1
(a = 10) + 2
   ^
SyntaxError: invalid syntax


 - Alex

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] allocation in a list?

2010-04-19 Thread Martin Albrecht
On Monday 19 April 2010, bb wrote:
> sage: x=[a=5, a+=5, a-=3, a*=5, a/=8]

This is really a question about Python syntax, but here's a way:

sage: a= 5
sage: x = [a,a+5,a-3,a/8]

Cheers,
Martin


-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] allocation in a list?

2010-04-19 Thread bb

bb schrieb:

sage: x=[a=5, a+=5, a-=3, a*=5, a/=8]

  File "", line 1
x=[a=Integer(5), a+=Integer(5), a-=Integer(3), a*=Integer(5), 
a/=Integer(8)]

^
SyntaxError: invalid syntax

sage: x=[1,2+5,3]
sage: x
[1, 7, 3]
sage: x=[a=1,2+5,3]

  File "", line 1
x=[a=Integer(1),Integer(2)+Integer(5),Integer(3)]
^
SyntaxError: invalid syntax

sage: x=[a=5, b+=5, c-=3, d*=5, e/=8]

  File "", line 1
x=[a=Integer(5), b+=Integer(5), c-=Integer(3), d*=Integer(5), 
e/=Integer(8)]

^
SyntaxError: invalid syntax

sage:

Obviously is it in Sage not possible to calculate list elements with 
an allocation??


Reagrds BB

To prevent some questions: I initiated b,c,d,e in the above example, but 
did not copy that!


In Octave (MATLAB) that works ok:
octave:1> x=[a=5,a+=5]
x =

   5   10

octave:2>

Maxima does not know that shostcut-operators at all.

SciLab cannot handle this either.

-->x=[a=5,a+=5]
!--error 4
Undefinierte Variable: a

That seems to be a hereditary defect coming from python:

IDLE 2.6.4 
>>> x=[a=5, a+= 5]

SyntaxError: invalid syntax
>>> a=5
>>> a+=5
>>> a
10
>>>


I think there is nothing possible to change that?

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] allocation in a list?

2010-04-19 Thread bb

sage: x=[a=5, a+=5, a-=3, a*=5, a/=8]

  File "", line 1
x=[a=Integer(5), a+=Integer(5), a-=Integer(3), a*=Integer(5), 
a/=Integer(8)]

^
SyntaxError: invalid syntax

sage: x=[1,2+5,3]
sage: x
[1, 7, 3]
sage: x=[a=1,2+5,3]

  File "", line 1
x=[a=Integer(1),Integer(2)+Integer(5),Integer(3)]
^
SyntaxError: invalid syntax

sage: x=[a=5, b+=5, c-=3, d*=5, e/=8]

  File "", line 1
x=[a=Integer(5), b+=Integer(5), c-=Integer(3), d*=Integer(5), 
e/=Integer(8)]

^
SyntaxError: invalid syntax

sage:

Obviously is it in Sage not possible to calculate list elements with an 
allocation??


Reagrds BB

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Sage/Maxima desolve_rk4 problem

2010-04-19 Thread jvkersch
Hi all,

Technically, this is not a Sage problem, but I figured I would post it
here anyway since others might have run into the same problem, and I'm
also trying to solve the problem using some Sage/python trickery.

The problem concerns the use of symbolic constants such as pi in
numerical integration with desolve_rk4.  The following code is adapted
from the manual page for desolve_rk4 -- note especially the constant
pi in the specification of the ODE:

  x, y = var('x y')
  desolve_rk4(x*y*(2-y) + pi, y, ics=[0, 1], end_points=1, step=0.5)

and raises the following error:

  TypeError: Error executing code in Maxima
  CODE:
sage1 : rk(%pi-x*(y-2)*y,y,1,[x,0,1,0.500])$
  Maxima ERROR: Inconsistent set of equations and variables

This same error occurs whenever you have an ODE with pi in it, no
matter how simple. The error persists when directly running this
command in Maxima, but works fine (both in Sage and Maxima) when
manually replacing pi by 3.14...   Since I don't know any Maxima, I
have no idea of what the problem could be or where to look.

So, I was wondering if there is a way to have Sage replace the %pi
when invoking Maxima by the corresponding numerical value?  I guess I
could store my ODE in a string and use a regular expression to get rid
of any pi's myself, but that seems very inelegant.  Is there anything
you would recommend?

Thanks a lot,
Joris

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Saving 3D plots

2010-04-19 Thread kcrisman
Dear Dox,

I don't know that you can do it via Jmol, but perhaps via Tachyon.

sage: sage.plot.plot3d.tachyon?

I imagine that looking more in depth at the Tachyon documentation (not
just the result of the above command) might help you more.  I am sorry
that I don't know the answer to this, though.

I am copying this on sage-support, which is a more appropriate forum
for it.

- kcrisman

On Apr 17, 6:46 pm, Dox  wrote:
> Hi guys!
> I was wandering... Is it possible to choose the `angle of viewing' a
> 3D plot at the time of saving it?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-edu" group.
> To post to this group, send email to sage-...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sage-edu+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/sage-edu?hl=en.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Vector solutions, a basic question.

2010-04-19 Thread Jason Grout

On 04/16/2010 03:46 PM, Alec Mihailovs wrote:

On Apr 16, 4:01 pm, Alexander Shyrokov  wrote:

I have derived the equation, which looks like this:
((T - (E -T) *(H.dot(N) - T.dot(N))/(E - T).dot(N) - H) / S) ==  Mp


I'll take a look at it later. But in general, if you have a system of
linear equations, you can write it in a matrix form

A*x=b

in which case the solution can be obtained as

x=A.inverse()*b

That should work better than solve.



And A\b or A.solve_right(b) should work "better" than trying to get the 
inverse of A (i.e., should probably be a bit faster, take less memory, 
and if the matrices are numerical, have less error).


Thanks,

Jason


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: reset()

2010-04-19 Thread bb

Alex Ghitza schrieb:

On Mon, 19 Apr 2010 13:09:34 +0200, bb  wrote:
  

Tnx!

Is there any explanation why the magic ends with del ?

sage: del x
sage: x
---
NameError Traceback (most recent call last)

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/all_cmdline.pyc 
in ()


NameError: name 'x' is not defined
sage:


So the feature theses fits like a glove?



A very popular feature is introspection.  In this particular case, doing

sage: reset?

would tell you what reset does:

"Delete all user defined variables, reset all globals variables back to
their default state, and reset all interfaces to other computer algebra
systems."

The feature that Harald was referring to is that x is a predefined
global variable.  You know this by doing

sage: globals()['x']
x

So now we know what the Sage function "reset" does.  "del", on the other
hand, is a Python builtin function.  Googling "del python" gives that
"del can also be used to delete entire variables".

So "del x" deletes the global variable from globals():

sage: del x
sage: globals()['x']
---
KeyError  Traceback (most recent call last)

/home/ghitza/ in ()

KeyError: 'x'


But if you reset again, x is back:

sage: reset
sage: globals()['x']
x


And everything is behaving exactly as the docstrings indicate.


Alex


  

Thank you very much for your help!

I found that this explanation also holds for the global variable "_"!

Reagrds BB


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: reset()

2010-04-19 Thread Alex Ghitza
On Mon, 19 Apr 2010 13:09:34 +0200, bb  wrote:
> Tnx!
> 
> Is there any explanation why the magic ends with del ?
> 
> sage: del x
> sage: x
> ---
> NameError Traceback (most recent call last)
> 
> /home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/all_cmdline.pyc 
> in ()
> 
> NameError: name 'x' is not defined
> sage:
> 
> 
> So the feature theses fits like a glove?

A very popular feature is introspection.  In this particular case, doing

sage: reset?

would tell you what reset does:

"Delete all user defined variables, reset all globals variables back to
their default state, and reset all interfaces to other computer algebra
systems."

The feature that Harald was referring to is that x is a predefined
global variable.  You know this by doing

sage: globals()['x']
x

So now we know what the Sage function "reset" does.  "del", on the other
hand, is a Python builtin function.  Googling "del python" gives that
"del can also be used to delete entire variables".

So "del x" deletes the global variable from globals():

sage: del x
sage: globals()['x']
---
KeyError  Traceback (most recent call last)

/home/ghitza/ in ()

KeyError: 'x'


But if you reset again, x is back:

sage: reset
sage: globals()['x']
x


And everything is behaving exactly as the docstrings indicate.


Alex


-- 
Alex Ghitza -- http://aghitza.org/
Lecturer in Mathematics -- The University of Melbourne -- Australia

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Conversion from number field to polynomial

2010-04-19 Thread Samuele Anni
Thank you very much, it woks perfectly.
Samuele

2010/4/19 luisfe :
>
>
> On 19 abr, 12:07, "samuele.anni"  wrote:
>> Hello,
>> I'm trying to implement an algorithm for complete my thesis work about
>> congruence between modular forms and Galois representation.
>> A step of the algorithm I am working on consists in replacing a
>> generator of the number field with a fixed value obtained, clearly the
>> command substitute cannot work because the elements of the matrix are
>> algebraic integers of the number field so nothing is seen as a
>> “variable”. The only thing that comes in my mind is to find a way to
>> convert my vector into a polynomial vector substituing to alpha a
>> variable x, but I cannot find a way to do this.
>>
>> >>sage: K. = NumberField(x^4 - 30*x^2 - 40*x + 5);K
>>
>> Number Field in alpha with defining polynomial x^4 - 30*x^2 - 40*x + 5
>>
>> >>sage: A=[alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 
>> >>+4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 
>> >>-4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 
>> >>+8*alpha^2 + 3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha + 
>> >>33/2,-3/2*alpha^3 + 11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 - 7*alpha^2 
>> >>-4*alpha + 15, -1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha - 1/2, -alpha^3 
>> >>+6*alpha^2 - alpha - 16, -alpha^3 + 3*alpha^2 + 6*alpha - 12, 3/2*alpha^3- 
>> >>11/2*alpha^2 - 5/2*alpha + 21/2, -3*alpha^3 + 13*alpha^2 + 5*alpha -35];
>> >>sage: A1=[A[i].substitute(alpha=12) for i in range(0, len(A))];A1
>>
>> [alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 +
>> 4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 -
>> 4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 +
>> 8*alpha^2 + 3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha +
>> 33/2, -3/2*alpha^3 + 11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 -
>> 7*alpha^2 - 4*alpha + 15, -1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha -
>> 1/2, -alpha^3 + 6*alpha^2 - alpha - 16, -alpha^3 + 3*alpha^2 + 6*alpha
>> - 12, 3/2*alpha^3 - 11/2*alpha^2 - 5/2*alpha + 21/2, -3*alpha^3 +
>> 13*alpha^2 + 5*alpha - 35]
>>
>> Does anybody know a way to solve my problem?
>> Thanks for the help               Samuele
>
> If x is an element of K, x.polynomial() returns a representation of x
> as a polynomial (the representative of x of minimal degree thinking
> K=QQ[x]/f(x))
>
> So, you can do
>
> sage: A1=[x.polynomial()(12) for x in A];A1
> [11, 1013/2, -1150, 117, 2278, -2298, -2289, 3093/2, -3543/2, 2415,
> -1525/2, -892, -1236, 3561/2, -3287]
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: reset()

2010-04-19 Thread bb

Harald Schilly schrieb:

On Apr 19, 11:36 am, bb  wrote:
  

There is magically declared a variable x, even after each reset()?

Is this a feature or a bug?



Short answer: feature ;)

(and there are also other magically declared variables, like RDF ...)

H

  

Tnx!

Is there any explanation why the magic ends with del ?

sage: del x
sage: x
---
NameError Traceback (most recent call last)

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/all_cmdline.pyc 
in ()


NameError: name 'x' is not defined
sage:


So the feature theses fits like a glove?

Regards bb

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Conversion from number field to polynomial

2010-04-19 Thread luisfe


On 19 abr, 12:07, "samuele.anni"  wrote:
> Hello,
> I'm trying to implement an algorithm for complete my thesis work about
> congruence between modular forms and Galois representation.
> A step of the algorithm I am working on consists in replacing a
> generator of the number field with a fixed value obtained, clearly the
> command substitute cannot work because the elements of the matrix are
> algebraic integers of the number field so nothing is seen as a
> “variable”. The only thing that comes in my mind is to find a way to
> convert my vector into a polynomial vector substituing to alpha a
> variable x, but I cannot find a way to do this.
>
> >>sage: K. = NumberField(x^4 - 30*x^2 - 40*x + 5);K
>
> Number Field in alpha with defining polynomial x^4 - 30*x^2 - 40*x + 5
>
> >>sage: A=[alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 
> >>+4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 
> >>-4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 +8*alpha^2 
> >>+ 3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha + 33/2,-3/2*alpha^3 
> >>+ 11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 - 7*alpha^2 -4*alpha + 15, 
> >>-1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha - 1/2, -alpha^3 +6*alpha^2 - alpha - 
> >>16, -alpha^3 + 3*alpha^2 + 6*alpha - 12, 3/2*alpha^3- 11/2*alpha^2 - 
> >>5/2*alpha + 21/2, -3*alpha^3 + 13*alpha^2 + 5*alpha -35];
> >>sage: A1=[A[i].substitute(alpha=12) for i in range(0, len(A))];A1
>
> [alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 +
> 4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 -
> 4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 +
> 8*alpha^2 + 3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha +
> 33/2, -3/2*alpha^3 + 11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 -
> 7*alpha^2 - 4*alpha + 15, -1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha -
> 1/2, -alpha^3 + 6*alpha^2 - alpha - 16, -alpha^3 + 3*alpha^2 + 6*alpha
> - 12, 3/2*alpha^3 - 11/2*alpha^2 - 5/2*alpha + 21/2, -3*alpha^3 +
> 13*alpha^2 + 5*alpha - 35]
>
> Does anybody know a way to solve my problem?
> Thanks for the help               Samuele

If x is an element of K, x.polynomial() returns a representation of x
as a polynomial (the representative of x of minimal degree thinking
K=QQ[x]/f(x))

So, you can do

sage: A1=[x.polynomial()(12) for x in A];A1
[11, 1013/2, -1150, 117, 2278, -2298, -2289, 3093/2, -3543/2, 2415,
-1525/2, -892, -1236, 3561/2, -3287]

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Conversion from number field to polynomial

2010-04-19 Thread samuele.anni
Hello,
I'm trying to implement an algorithm for complete my thesis work about
congruence between modular forms and Galois representation.
A step of the algorithm I am working on consists in replacing a
generator of the number field with a fixed value obtained, clearly the
command substitute cannot work because the elements of the matrix are
algebraic integers of the number field so nothing is seen as a
“variable”. The only thing that comes in my mind is to find a way to
convert my vector into a polynomial vector substituing to alpha a
variable x, but I cannot find a way to do this.


>>sage: K. = NumberField(x^4 - 30*x^2 - 40*x + 5);K
Number Field in alpha with defining polynomial x^4 - 30*x^2 - 40*x + 5

>>sage: A=[alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 
>>+4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 
>>-4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 +8*alpha^2 + 
>>3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha + 33/2,-3/2*alpha^3 + 
>>11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 - 7*alpha^2 -4*alpha + 15, 
>>-1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha - 1/2, -alpha^3 +6*alpha^2 - alpha - 
>>16, -alpha^3 + 3*alpha^2 + 6*alpha - 12, 3/2*alpha^3- 11/2*alpha^2 - 
>>5/2*alpha + 21/2, -3*alpha^3 + 13*alpha^2 + 5*alpha -35];

>>sage: A1=[A[i].substitute(alpha=12) for i in range(0, len(A))];A1
[alpha - 1, 1/2*alpha^3 - 5/2*alpha^2 - 1/2*alpha + 17/2, -alpha^3 +
4*alpha^2 + alpha - 10, alpha^2 - 2*alpha - 3, 2*alpha^3 - 8*alpha^2 -
4*alpha + 22, -2*alpha^3 + 8*alpha^2 + 2*alpha - 18, -2*alpha^3 +
8*alpha^2 + 3*alpha - 21, 3/2*alpha^3 - 15/2*alpha^2 + 3/2*alpha +
33/2, -3/2*alpha^3 + 11/2*alpha^2 + 7/2*alpha - 27/2, 2*alpha^3 -
7*alpha^2 - 4*alpha + 15, -1/2*alpha^3 + 1/2*alpha^2 + 5/2*alpha -
1/2, -alpha^3 + 6*alpha^2 - alpha - 16, -alpha^3 + 3*alpha^2 + 6*alpha
- 12, 3/2*alpha^3 - 11/2*alpha^2 - 5/2*alpha + 21/2, -3*alpha^3 +
13*alpha^2 + 5*alpha - 35]

Does anybody know a way to solve my problem?
Thanks for the help   Samuele

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: reset()

2010-04-19 Thread Harald Schilly
On Apr 19, 11:36 am, bb  wrote:
> There is magically declared a variable x, even after each reset()?
>
> Is this a feature or a bug?

Short answer: feature ;)

(and there are also other magically declared variables, like RDF ...)

H

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] reset()

2010-04-19 Thread bb

I have some problem with reset():


sage: reset()
sage: x
x
sage: a
---
NameError Traceback (most recent call last)

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/all_cmdline.pyc 
in ()


NameError: name 'a' is not defined
sage: a=x
sage: a
x
sage: reset()
sage: y
---
NameError Traceback (most recent call last)

/home/bb/sage-4.3.5/local/lib/python2.6/site-packages/sage/all_cmdline.pyc 
in ()


NameError: name 'y' is not defined
sage: y=x
sage: y
x

There is magically declared a variable x, even after each reset()?

Is this a feature or a bug?

Regards BB

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] "Undo" function not working properly?

2010-04-19 Thread John Cremona
For the first time, I just tried using the "Undo" function on a
worksheet since I had messed something up.  But all the revisions I
was offered, even those from a day ago, look the same as the current
version!

This is 4.3.5 running on a 64-bit ubuntu server.

I have found it very useful that my students can work on something in
a worksheet owned by them, and then share it with me, so that when
they come to see me to talk about it we can go through it in detail on
my own computer at our meeting.  (This is really a fantastic feature).
 But just now I was having a look at a student's worksheet the day
before our meeting, and made some changed to it which I later
regretted and tried to revert.  Without success

Any suggestions welcome!

John Cremona

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] benchmarking 2D numerical integration

2010-04-19 Thread William Stein
On Mon, Apr 19, 2010 at 12:15 AM, wb  wrote:
> I've tried to do timing of simple 2D integrals using sage/mpmath vs.
> mathematica.
>
> Example:
>
> ===
> sage: version()
> 'Sage Version 4.3.3, Release Date: 2010-02-21'
>
> sage: %time quadgl(lambda x,y: sin(x)*cos(y)/(x**2+y**2+1),[-8, 10],
> [-6,10])
> CPU times: user 15.96 s, sys: 0.02 s, total: 15.98 s
>
> *** Wall time: 16.00 s 
>
> mpf('-0.0043118150747524404')
>
> sage: %time quadts(lambda x,y: sin(x)*cos(y)/(x**2+y**2+1),[-8, 10],
> [-6,10])
> CPU times: user 43.77 s, sys: 0.08 s, total: 43.85 s
>
> ** Wall time: 43.86 s *
>
> mpf('-0.0043118140088211727')
>
> 
> Mathematica Version 7.0.0
>
> NIntegrate[Sin[x] Cos[y]/(x^2 + y^2 + 1), {x, -8, 10}, {y, -6, 10}] //
> Timing
>
> {
>
> ** 2.78817384` 
>
>
> , -0.004311814008789632`}
>
> This is a typical result. Mathematica seems to be faster typically by
> a factor of 5 and sometimes much more with no tweaking of the method
> of integration. If I play with the method of integration more than an
> order of magnitude of can be reached quite easily for mathematica ...
>
> Am I doing this right?

No.  Don't use lambda.  Use fast_float:


sage: f(x,y) = sin(x)*cos(y)/(x**2+y**2+1)
sage: import mpmath
sage: time mpmath.quadgl(fast_float(f), [-8, 10],[-6,10])
CPU times: user 0.42 s, sys: 0.01 s, total: 0.42 s
Wall time: 0.44 s
mpf('-0.0043118150747524474')

If f is a symbolic expression, then fast_float(f) returns a version
that is optimized for being called.

> I.e. is this performance difference roughly
> what I should expect for this kind of task?
> Is there another way to do numerical integration in sage?
>
> Regards,
> wb
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] benchmarking 2D numerical integration

2010-04-19 Thread wb
I've tried to do timing of simple 2D integrals using sage/mpmath vs.
mathematica.

Example:

===
sage: version()
'Sage Version 4.3.3, Release Date: 2010-02-21'

sage: %time quadgl(lambda x,y: sin(x)*cos(y)/(x**2+y**2+1),[-8, 10],
[-6,10])
CPU times: user 15.96 s, sys: 0.02 s, total: 15.98 s

*** Wall time: 16.00 s 

mpf('-0.0043118150747524404')

sage: %time quadts(lambda x,y: sin(x)*cos(y)/(x**2+y**2+1),[-8, 10],
[-6,10])
CPU times: user 43.77 s, sys: 0.08 s, total: 43.85 s

** Wall time: 43.86 s *

mpf('-0.0043118140088211727')


Mathematica Version 7.0.0

NIntegrate[Sin[x] Cos[y]/(x^2 + y^2 + 1), {x, -8, 10}, {y, -6, 10}] //
Timing

{

** 2.78817384` 


, -0.004311814008789632`}

This is a typical result. Mathematica seems to be faster typically by
a factor of 5 and sometimes much more with no tweaking of the method
of integration. If I play with the method of integration more than an
order of magnitude of can be reached quite easily for mathematica ...

Am I doing this right? I.e. is this performance difference roughly
what I should expect for this kind of task?
Is there another way to do numerical integration in sage?

Regards,
wb

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org