Re: [sage-support] Using PyWavelets in Sage

2010-09-16 Thread Minh Nguyen
Hi,

On Fri, Sep 17, 2010 at 12:07 PM, j wade  wrote:
> I would like to use PyWavelets (http://www.pybytes.com/pywavelets/) in
> Sage.
>
> I am running Sage 4.3.4 on Ubuntu 9.10.
>
> I have installed python-pywt using Synaptic File Manager, but I am not
> sure what to do beyond this.  I have refreshed the libraries, and
> tried
>
> import scipy
> from scipy import pywt
>
> and
>
> import scipy
> import pywt
>
> but neither command recognizes pywt.

The above steps failed because by default Sage doesn't recognize
Python packages that you have installed system-wide. That is, the
package manager Synaptic installs packages system-wide, whereas the
packages (including Python ones) in Sage are installed specifically
under the SAGE_ROOT top-level directory. So when you issued

import pywt

from within a Sage session, Sage couldn't find pywt because PyWavelets
was not installed under a place where Sage would by default recognize.


> If someone out there is using pywavelets with Sage, I'd appreciate it
> if you could let me know how you were able to get it to work.

Here are the steps that should allow you to install and use PyWavelets
from within Sage.

(1) Download a source release of PyWavelets from
http://pypi.python.org/pypi/PyWavelets/. I downloaded
PyWavelets-0.2.0.tar.bz2 and uncompressed it.

(2) Get the absolute path to your local Sage installation. In my case, it's

/dev/shm/mvngu/sage-4.5.3

(3) Navigate to the top-level directory of the uncompressed PyWavelets
package and install it:

$ cd /path/to/PyWavelets-0.2.0/
$ /dev/shm/mvngu/sage-4.5.3/sage -python setup.py install


(4) Load Sage and start using PyWavelets:

$ /dev/shm/mvngu/sage-4.5.3/sage
--
| Sage Version 4.5.3, Release Date: 2010-09-04   |
| Type notebook() for the GUI, and license() for information.|
--
sage: import pywt
sage: pywt.families()
['haar', 'db', 'sym', 'coif', 'bior', 'rbio', 'dmey']
sage: w = pywt.Wavelet('db3')
sage: print w
Wavelet db3
  Family name:Daubechies
  Short name: db
  Filters length: 6
  Orthogonal: True
  Biorthogonal:   True
  Symmetry:   asymmetric

-- 
Regards
Minh Van Nguyen

-- 
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] Using PyWavelets in Sage

2010-09-16 Thread j wade
I would like to use PyWavelets (http://www.pybytes.com/pywavelets/) in
Sage.

I am running Sage 4.3.4 on Ubuntu 9.10.

I have installed python-pywt using Synaptic File Manager, but I am not
sure what to do beyond this.  I have refreshed the libraries, and
tried

import scipy
from scipy import pywt

and

import scipy
import pywt

but neither command recognizes pywt.

If someone out there is using pywavelets with Sage, I'd appreciate it
if you could let me know how you were able to get it to work.

-- 
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: bug in vector

2010-09-16 Thread Jason Grout

On 9/16/10 9:01 PM, Jason Grout wrote:


A patch will be up at #9928 in a few seconds fixing this.



Patch is up; feel free to review it!

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: bug in vector

2010-09-16 Thread Jason Grout

On 9/16/10 8:12 PM, VictorMiller wrote:

Observe (using sage 4.5.2 on my mac):

sage: import numpy
sage: a = numpy.array([1,2,3])
sage: v = vector(a)

Traceback (click to the left of this block for traceback)
...
TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and
'int'

The error message is particularly weird.



The error comes because the order for testing input types is wrong (and 
so it tries to construct the vector space (None)^3 instead of ZZ^3).


A patch will be up at #9928 in a few seconds fixing this.

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] bug in vector

2010-09-16 Thread VictorMiller
Observe (using sage 4.5.2 on my mac):

sage: import numpy
sage: a = numpy.array([1,2,3])
sage: v = vector(a)

Traceback (click to the left of this block for traceback)
...
TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and
'int'

The error message is particularly weird.

Victor

-- 
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: inserting number into symbolic equation

2010-09-16 Thread TianWei
> > Hi, I'm wondering if it is possible to insert a number into symbolic
> > equation. For example:
>
> > sage: y = x^2
> > sage: diff(y)
> >2*x
>
> > now is it possible to take the results of the derivative, define x as
> > say 3, and get a numeric answer? Thanks
>
> Try this:
> sage: g = diff(y)
> sage: g
>  x |--> 2*x
> sage: g(3)
>  6

That usage is deprecated. "g" in this case would evaluate to the
expression "2*x", not the function "x |--> 2*x".

You can plug in a value for x using the "subs" method:

sage: y = x^2
sage: diff(y)
2*x
sage: diff(y).subs(x=3)
6
sage: diff(y).subs(x=pi)
2*pi

Alternatively, if you define "y" as a function, "g" would be a
function:

sage: y(x) = x^2
sage: y
x |--> x^2
sage: g = diff(y)
sage: g
x |--> 2*x
sage: g(3)
6
sage: g(pi)
2*pi

Hope this helps.

-- Tianwei

-- 
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: n() returns symbolic expression

2010-09-16 Thread TianWei
> sage: a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/
> (sqrt(3) + 5)
> sage:
> a.imag().n()
> 0.939469338708203*sin(0.500*pi)

Here's a simpler example:

sage: b = sqrt(-log(2))
sage: print b.imag().n()
0.832554611157698*sin(0.500*pi)

-- Tianwei

-- 
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: installation problem

2010-09-16 Thread Dan Drake
On Thu, 16 Sep 2010 at 07:43PM +0100, robin hankin wrote:
> I did try to compile my own, but ran in to utter dependency hell.

The Sage source should include very nearly everything it needs to build.
There are very few dependencies. What kind of "dependency hell" did you
run into?

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


Re: [sage-support] integer factorization benchmarks

2010-09-16 Thread Dr. David Kirkby

On 09/16/10 11:23 PM, Dr. David Kirkby wrote:

On 09/16/10 09:10 PM, Greg Marks wrote:

Out of curiosity...

At http://sagemath.org/tour-benchmarks.html the CPU time
given for factorization of the integer 2^512 - 1 with SAGE
version 4.1.1 is 92.29 sec. I just tried this with SAGE
version 4.5.2, running under 64-bit Linux on a laptop with
an Intel Core 2 Duo P8600 CPU @ 2.40 GHz and 2.9 GiB RAM,
and the same calculation required only 31.39 sec. CPU time.
(The same factorization, on the same computer, using Maple 14
required 185.43 sec., incidentally. I don't have a recent
version of Mathematica to compare.)


On Mathematica 7, Solaris x86 on a quad core 3.33 GHz Intel Xeon W3580.

I note Mathematica does not use many cores for this (I assume single
threaded). I would have thought this is the sort of thing that could
have been improved with a parallel algorithm, or perhaps for non-trivial
factorisations thats not so. But I would have thought it was.

In[3]:= Timing[ FactorInteger[2^512-1]]

Out[3]= {151.054, {{3, 1}, {5, 1}, {17, 1}, {257, 1}, {641, 1}, {65537, 1},

 > {274177, 1}, {6700417, 1}, {67280421310721, 1}, {1238926361552897, 1},

 > {59649589127497217, 1}, {5704689200685129054721, 1},

 > {93461639715357977769163558199606896584051237541638188580280321, 1}}}



For context, on the Same machine,

sage: timeit('factor(2^512-1)')
5 loops, best of 3: 43.9 s per loop

However, this is a 32-bit build of Sage. Anything using large integers will be 
significantly slower if using 32-bit words rather than 64-bit words, so I would 
expect this to improve with a 64-bit build of Sage on OpenSolaris. But Sage 
beats Mathematica by a factor of around 3.4, even though Sage is 32-bit and 
Mathematica is 64-bit on this machine.


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


Re: [sage-support] integer factorization benchmarks

2010-09-16 Thread Dr. David Kirkby

On 09/16/10 09:10 PM, Greg Marks wrote:

Out of curiosity...

At http://sagemath.org/tour-benchmarks.html the CPU time
given for factorization of the integer  2^512 - 1  with SAGE
version 4.1.1 is 92.29 sec.  I just tried this with SAGE
version 4.5.2, running under 64-bit Linux on a laptop with
an Intel Core 2 Duo P8600 CPU @ 2.40 GHz and 2.9 GiB RAM,
and the same calculation required only 31.39 sec. CPU time.
(The same factorization, on the same computer, using Maple 14
required 185.43 sec., incidentally.  I don't have a recent
version of Mathematica to compare.)


On Mathematica 7, Solaris x86 on a quad core 3.33 GHz Intel Xeon W3580.

I note Mathematica does not use many cores for this (I assume single threaded). 
I would have thought this is the sort of thing that could have been improved 
with a parallel algorithm, or perhaps for non-trivial factorisations thats not 
so. But I would have thought it was.


In[3]:= Timing[ FactorInteger[2^512-1]]

Out[3]= {151.054, {{3, 1}, {5, 1}, {17, 1}, {257, 1}, {641, 1}, {65537, 1},

> {274177, 1}, {6700417, 1}, {67280421310721, 1}, {1238926361552897, 1},

> {59649589127497217, 1}, {5704689200685129054721, 1},

> {93461639715357977769163558199606896584051237541638188580280321, 1}}}

--
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: integer factorization benchmarks

2010-09-16 Thread Marshall Hampton
I just tried that on my laptop (2.4 GHz Intel Core 2 Duo, OS X 10.5)
and it took 74 seconds for sage-3.2, 73 seconds for sage-4.6.alpha0.
Since that difference is probably just noise, things haven't changed.

-M. Hampton

On Sep 16, 3:10 pm, Greg Marks  wrote:
> Out of curiosity...
>
> Athttp://sagemath.org/tour-benchmarks.htmlthe CPU time
> given for factorization of the integer  2^512 - 1  with SAGE
> version 4.1.1 is 92.29 sec.  I just tried this with SAGE
> version 4.5.2, running under 64-bit Linux on a laptop with
> an Intel Core 2 Duo P8600 CPU @ 2.40 GHz and 2.9 GiB RAM,
> and the same calculation required only 31.39 sec. CPU time.
> (The same factorization, on the same computer, using Maple 14
> required 185.43 sec., incidentally.  I don't have a recent
> version of Mathematica to compare.)
>
> The documentation says SAGE calls PARI for this calculation.
> Is the threefold improvement in speed due to any change in
> the factorization algorithm between SAGE 4.1.1 and SAGE 4.5.2?
> Or is it due to a difference in hardware, or something else?
>
> Best regards,
> Greg Marks
>
>     
>    | Greg Marks                                     |
>    | Department of Mathematics and Computer Science |
>    | St. Louis University                           |
>    | St. Louis, MO 63103-2007                       |
>    | U.S.A.                                         |
>    |                                                |
>    | Phone: (314)977-7206                           |
>    | Fax: (314)977-1452                             |
>    | Web:http://math.slu.edu/~marks               |
>     

-- 
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: integer factorization benchmarks

2010-09-16 Thread kcrisman
> The documentation says SAGE calls PARI for this calculation.
> Is the threefold improvement in speed due to any change in
> the factorization algorithm between SAGE 4.1.1 and SAGE 4.5.2?
> Or is it due to a difference in hardware, or something else?

And would it be even faster with the new PARI?

Incidentally, many of these pages get out of date very quickly.  For
instance, the official doc also still implies we don't support OS X 64-
bit - is this true?  http://www.sagemath.com/doc/installation/source.html
http://wiki.sagemath.org/SupportedPlatforms

- kcrisman

-- 
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] integer factorization benchmarks

2010-09-16 Thread Greg Marks
Out of curiosity...

At http://sagemath.org/tour-benchmarks.html the CPU time
given for factorization of the integer  2^512 - 1  with SAGE
version 4.1.1 is 92.29 sec.  I just tried this with SAGE
version 4.5.2, running under 64-bit Linux on a laptop with
an Intel Core 2 Duo P8600 CPU @ 2.40 GHz and 2.9 GiB RAM,
and the same calculation required only 31.39 sec. CPU time.
(The same factorization, on the same computer, using Maple 14
required 185.43 sec., incidentally.  I don't have a recent
version of Mathematica to compare.)

The documentation says SAGE calls PARI for this calculation.
Is the threefold improvement in speed due to any change in
the factorization algorithm between SAGE 4.1.1 and SAGE 4.5.2?
Or is it due to a difference in hardware, or something else?

Best regards,
Greg Marks


   | Greg Marks |
   | Department of Mathematics and Computer Science |
   | St. Louis University   |
   | St. Louis, MO 63103-2007   |
   | U.S.A. |
   ||
   | Phone: (314)977-7206   |
   | Fax: (314)977-1452 |
   | Web: http://math.slu.edu/~marks|


-- 
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: installation problem

2010-09-16 Thread Dr. David Kirkby

On 09/16/10 07:43 PM, robin hankin wrote:

Thanks for this Marshall.

I did try to compile my own, but ran in to utter dependency hell.

In the end I managed to get it to work by deleting some of the
readline libraries, but I don't understand why that worked.


Redline often causes problems on Sage. I know it has done on OpenSUSE


Would you say that the google groups you point me towards
is a more active forum than the sage-support mailing list?

Thanks again

Robin


The mailing list is a Google group. Marshall just poined you to the same place. 
You can post via google groups or email. It's the same support forum.


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


Re: [sage-support] Re: installation problem

2010-09-16 Thread robin hankin
Thanks for this Marshall.

I did try to compile my own, but ran in to utter dependency hell.

In the end I managed to get it to work by deleting some of the
readline libraries, but I don't understand why that worked.

Would you say that the google groups you point me towards
is a more active forum than the sage-support mailing list?

Thanks again

Robin



On Thu, Sep 16, 2010 at 7:17 PM, Marshall Hampton  wrote:
> Your error message looks exactly like the one reported here a few
> months ago:
>
> http://groups.google.com/group/sage-support/browse_thread/thread/aba48495d9c09e03/f25d062b6764492f
>
> In that case it was somehow caused by an upgrade after installing the
> binary.  One option would be to install a source version.
>
> -M. Hampton
>
> On Sep 16, 8:04 am, robin hankin  wrote:
>> Hi.   suse 11.3, trying to work with sage 4.5.3
>>
>> I get various problems when trying to execute sage
>> (transcript below).
>>
>> Any ideas?
>>
>> thanks
>>
>> rksh
>>
>> le112:~/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux% ./sage
>> --
>> | Sage Version 4.5.3, Release Date: 2010-09-04                       |
>> | Type notebook() for the GUI, and license() for information.        |
>> --
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
>> ERROR: An unexpected error occurred while tokenizing input
>> The following traceback may be corrupted or invalid
>> The error message is: ('EOF in multi-line statement', (69, 0))
>>
>> ERROR: An unexpected error occurred while tokenizing input
>> The following traceback may be corrupted or invalid
>> The error message is: ('EOF in multi-line statement', (47, 0))
>>
>> ---
>> RuntimeError                              Traceback (most recent call last)
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/IPython/ipmaker.pyc
>> in force_import(modname)
>>      64         reload(sys.modules[modname])
>>      65     else:
>> ---> 66         __import__(modname)
>>      67
>>      68
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/ipy_profile_sage.py
>> in ()
>>       5     preparser(True)
>>       6
>> > 7     import sage.all_cmdline
>>       8     sage.all_cmdline._init_cmdline(globals())
>>       9
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all_cmdline.py
>> in ()
>>      12 try:
>>      13
>> ---> 14     from sage.all import *
>>      15     from sage.calculus.predefined import x
>>      16     preparser(on=True)
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all.py
>> in ()
>>      62 get_sigs()
>>      63
>> ---> 64 from sage.misc.all       import *         # takes a while
>>      65
>>      66 from sage.misc.sh import sh
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/all.py
>> in ()
>>      65 from sage_eval import sage_eval, sageobj
>>      66
>> ---> 67 from sage_input import sage_input
>>      68
>>      69 from cython import cython_lambda, cython_create_local_so
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/sage_input.py
>> in ()
>>     161 """
>>     162
>> --> 163 from sage.misc.functional import parent
>>     164 import math
>>     165
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/functional.py
>> in ()
>>      36
>>      37
>> ---> 38 from sage.rings.complex_double import CDF
>>      39 from sage.rings.real_double import RDF, RealDoubleElement
>>      40
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/complex_double.pyx
>> in init sage.rings.complex_double
>> (sage/rings/complex_double.c:14319)()
>>
>> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/l

[sage-support] Re: installation problem

2010-09-16 Thread Marshall Hampton
Your error message looks exactly like the one reported here a few
months ago:

http://groups.google.com/group/sage-support/browse_thread/thread/aba48495d9c09e03/f25d062b6764492f

In that case it was somehow caused by an upgrade after installing the
binary.  One option would be to install a source version.

-M. Hampton

On Sep 16, 8:04 am, robin hankin  wrote:
> Hi.   suse 11.3, trying to work with sage 4.5.3
>
> I get various problems when trying to execute sage
> (transcript below).
>
> Any ideas?
>
> thanks
>
> rksh
>
> le112:~/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux% ./sage
> --
> | Sage Version 4.5.3, Release Date: 2010-09-04                       |
> | Type notebook() for the GUI, and license() for information.        |
> --
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (69, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (47, 0))
>
> ---
> RuntimeError                              Traceback (most recent call last)
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/IPython/ipmaker.pyc
> in force_import(modname)
>      64         reload(sys.modules[modname])
>      65     else:
> ---> 66         __import__(modname)
>      67
>      68
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/ipy_profile_sage.py
> in ()
>       5     preparser(True)
>       6
> > 7     import sage.all_cmdline
>       8     sage.all_cmdline._init_cmdline(globals())
>       9
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all_cmdline.py
> in ()
>      12 try:
>      13
> ---> 14     from sage.all import *
>      15     from sage.calculus.predefined import x
>      16     preparser(on=True)
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all.py
> in ()
>      62 get_sigs()
>      63
> ---> 64 from sage.misc.all       import *         # takes a while
>      65
>      66 from sage.misc.sh import sh
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/all.py
> in ()
>      65 from sage_eval import sage_eval, sageobj
>      66
> ---> 67 from sage_input import sage_input
>      68
>      69 from cython import cython_lambda, cython_create_local_so
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/sage_input.py
> in ()
>     161 """
>     162
> --> 163 from sage.misc.functional import parent
>     164 import math
>     165
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/functional.py
> in ()
>      36
>      37
> ---> 38 from sage.rings.complex_double import CDF
>      39 from sage.rings.real_double import RDF, RealDoubleElement
>      40
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/complex_double.pyx
> in init sage.rings.complex_double
> (sage/rings/complex_double.c:14319)()
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/rings/complex_field.pyc
> in ComplexField(prec, names)
>      84         if not C is None:
>      85             return C
> ---> 86     C = ComplexField_class(prec)
>      87     cache[prec] = weakref.ref(C)
>      88     return C
>
> /home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/rings/complex_field.pyc
> in __init__(self, prec)
>     184         ParentWithGens.__init__(self, self._real_field(),
> ('I',), False, category = Fields())

[sage-support] Re: Simplifying symbolic expressions containing vectors and matrices

2010-09-16 Thread Jason Grout

On 9/16/10 10:47 AM, miquel pericas wrote:

Hi,

I'm a collaborator of the author of the previous post. Let me try to
elaborate a little on what it is we want to do

Basically we are trying to simplify some complex symbolic expressions
we have generated which include matrices and vectors as variables.
Unfortunately these formulas are too long/complex to manipulate by
hand and we we are looking for some way to do this automatically.
Sage's manual explains how to simplify expressions with some
variables: The following example is extracted from the reference
manual

sage: var(’x, y, a, b, c’)
(x, y, a, b, c)
sage: f = x*(x-1)/(x^2 - 7) + y^2/(x^2-7) + 1/(x+1) + b/a + c/a; f
(x - 1)*x/(x^2 - 7) + y^2/(x^2 - 7) + b/a + c/a + 1/(x + 1)
sage: f.combine()
((x - 1)*x + y^2)/(x^2 - 7) + (b + c)/a + 1/(x + 1)

We want to do exactly the same, but in our case variables a,b,c, etc
would be vectors and matrices. Our question is: is it possible to use
sage to perform this kind of simplification with matrices and vectors?
Or, what is probably the same question, how can I generate variables
that are matrices and vectors?



It sounds like the thread I linked to in an earlier message on this 
thread contains code that would do things like you are asking about.



http://groups.google.com/group/sage-devel/browse_thread/thread/cafb486c79a2eb3c/d0bb78d09a4fb52a

For example, here is an example from that thread:

sage: Alg = SymbolicMatrixAlgebra(QQ)
sage: A = Alg.matrix("A", 3, 2)
sage: B = Alg.matrix("B", 3, 2)
sage: C = Alg.matrix("C", 2, 2)
sage: D = Alg.matrix("D", 2, 3)
sage: x = D * (A+B) * C
sage: x
D B C + D A C
sage: x.transpose()
C^t B^t D^t + C^t A^t D^t

Of course, you can deal with a vector by declaring a 3 by 1 matrix, for 
example:


sage: load('matrix.sage')
sage: Alg = SymbolicMatrixAlgebra(QQ)
sage: A = Alg.matrix("A",3,3)
sage: b = Alg.matrix("b",3,1)
sage: x = Alg.matrix("x",3,1) # a column vector
sage: A*x + A^2*x+A^3*x+A*b
A A A x + A A x + A b + A x

The code isn't complete, but it does do things like not assume matrices 
commute, handle inverses and transposes, etc.  I would love it if the 
code was polished and included in Sage.  I would probably make good use 
of it too.


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] Simplifying symbolic expressions containing vectors and matrices

2010-09-16 Thread miquel pericas
Hi,

I'm a collaborator of the author of the previous post. Let me try to
elaborate a little on what it is we want to do

Basically we are trying to simplify some complex symbolic expressions
we have generated which include matrices and vectors as variables.
Unfortunately these formulas are too long/complex to manipulate by
hand and we we are looking for some way to do this automatically.
Sage's manual explains how to simplify expressions with some
variables: The following example is extracted from the reference
manual

sage: var(’x, y, a, b, c’)
(x, y, a, b, c)
sage: f = x*(x-1)/(x^2 - 7) + y^2/(x^2-7) + 1/(x+1) + b/a + c/a; f
(x - 1)*x/(x^2 - 7) + y^2/(x^2 - 7) + b/a + c/a + 1/(x + 1)
sage: f.combine()
((x - 1)*x + y^2)/(x^2 - 7) + (b + c)/a + 1/(x + 1)

We want to do exactly the same, but in our case variables a,b,c, etc
would be vectors and matrices. Our question is: is it possible to use
sage to perform this kind of simplification with matrices and vectors?
Or, what is probably the same question, how can I generate variables
that are matrices and vectors?

I tried the following, but it seems this is not really generating
matrices and vectors:

sage: A = matrix(RR, 1000, 1000, sparse=True).parent()
sage: A
Full MatrixSpace of 1000 by 1000 sparse matrices over Real Field with
53 bits of precision
sage: matr = var('matr', domain=A)
sage: V = vector(RR, 1000).parent()
sage: V
Vector space of dimension 1000 over Real Field with 53 bits of
precision
sage: vec = var('vec', domain=V)

I hope someone here will be able to shed some light on this or suggest
a different approach/tool for achieving the symbolic simplification we
are pursuing

Thank you very much in advance,
Miquel

On Sep 10, 2:44 pm, BSC-BCN  wrote:
> Conjugate Gradient Algorithm
>
> 1.Compute r0:=b Ax0, p0:=r0
> 2.For j =0;1; ,until convergence Do:
> 3. aj :=(rj,rj)/(Apj,pj)
> 4.xj+1:= xj + ajpj
> 5.rj+1:=rj-ajApj
> 6.bj :=(rj+1,rj+1)/(rj,rj)
> 7.pj+1:=rj+1+bjpj
> 8.End Do
>
> Derivation for two steps in one go
>
> Compute r0:=bAx0, p0:=r0
> For j=0;2;,unitl convergence Do:
> aj := (rj,rj)/ (Apj,pj)
> xj+1:= xj + ajpj
> rj+1:=rj-ajApj
> bj :=(rj+1,rj+1)/(rj,rj)
> pj+1:=rj+1+bjpj
>
> aj+1 := (rj+1,rj+1)/ (APj+1,pj+1)
> xj+2:= xj+1 + aj+1pj+1
> rj+2:=rj+1-aj+1Apj+1
> bj+1 :=(rj+2,rj+2)/(rj+1,rj+1)
> pj+2:=rj+2+bj+1pj+1
>
> End Do
>
> All the equation must rely on the following initial variables:rj,pj,xj
> and on constant Matrix A
>
> Xj+2 have to be in function of rj,pj,xj and A it can't contain rj+1,pj
> +1,xj+1 and so on for rj+2, xj+2
>
> Some explanation:
>
> (rj,rj) is scalar-product of vectors rj,rj
> Apj is Matrix-vector multiplication where A is matrix and pj is a
> vector
> aj and bj are parametars
>
> I hope now is more clear what I want to do...As I said the expressions
> that I get are pretty big and I would like to use SAGE to try to
> simplify and make more compact. In case that I want to do 3 or more
> steps in one go the expressions would become even more bigger..
>
> Thanks
> Branimir
>
> On Sep 8, 3:23 pm, Jason Grout  wrote:
>
> > On 9/8/10 7:45 AM, BSC-BCN wrote:
>
> > I hope you can understand
>
> > > me...
>
> > I don't think I really do, but this thread might contain some useful
> > things for you:
>
> >http://groups.google.com/group/sage-devel/browse_thread/thread/cafb48...
>
> > 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] installation problem

2010-09-16 Thread robin hankin
Hi.   suse 11.3, trying to work with sage 4.5.3

I get various problems when trying to execute sage
(transcript below).

Any ideas?

thanks

rksh



le112:~/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux% ./sage
--
| Sage Version 4.5.3, Release Date: 2010-09-04   |
| Type notebook() for the GUI, and license() for information.|
--
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
sh: symbol lookup error: sh: undefined symbol: rl_filename_rewrite_hook
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (69, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (47, 0))

---
RuntimeError  Traceback (most recent call last)

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/IPython/ipmaker.pyc
in force_import(modname)
 64 reload(sys.modules[modname])
 65 else:
---> 66 __import__(modname)
 67
 68

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/ipy_profile_sage.py
in ()
  5 preparser(True)
  6
> 7 import sage.all_cmdline
  8 sage.all_cmdline._init_cmdline(globals())
  9

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all_cmdline.py
in ()
 12 try:
 13
---> 14 from sage.all import *
 15 from sage.calculus.predefined import x
 16 preparser(on=True)

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/all.py
in ()
 62 get_sigs()
 63
---> 64 from sage.misc.all   import * # takes a while
 65
 66 from sage.misc.sh import sh

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/all.py
in ()
 65 from sage_eval import sage_eval, sageobj
 66
---> 67 from sage_input import sage_input
 68
 69 from cython import cython_lambda, cython_create_local_so

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/sage_input.py
in ()
161 """
162
--> 163 from sage.misc.functional import parent
164 import math
165

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/misc/functional.py
in ()
 36
 37
---> 38 from sage.rings.complex_double import CDF
 39 from sage.rings.real_double import RDF, RealDoubleElement
 40

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/bin/complex_double.pyx
in init sage.rings.complex_double
(sage/rings/complex_double.c:14319)()

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/rings/complex_field.pyc
in ComplexField(prec, names)
 84 if not C is None:
 85 return C
---> 86 C = ComplexField_class(prec)
 87 cache[prec] = weakref.ref(C)
 88 return C

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/rings/complex_field.pyc
in __init__(self, prec)
184 ParentWithGens.__init__(self, self._real_field(),
('I',), False, category = Fields())
185 #self._populate_coercion_lists_()

--> 186
self._populate_coercion_lists_(coerce_list=[complex_number.RRtoCC(self._real_field(),
self)])
187
188 def __reduce__(self):

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/rings/complex_number.so
in sage.rings.complex_number.RRtoCC.__init__
(sage/rings/complex_number.c:13971)()

/home/rksh/Download/sage-4.5.3-linux-32bit-opensuse_11.1_i586-i686-Linux/local/lib/python2.6/site-packages/sage/categories/map.so
in sage.categori

[sage-support] Re: Graphics3d Object face_list()

2010-09-16 Thread Jason Grout

On 9/16/10 12:31 AM, TeamTeamUSA wrote:

Answering my own question.

The 3-tuples describe a triangle, the 4-tuples describe a
quadrilateral - 2 triangles sharing 2 vertices.




Can you please submit a patch clarifying the documentation?

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