[sage-support] Re: How do you plot equations if one parameter is a list of values ?

2008-11-10 Thread Stan Schymanski

Hi Boris,

Here is what I do:

# Define the variables:
var('GAMA BETA THETA')
# Create a dictionary with the parameter values for plotting:
pars = dict(GAMA=1,BETA=1,THETA=10)
# Define the symbolic function
J1(x) = GAMA*x + BETA*x^2 + THETA
# Substitute the parameters into the equation and plot it:
plot(J1(x).subs(pars),0,1)

Hope this helps.

Regards,
Stan


On Nov 11, 12:09 am, kex <[EMAIL PROTECTED]> wrote:
> Thank you,
>  if I assign a value I lose symbolic expression ?
> If I set GAMA=1 than gama in equation is not a letter/symbol of gama
> but it is a number that was asigned to gama?
> I though that I can keep the expression in symbolic notation and still
> plot/calculate the equation.
>
> So this means that the moment I asign values to a symbolic expression
> I lose the symbolic notation
> but than I am able to do plots of my function
>
> Thank you for your help Simon,
> Bye
> Boris
--~--~-~--~~~---~--~~
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-edu] Question on Lie Groups/Algebras

2008-11-10 Thread David Joyner

This group is for education-related questions, so I'm cross-posting to
sage-support.

First, dio you know about the Lie manual at
http://www-math.univ-poitiers.fr/~maavl/LiE/?
It is only in dvi form. If you need a pdf, just ask.


On Mon, Nov 10, 2008 at 11:29 PM, RamBo <[EMAIL PROTECTED]> wrote:
>
> What I want to do is very simple.
>
> 1. Generate a Special Orthogonal Group - SO(4)
> 2. List Basis vectors
> 3. Generate Lie Algebra
> 4. Generate Representation
> 5. Solve the secular equation
>
> using Sage's lie package. Not having much luck with documentation.
> Appreciate any clear directions.
>
> Cheers,
> Rama K
>
> >
>

--~--~-~--~~~---~--~~
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 gigantic lists being used to make specific graphs

2008-11-10 Thread DGaffney

The file-opening method seems to work out much better; I don't
necessarily know what was wrong, but this solved it to a reasonable
enough point for now; I'll keep you posted as we run a test on the
Swahili wikipedia, which should result in about 5000 ish nodes in the
largest connected component.

Thanks much guys!

Devin, Ian, Max
--~--~-~--~~~---~--~~
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 gigantic lists being used to make specific graphs

2008-11-10 Thread Jason Grout

William Stein wrote:
> sage: time a = 
> eval(open(get_remote_file('http://www.devingaffney.com/files/data.txt')).read())
> Attempting to load remote file: http://www.devingaffney.com/files/data.txt
> Loading: []
> CPU times: user 0.05 s, sys: 0.03 s, total: 0.09 s
> Wall time: 0.42 s

That line is *really* cool!

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: Problem with gigantic lists being used to make specific graphs

2008-11-10 Thread Jason Grout

DGaffney wrote:
> 
> Basically, the error is as such:
> 
> Our error is that when we use data of list length > 600ish, for some
> reason sage hangs. We know that this is not because we are impatient,
> and that it is actually working, because when the list length is under
> 600ish, it generates almost instantly. We want to be able to go to
> list lengths of over 2000, so this proves to be a deal breaker. We
> were originally using all of the node names as hash strings of the
> content, but we optimized it so we have smaller corresponding numbers
> that relate to each piece of content that we are interested in. Still,
> this has yielded no significant change. We think that this either is a
> problem with the allowed length of lists in Sage, but python has an
> allowable list length of around 2 billion, so that seems unlikely. We
> also wonder if there is possibly some memory cap that is reached with
> our data, but if it is that, the memory cap seems unreasonably small.
> Either way, any suggestions/workarounds would be greatly appreciated.
> If there is another library that would be better suited to these
> needs, just naming that would help us out a ton. Thanks much everyone!
> 
> Devin, Ian, and Max
> 
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 
> Sample data of what we have been putting into sage can be downloaded
> here: http://www.devingaffney.com/files/data.txt
> 
> We are trying to build a program as stipulated here:
> http://www.devingaffney.com/wikipedia-network-maps.
> 
> The basic thing we are inputting into sage when it hangs is this:
> 
> g = [data.txt file that is mentioned above] //this is where the hang
> occurs; even declaring g with "too much" data makes sage hang up.
> 
> G = Graph(g)
> G.show()


I took your data file and enclosed the dictionary in:

g = Graph()

and called the resulting file test.sage

Then I used it in sage.  I did it by launching Sage and doing

sage: load test.sage

and it created the graph in just a second or two.

My guess is that with such a large text string, putting the graph in a 
file and then loading it would be better than trying to copy and paste 
the data into the command line.

Alternatively, I copied and pasted your entire dictionary into a 
notebook cell like this:

g = Graph()

and evaluated the cell and it worked fine, but I think it was a bit slower.

Question for others: it seems like somewhere, sometime, I heard of a 
line length limit to the python command line (255 characters?  I'm not 
sure).  Has anyone else heard of such a thing?  That might be what is 
going on here.

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: Computing a sum

2008-11-10 Thread cesarnda

that is the output I was expecting, but it is not the input I gave.
Obviously,
1/x - 1/(x+1) = 1/(x*(x+1))

but, if the right hand side can be done why the left hand side can't?
This is the bug I was talking about...

On 10 nov, 19:51, "Mike Hansen" <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 10, 2008 at 5:36 PM, cesarnda <[EMAIL PROTECTED]> wrote:
>
> > Actually this sum can't be done by Maxima, but Derive can do it (even
> > an old version of derive). do you have an idea of how this problem is
> > planning to be solved?
>
> Is this the answer you were expecting?
>
> (%i6) load(simplify_sum);
> (%o6)
>    
> /opt/sage/local/share/maxima/5.16.3/share/contrib/solve_rec/simplify_sum.ma c
> (%i7) simplify_sum(sum(1/(x*(x+1)),x,1,inf));
> (%o7)                                  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: Computing a sum

2008-11-10 Thread Mike Hansen

On Mon, Nov 10, 2008 at 5:36 PM, cesarnda <[EMAIL PROTECTED]> wrote:
>
> Actually this sum can't be done by Maxima, but Derive can do it (even
> an old version of derive). do you have an idea of how this problem is
> planning to be solved?

Is this the answer you were expecting?

(%i6) load(simplify_sum);
(%o6)
   /opt/sage/local/share/maxima/5.16.3/share/contrib/solve_rec/simplify_sum.mac
(%i7) simplify_sum(sum(1/(x*(x+1)),x,1,inf));
(%o7)  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: Computing a sum

2008-11-10 Thread cesarnda

Actually this sum can't be done by Maxima, but Derive can do it (even
an old version of derive). do you have an idea of how this problem is
planning to be solved?

On 10 nov, 19:30, "William Stein" <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 10, 2008 at 5:29 PM, cesarnda <[EMAIL PROTECTED]> wrote:
>
> > how could I compute this:
>
> > sum_{ x = 1}^{\infty} 1/x - 1/(x+1)
>
> > or
>
> > sum(1/x-1/(x+1),x,1, infinity)
>
> > directly in Sage, without calling maxima or sympy?
>
> Unfortunately, this isn't implemented yet. See:
>
> http://trac.sagemath.org/sage_trac/ticket/3587
>
> 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: Computing a sum

2008-11-10 Thread William Stein

On Mon, Nov 10, 2008 at 5:29 PM, cesarnda <[EMAIL PROTECTED]> wrote:
>
> how could I compute this:
>
> sum_{ x = 1}^{\infty} 1/x - 1/(x+1)
>
> or
>
> sum(1/x-1/(x+1),x,1, infinity)
>
> directly in Sage, without calling maxima or sympy?

Unfortunately, this isn't implemented yet. See:

http://trac.sagemath.org/sage_trac/ticket/3587

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] Computing a sum

2008-11-10 Thread cesarnda

how could I compute this:

sum_{ x = 1}^{\infty} 1/x - 1/(x+1)

or

sum(1/x-1/(x+1),x,1, infinity)

directly in Sage, without calling maxima or sympy?
--~--~-~--~~~---~--~~
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 gigantic lists being used to make specific graphs

2008-11-10 Thread William Stein

On Mon, Nov 10, 2008 at 4:14 PM, DGaffney <[EMAIL PROTECTED]> wrote:
>
>
> Basically, the error is as such:
>
> Our error is that when we use data of list length > 600ish, for some
> reason sage hangs. We know that this is not because we are impatient,
> and that it is actually working, because when the list length is under
> 600ish, it generates almost instantly. We want to be able to go to
> list lengths of over 2000, so this proves to be a deal breaker. We
> were originally using all of the node names as hash strings of the
> content, but we optimized it so we have smaller corresponding numbers
> that relate to each piece of content that we are interested in. Still,
> this has yielded no significant change. We think that this either is a
> problem with the allowed length of lists in Sage, but python has an
> allowable list length of around 2 billion, so that seems unlikely. We
> also wonder if there is possibly some memory cap that is reached with
> our data, but if it is that, the memory cap seems unreasonably small.
> Either way, any suggestions/workarounds would be greatly appreciated.
> If there is another library that would be better suited to these
> needs, just naming that would help us out a ton. Thanks much everyone!
>
> Devin, Ian, and Max
>
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> Sample data of what we have been putting into sage can be downloaded
> here: http://www.devingaffney.com/files/data.txt
>
> We are trying to build a program as stipulated here:
> http://www.devingaffney.com/wikipedia-network-maps.
>
> The basic thing we are inputting into sage when it hangs is this:
>
> g = [data.txt file that is mentioned above] //this is where the hang
> occurs; even declaring g with "too much" data makes sage hang up.
>
> G = Graph(g)
> G.show()

I'm not sure what you're doing wrong, but in the below session I load
the above data file, parse it, then display the plot, and it takes
only
about 2 seconds total and only a few megabytes of RAM:

bsd:~ was$ sage
--
| SAGE Version 3.1.4, Release Date: 2008-10-20   |
| Type notebook() for the GUI, and license() for information.|
--

sage: get_memory_usage()
'128M+'
sage: time a = 
eval(open(get_remote_file('http://www.devingaffney.com/files/data.txt')).read())
Attempting to load remote file: http://www.devingaffney.com/files/data.txt
Loading: []
CPU times: user 0.05 s, sys: 0.03 s, total: 0.09 s
Wall time: 0.42 s
sage: get_memory_usage()
'128M+'
sage: a[632]
[142, 139, 75]
sage: time G = Graph(a)
CPU times: user 0.19 s, sys: 0.19 s, total: 0.38 s
Wall time: 1.46 s
sage: time G.show()
CPU times: user 1.98 s, sys: 0.05 s, total: 2.03 s
Wall time: 2.32 s
sage: get_memory_usage()
'142M+'

The default 2d plot that comes up looks like crap, unfortunately.

This kind of looks like something:

sage: 
G.plot(vertex_labels=0,vertex_size=0.1,layout='circular').show(figsize=[20,15])

If you remake the plot, but delete vertex 635, the plot looks
*dramatically* better:

sage: del a[635]
sage: G = Graph(a)
sage: G.plot(vertex_size=0.1).show(figsize=[20,15])

--~--~-~--~~~---~--~~
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] Problem with gigantic lists being used to make specific graphs

2008-11-10 Thread DGaffney


Basically, the error is as such:

Our error is that when we use data of list length > 600ish, for some
reason sage hangs. We know that this is not because we are impatient,
and that it is actually working, because when the list length is under
600ish, it generates almost instantly. We want to be able to go to
list lengths of over 2000, so this proves to be a deal breaker. We
were originally using all of the node names as hash strings of the
content, but we optimized it so we have smaller corresponding numbers
that relate to each piece of content that we are interested in. Still,
this has yielded no significant change. We think that this either is a
problem with the allowed length of lists in Sage, but python has an
allowable list length of around 2 billion, so that seems unlikely. We
also wonder if there is possibly some memory cap that is reached with
our data, but if it is that, the memory cap seems unreasonably small.
Either way, any suggestions/workarounds would be greatly appreciated.
If there is another library that would be better suited to these
needs, just naming that would help us out a ton. Thanks much everyone!

Devin, Ian, and Max

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Sample data of what we have been putting into sage can be downloaded
here: http://www.devingaffney.com/files/data.txt

We are trying to build a program as stipulated here:
http://www.devingaffney.com/wikipedia-network-maps.

The basic thing we are inputting into sage when it hangs is this:

g = [data.txt file that is mentioned above] //this is where the hang
occurs; even declaring g with "too much" data makes sage hang up.

G = Graph(g)
G.show()

--~--~-~--~~~---~--~~
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: Couldn't find published notebook

2008-11-10 Thread William Stein

On Mon, Nov 10, 2008 at 7:53 AM, pong <[EMAIL PROTECTED]> wrote:
>
>
> I have published a  worksheet title Demo when server 2 was available.
> However, I can no longer find it on the published worksheet list from
> SAGE online. Any help?

Try looking here:

http://sage.math.washington.edu/home/was/sagenb/

possibly in

http://sage.math.washington.edu/home/was/sagenb/nb2/sage_notebook/worksheets/pong/


> Thanks in advance
> >
>



-- 
William Stein
Associate 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 [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 do you plot equations if one parameter is a list of values ?

2008-11-10 Thread kex

Thank you,
 if I assign a value I lose symbolic expression ?
If I set GAMA=1 than gama in equation is not a letter/symbol of gama
but it is a number that was asigned to gama?
I though that I can keep the expression in symbolic notation and still
plot/calculate the equation.

So this means that the moment I asign values to a symbolic expression
I lose the symbolic notation
but than I am able to do plots of my function

Thank you for your help Simon,
Bye
Boris
--~--~-~--~~~---~--~~
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: Drawing points on a sphere

2008-11-10 Thread Robert Bradshaw

On Nov 10, 2008, at 12:57 PM, acardh wrote:

>
> One more question about this. How can I draw a line between any two
> given points?
>
> I am doing this
> world = sphere((0,0,0), size=1, color='blue')
> cities = [(38.7598, -121.294),(40.3503, -74.6594),(27.959, -82.4821)]
> t = RDF(pi/180)
> city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos(t*phi),
> sin(t*phi)) for theta, phi in cities]
> world + sum([point3d(v, color='red') for v in city_coords])
>
> How can I draw a line between these cities? I am not sure if there is
> a direct function to do this. One way to do this might be drawing a
> series of dots between any two cities using geocoordinates too.
> Thanks

There is a line command, but it draws a straight line (as if you were  
drilling a tunnel through the earth. The easiest would be your idea  
of making a set of dots.

>
>
> On Nov 9, 8:53 pm, acardh <[EMAIL PROTECTED]> wrote:
>> Thanks Robert, it's exactly what I needed. It was so easy for you, I
>> guess.
>>
>> :o)
>>
>> On Nov 9, 12:28 am, Robert Bradshaw <[EMAIL PROTECTED]>
>> wrote:
>>
>>> On Nov 8, 2008, at 7:52 PM, acardh wrote:
>>
 Hi,
 Plotting an sphere is straightforward but I need help in how to  
 draw
 points on the sphere. The sphere will represent the Earth and the
 points will be some geo-coordinates .
>>
 Thanks!!!
>>
>>> This depends on how your points are given. I'm going to assume you
>>> have latitude/longitude (in degrees), called phi and theta
>>> respectively. Then one would draw the sphere via
>>
>>> sage: world = sphere((0,0,0), radius=1, color='blue')
>>
>>> Here I'm making 100 random cities.
>>> sage: cities = [(ZZ.random_element(-180,180), ZZ.random_element
>>> (-90,90)) for _ in range(100)]
>>
>>> Now I'll convert polar coordinates to regular xyz coordinates.
>>> sage: t = RDF(pi/180)
>>> sage: city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos
>>> (t*phi), sin(t*phi)) for theta, phi in cities]
>>
>>> Now I'll plot them
>>> sage: world + sum([point3d(v, color='red') for v in city_coords])
>>
>>> I could have, of course, done something more interesting than  
>>> "points"
>>> sage: world + sum([tetrahedron(size=.1, color='yellow').translate(v)
>>> for v in city_coords])
>>
>>> - Robert
> >


--~--~-~--~~~---~--~~
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: java plugin for ubuntu 8.04 on amd64

2008-11-10 Thread adrian

Thanks a lot.

-Adrian

On Nov 7, 3:19 am, Pablo Angulo <[EMAIL PROTECTED]> wrote:
> > Hm  I can give it a try.  As a work around, is it possible to have
> > the behaviour of jmol so that instead of being embeded in the webpage
> > as an applet it launches it as it normally would?
>
> In Intrepid, the icedtea plugin does not work either. I've heard you can
> install the sun java plugin if you install a 32bit firefox:
>
> http://ubuntuforums.org/showthread.php?p=1174435
>
> However, if you use the TeXmacs session, and write for example:
>
> g=sphere()
> show(g)
>
> a jmol window pops up and works ok with the openjdk.
>
> Regards
> Pablo
--~--~-~--~~~---~--~~
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 do you plot equations if one parameter is a list of values ?

2008-11-10 Thread Simon King

Dear Boris,

On Nov 10, 9:56 pm, kex <[EMAIL PROTECTED]> wrote:
> GAMA==1
> BETA==1
> THETA==10
> N==1000
> MI==1
> JR==0
> PI==3
> PSI==x

Are these supposed to be assignments?
If "yes", it should be
GAMA=1
BETA=1
THETA=10
etc.

When you do
 GAMA==1
where GAMA is a variable, you just create a formal equation, but GAMA
is not assigned a value

> J1(x)=(1- (JR/sqrt(N^2 - 2*PSI/MI)))*exp(PSI) / (sqrt(2*PI*MI)*(1+BETA
> +G))
> line([(x,J1(x)) for x in [-100,..,0]])

Without the assignment, J1(x) not only depends on x but on several
other variables (BETA, for example). So, when you try to plot, it
wouldn't work because you don't get a real number when you insert a
value for x.

Yours
 Simon

--~--~-~--~~~---~--~~
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 with animate

2008-11-10 Thread mabshoff



On Nov 10, 1:06 pm, cesarnda <[EMAIL PROTECTED]> wrote:

Hi,

> I get the following error while I was trying one of the examples about
> animate
>
> sage: a.show()
> dyld: Symbol not found: __cg_png_create_info_struct
>   Referenced from: /System/Library/Frameworks/
> ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/
> Versions/A/ImageIO
>   Expected in: /Applications/sage/local/lib//libPng.dylib
>
> sh: line 1:  1466 Trace/BPT trap          convert -delay 20 -loop 0
> *.png "/Users/cesar/.sage/temp/macbook_de_cesar_bautista.local/159/
> tmp_0.gif"

IIRC this has been fixed in some recent version of Sage. Which release
are you running?

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://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: multivariate Taylor series

2008-11-10 Thread Alex Raichev

Thanks, Martin.

On Nov 10, 8:07 pm, Martin Rubey <[EMAIL PROTECTED]> wrote:
> Alex Raichev <[EMAIL PROTECTED]> writes:
> > Hi all:
>
> > Is there Sage function that computes Taylor expansions for
> > multivariate functions?
>
> If you are willing to install the optional fricas package:
>
> sage: reset()
> sage: X=axiom('x::TS FRAC INT')
> sage: Y=axiom('y::TS FRAC INT')
> sage: axiom._eval_line(')set str cal 3')
> sage: sin(X+Y)
>
>                1  3   1    2   1  2    1  3
>   (y + x) + (- - y  - - x y  - - x y - - x ) + O(4)
>                6      2        2       6
> sage: axiom.coefficient(sin(X+Y), 5)
>
>    1   5    1    4    1  2 3    1  3 2    1  4     1   5
>   --- y  + -- x y  + -- x y  + -- x y  + -- x y + --- x
>   120      24        12        12        24       120
> -
>
> I guess I should provide some details.  x and y are at first symbols, then via
> "::" coerced to TaylorSeries Fraction Integer (short: TS FRAC INT, both 
> works).
>
> The third line instructs FriCAS to calculate series only up to order 3, note
> that FriCAS's series really are lazy formal power series. Note that these are
> *not* just iterated power series, as eg. in Mathematica :-)
>
> The next line applies sin to the TaylorSeries X+Y.  
>
> Unfortunately, the interface to FriCAS is currently rather weak - there is a
> problem with pexpect, there is not sage wrapper for the most important 
> function
> "::" of FriCAS, and there is still a lot of work to do to convert FriCAS
> objects to Sage objects.  (although a lot has been done under the hood,
> already)
>
> An alternative route would be to extend the Mike Hansen / Ralf Hemmecke lazy
> power series.
>
> Hope this helps.
>
> Martin
--~--~-~--~~~---~--~~
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] error with animate

2008-11-10 Thread cesarnda


I get the following error while I was trying one of the examples about
animate

sage: a.show()
dyld: Symbol not found: __cg_png_create_info_struct
  Referenced from: /System/Library/Frameworks/
ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/
Versions/A/ImageIO
  Expected in: /Applications/sage/local/lib//libPng.dylib

sh: line 1:  1466 Trace/BPT trap  convert -delay 20 -loop 0
*.png "/Users/cesar/.sage/temp/macbook_de_cesar_bautista.local/159/
tmp_0.gif"
--~--~-~--~~~---~--~~
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: Drawing points on a sphere

2008-11-10 Thread acardh

One more question about this. How can I draw a line between any two
given points?

I am doing this
world = sphere((0,0,0), size=1, color='blue')
cities = [(38.7598, -121.294),(40.3503, -74.6594),(27.959, -82.4821)]
t = RDF(pi/180)
city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos(t*phi),
sin(t*phi)) for theta, phi in cities]
world + sum([point3d(v, color='red') for v in city_coords])

How can I draw a line between these cities? I am not sure if there is
a direct function to do this. One way to do this might be drawing a
series of dots between any two cities using geocoordinates too.
Thanks


On Nov 9, 8:53 pm, acardh <[EMAIL PROTECTED]> wrote:
> Thanks Robert, it's exactly what I needed. It was so easy for you, I
> guess.
>
> :o)
>
> On Nov 9, 12:28 am, Robert Bradshaw <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 8, 2008, at 7:52 PM, acardh wrote:
>
> > > Hi,
> > > Plotting an sphere is straightforward but I need help in how to draw
> > > points on the sphere. The sphere will represent the Earth and the
> > > points will be some geo-coordinates .
>
> > > Thanks!!!
>
> > This depends on how your points are given. I'm going to assume you  
> > have latitude/longitude (in degrees), called phi and theta  
> > respectively. Then one would draw the sphere via
>
> > sage: world = sphere((0,0,0), radius=1, color='blue')
>
> > Here I'm making 100 random cities.
> > sage: cities = [(ZZ.random_element(-180,180), ZZ.random_element
> > (-90,90)) for _ in range(100)]
>
> > Now I'll convert polar coordinates to regular xyz coordinates.
> > sage: t = RDF(pi/180)
> > sage: city_coords = [(cos(t*theta)*cos(t*phi), sin(t*theta)*cos
> > (t*phi), sin(t*phi)) for theta, phi in cities]
>
> > Now I'll plot them
> > sage: world + sum([point3d(v, color='red') for v in city_coords])
>
> > I could have, of course, done something more interesting than "points"
> > sage: world + sum([tetrahedron(size=.1, color='yellow').translate(v)  
> > for v in city_coords])
>
> > - Robert
--~--~-~--~~~---~--~~
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 do you plot equations if one parameter is a list of values ?

2008-11-10 Thread kex

var('G')
GAMA=var('gamma')
BETA=var('beta')
PSI=var('psi_c')
THETA=var('theta')
N=var('N')
MI=var('mu')
J1(x)=var('J_e1')
JR=var('J_R')
PI=var('pi')

GAMA==1
BETA==1
THETA==10
N==1000
MI==1
JR==0
PI==3
PSI==x

G = GAMA * (exp(PSI) + BETA*sqrt(THETA)*exp(PSI/THETA)) /
sqrt(2*PI*(N^2 * MI - 2*PSI))
J1(x)=(1- (JR/sqrt(N^2 - 2*PSI/MI)))*exp(PSI) / (sqrt(2*PI*MI)*(1+BETA
+G))
show(G)
show(J1(x))
line([(x,J1(x)) for x in [-100,..,0]])

Iine command gives me an error :

TypeError: float() argument must be a string or a number

Why is this so ?
My goal here is to have a nice forumula and plot  a graph blow that
formula
Lateron I ll try to fit some experimental data and stuff like that

Thank you,

Bye

Boris


--~--~-~--~~~---~--~~
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: small observation on range(i,j)

2008-11-10 Thread Robert Bradshaw

On Nov 10, 2008, at 11:23 AM, Nasser Abbasi wrote:

> Hello;
>
> I was just browsing something to learn about sage, and noticed this on
> this web site
> http://wiki.sagemath.org/sage_mathematica
>
> where it says:
>
> "sage: [f(i) for i in range(1, 11)]
> [g(1), g(2), g(3), g(4), g(5), g(6), g(7), g(8), g(9), g(10)]
>
> (note that the endpoint of the range is not included). "
>
> The above struck me as something that would be confusing and will lead
> to many programming errors.   I do not program in Python and played
> with sage very little. But it seems (to me) strange that when one
> write range(i,j) that the sequence will stop at j-1.
>
> Do other who worked with sage more not find this is a bit odd?

I would say it's a question of whether or not one is used to working  
with a (mainstream) programming language like C, java, python, php,  
javascript, ... This goes back to the fact that arrays are 0-indexed,  
i.e.

sage: L = [1,4,8]
sage: L = ['a', 'b', 'c']
sage: L[0]
'a'
sage: L[1]
'b'

You might prefer the [1..n] notation, so you could do

sage: [f(i) for i in [1..10]]
[g(1), g(2), g(3), g(4), g(5), g(6), g(7), g(8), g(9), g(10)]

(This really should be added to the wiki.)

- Robert


--~--~-~--~~~---~--~~
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: small observation on range(i,j)

2008-11-10 Thread Martin Albrecht

On Monday 10 November 2008, Nasser Abbasi wrote:
> Hello;
>
> I was just browsing something to learn about sage, and noticed this on
> this web site
> http://wiki.sagemath.org/sage_mathematica
>
> where it says:
>
> "sage: [f(i) for i in range(1, 11)]
> [g(1), g(2), g(3), g(4), g(5), g(6), g(7), g(8), g(9), g(10)]
>
> (note that the endpoint of the range is not included). "
>
> The above struck me as something that would be confusing and will lead
> to many programming errors.   I do not program in Python and played
> with sage very little. But it seems (to me) strange that when one
> write range(i,j) that the sequence will stop at j-1.
>
> Do other who worked with sage more not find this is a bit odd?

This is a standard Python feature. Moreover, it is pretty standard in CS to 
have constructs like this, because "we" tend to count from zero: many people 
write C (or Java or ) loops like this:

for(i=0; ihttp://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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: small observation on range(i,j)

2008-11-10 Thread Minh Nguyen

Hi Nasser,

Nasser Abbasi wrote:
> Hello;
> 
> I was just browsing something to learn about sage, and noticed this on
> this web site
> http://wiki.sagemath.org/sage_mathematica
> 
> where it says:
> 
> "sage: [f(i) for i in range(1, 11)]
> [g(1), g(2), g(3), g(4), g(5), g(6), g(7), g(8), g(9), g(10)]
> 
> (note that the endpoint of the range is not included). "
> 
> The above struck me as something that would be confusing and will lead
> to many programming errors.   I do not program in Python and played
> with sage very little. But it seems (to me) strange that when one
> write range(i,j) that the sequence will stop at j-1.
> 
> Do other who worked with sage more not find this is a bit odd?

I don't think what you're describing is odd at all. The command "range" in

sage: [f(i) for i in range(1, 11)]

is, I think, actually a built-in function of Python and Sage merely uses
that function. In the above code, Sage is calling the "range" function
of Python, which is defined that way. For example, for integer n > 0,
the command range(n) returns

0, 1, 2, ..., n-1

which is how range is defined as a built-in function. A similar comment
applies to range(j,k), in which case the command stops after going past
k-1. The above comments also apply to xrange, which in some cases is
much more efficient. From within a Sage session at the console, you can
use any of the following commands

sage: help(range)
sage: help(xrange)

to find out more about range and xrange.

-- 
Regards
Minh Van Nguyen

Web: http://nguyenminh2.googlepages.com
Blog: http://mvngu.wordpress.com

--~--~-~--~~~---~--~~
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] Re: problems with implicit_multiplication

2008-11-10 Thread Robert Bradshaw

On Nov 9, 2008, at 3:32 PM, William Stein wrote:

> On Sun, Nov 9, 2008 at 3:07 PM, William Stein <[EMAIL PROTECTED]>  
> wrote:
>> On Sun, Nov 9, 2008 at 2:04 PM, Justin C. Walker <[EMAIL PROTECTED]>  
>> wrote:
>>>
>>> Hi,
>>>
>>> On Nov 9, 2008, at 13:27 , [EMAIL PROTECTED] wrote:
>>>
 Hello I tried the folowing three links (from sage-devel) on my
 computer as well as on sagenb.com
>> ^
>>
>> That's a good hint.  I just tried this on sagenb.org, and indeed
>> in sage-3.1.4 in the *notebook* implicit multiplication is broken.
>> I've made this
>>
>>  http://trac.sagemath.org/sage_trac/ticket/4485
>>
>> Note implicit multiplication still works fine on the command line.
>>
>> It's possible implicit multiplication never worked in the notebook; I
>> have no idea.   I'll try for a few minutes right now to fix this.
>> William
>
> OK, I've thought about it, and see now that there is no way
> that implicit multiplication was ever even *implemented*
> for the notebook!Just to illustrate what is going on, note
> that if in the notebook you type
>
>implicit_multiplication(True)
>preparse('3x')
>
> you get as output
>
>'Integer(3)*x'
>
> which illustrates that the implicit_multiplication command works fine
> in the actual Sage worksheet process.   The problem is that the
> preparsing of the input for each cell of the notebook is *not* done in
> that subprocess!  It's done by the worksheet server process itself,
> before the input is ever sent to the subprocess.

That is really strange--I occasionally use implicit_multiplication  
from the command line, but never remember turning it on when I'm in  
the notebook.

> There are some approaches to fixing this and I'm not happy really
> about any of them:
>
>   1. Make it so the whole notebook server has an
> implicit_multiplication mode.  This is absurd since some users might
> want it and some not.  Alternatively, make it so the notebook server
> has a mode flag for each worksheet.  That's bad too since that mode
> can't be set via user input (by typing in cells) unless we fully parse
> all input before passing it on for evaluation -- i.e., that's a stupid
> idea which will result in great pain.  The other option, would be to
> have some GUI checkbox or something, and just give an error if one
> types in the input box "implicit_multiplication".  This would be
> inconsistent and maybe busy, but would probably work.  The
> inconsistency would be huge, since, e.g., if somebody writes a 30 line
> script like this:
>   ...
>   implicit_multiplication(True)
>   ...
>   3x + 1
>   ...
> and just *pastes* it into the notebook, it will suddenly not work.
> Which will be really annoying.

I don't like this option much...

>   2. Change how the Sage notebook evaluates code blocks.  Instead of
> preparsing input before sending it off to be evaluated by the
> worksheet subprocess, somehow send a chunck of non-preparsed code off,
> and a command that says "preparse this then evaluate it".

This could work, but would change how we handle syntax errors. I'm  
not sure how it would work either for large blocks.

>   3. Make sage query the subprocess for its implicit_multiplication
> state before every single evaluation -- this would be idiotic and slow
> down the server a lot.  Not an option.

I agree, -1.

> I think 2 is the best option, but it will not be easy to implement,
> and making this change scares me. It feels like the sort of change
> that could introduce numerous subtle bugs, and result in nontrivial
> degredation in functionality -- for example, maybe source code ??
> inspection of user-defined functions in the notebook might no longer
> work.
>
> Incidentally, here is a workaround to make it so you can input an
> expression using implicit multiplication in the notebook.
>
> implicit_multiplication(True)
> sage_eval('3x^3 + 4/5 x + 1', globals())
> 3*x^3 + 4*x/5 + 1
>
> I'm not going to do anything further on this without some feedback
> from Robert Bradshaw (who implemented implicit multiplication)
> and/or Mike Hansen who I think knows the relevant part of the
> notebook code well enough to have a comment about what
> I wrote above.

One of the problems is that the preparser operates in chunks, so if  
"implicit_multiplication(x)" sits half way through a chunk, one would  
have to split the chunk in half at that point and evaluate the first  
half of the chunk to decide how to do the rest. Also, this means that  
implicit_multiplication won't work in a file.

I think what should happen is all preprocessing happens on the  
notebook side, and the underlying sage process has preprocessing  
turned off (and always gets fed already preprocessed code). Options  
like implicit multiplication and (eventually?) auto-creation of  
undeclared variable names (or any others that come up) would be  
available as checkboxes in the notebook. Calling  
implicit_multiplication(...) from the notebook would r

[sage-support] small observation on range(i,j)

2008-11-10 Thread Nasser Abbasi

Hello;

I was just browsing something to learn about sage, and noticed this on
this web site
http://wiki.sagemath.org/sage_mathematica

where it says:

"sage: [f(i) for i in range(1, 11)]
[g(1), g(2), g(3), g(4), g(5), g(6), g(7), g(8), g(9), g(10)]

(note that the endpoint of the range is not included). "

The above struck me as something that would be confusing and will lead
to many programming errors.   I do not program in Python and played
with sage very little. But it seems (to me) strange that when one
write range(i,j) that the sequence will stop at j-1.

Do other who worked with sage more not find this is a bit odd?

Nasser




--~--~-~--~~~---~--~~
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: create a file

2008-11-10 Thread Robert Bradshaw

On Nov 9, 2008, at 1:21 PM, alia hamieh wrote:

> I'm using sage 3.1.4 on windows vista.
> I know that I should create a file with content the function  
> that i want to implement and then use the load command from the  
> command line to run it. how do we create this file and where do we  
> have to save it?
> thank you in advance

You would have to create a file in the VMware image. I think some  
kind of bridging can be set up between the VMware and Windows  
filesystem, but I don't have any experience along those lines.

Since you're on Windows, I might suggest using the notebook as it  
interoperates more naturally with the Windows environment (until the  
full Windows port is done).

- Robert



--~--~-~--~~~---~--~~
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] Couldn't find published notebook

2008-11-10 Thread pong


I have published a  worksheet title Demo when server 2 was available.
However, I can no longer find it on the published worksheet list from
SAGE online. Any help?

Thanks in advance
--~--~-~--~~~---~--~~
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: Singular Performance

2008-11-10 Thread Martin Albrecht

On Monday 10 November 2008, Thomas Kahle wrote:
> Hi,
>
> here is another try.
>
> sage: R = QQ['a,b,c,w,x,y,z']
> sage: (a,b,c,w,x,y,z) = R.gens()
> sage: I = (x^5-a*b*c^3, x^7-w^5*a^5*b^5, b*c^3-a^7, \
> b^2*a^3*c^5*x-y*z*w^2, x*y*z-w*z^2*a*b, b*x-a*w*z^9)*R
> sage: time _ = I.radical()
> CPU times: user 0.21 s, sys: 0.05 s, total: 0.26 s
> Wall time: 41.03 s
>
> And now in Singular:
> (Sages default termorder is degrevlex which is dp in Singular)
>
> So in Singular this looks like this:
> cat singulartest.sing
> LIB "primdec.lib";
> ring R =  0,(a,b,c,w,x,y,z),dp;
> ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2 , xyz-wz2ab, bx-awz9;
> ideal s = std(I);
> ideal Ir = radical(s);
> ideal Sr = std(Ir);
> quit;
>
> time Singular singulartest.sing
> real  0m31.848s
> user  0m31.201s
> sys   0m0.303s
>
> I can hardly believe that there are 10 seconds of message passing
> between singular and python, maybe something is misconfigured here ??

I still can't reproduce your discrepancy:

Singular:
real0m22.105s
user0m21.135s
sys 0m0.776s

Sage;
real0m23.541s
user0m0.929s
sys 0m0.314s

where ~ 1 second is startup time.

> > What is your machine/os? Mine:
> > Intel Core2Duo 2.33Ghz 3GB RAM
> > 64-bit Debian/GNU Linux
>
> I'm using Core2Duo 1.6Ghz 3GB, 32bit Gentoo Linux, but I'm really
> interested in the discrepancy being around 25% in my case...

Maybe its a 32 vs. 64-bit thing? Which Sage version are you running? I'm 
running 3.1.3 (looks I'm way behind, the current version is 3.1.4 and 3.2 is 
in preparation)

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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: Singular Performance

2008-11-10 Thread Martin Albrecht

> Well, given that it works the way I want it on your machine I will
> consider that a minor problem then :)

To make sure I just checked on sage.math (64-bit, Debian/GNU Linux, 1.8Ghz):

Singular:

real0m36.738s
user0m34.946s
sys 0m1.784s

Sage:

real0m39.919s
user0m1.796s
sys 0m0.760s

with 2.5 seconds startup time.

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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: Singular Performance

2008-11-10 Thread Thomas Kahle
On Mon, 2008-11-10 at 16:27 +, Martin Albrecht wrote:
> On Monday 10 November 2008, Thomas Kahle wrote:
> > Hi,
> >
> > here is another try.
> >
> > sage: R = QQ['a,b,c,w,x,y,z']
> > sage: (a,b,c,w,x,y,z) = R.gens()
> > sage: I = (x^5-a*b*c^3, x^7-w^5*a^5*b^5, b*c^3-a^7, \
> > b^2*a^3*c^5*x-y*z*w^2, x*y*z-w*z^2*a*b, b*x-a*w*z^9)*R
> > sage: time _ = I.radical()
> > CPU times: user 0.21 s, sys: 0.05 s, total: 0.26 s
> > Wall time: 41.03 s
> >
> > And now in Singular:
> > (Sages default termorder is degrevlex which is dp in Singular)
> >
> > So in Singular this looks like this:
> > cat singulartest.sing
> > LIB "primdec.lib";
> > ring R =  0,(a,b,c,w,x,y,z),dp;
> > ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2 , xyz-wz2ab, bx-awz9;
> > ideal s = std(I);
> > ideal Ir = radical(s);
> > ideal Sr = std(Ir);
> > quit;
> >
> > time Singular singulartest.sing
> > real0m31.848s
> > user0m31.201s
> > sys 0m0.303s
> >
> > I can hardly believe that there are 10 seconds of message passing
> > between singular and python, maybe something is misconfigured here ??
> 
> I still can't reproduce your discrepancy:
> 
> Singular:
> real0m22.105s
> user0m21.135s
> sys 0m0.776s
> 
> Sage;
> real0m23.541s
> user0m0.929s
> sys 0m0.314s
> 
> where ~ 1 second is startup time.
> 
> > > What is your machine/os? Mine:
> > > Intel Core2Duo 2.33Ghz 3GB RAM
> > > 64-bit Debian/GNU Linux
> >
> > I'm using Core2Duo 1.6Ghz 3GB, 32bit Gentoo Linux, but I'm really
> > interested in the discrepancy being around 25% in my case...
> 
> Maybe its a 32 vs. 64-bit thing? Which Sage version are you running? I'm 
> running 3.1.3 (looks I'm way behind, the current version is 3.1.4 and 3.2 is 
> in preparation)

Well, given that it works the way I want it on your machine I will
consider that a minor problem then :)
Will check 64Bit behavior later ...
The first thing I sent you was with sage 3.1.2 but in the meanwhile I
upgraded to 3.1.4 and it's the same.


signature.asc
Description: This is a digitally signed message part


[sage-support] Re: Singular Performance

2008-11-10 Thread Thomas Kahle
Hi, 

here is another try.

sage: R = QQ['a,b,c,w,x,y,z']
sage: (a,b,c,w,x,y,z) = R.gens()
sage: I = (x^5-a*b*c^3, x^7-w^5*a^5*b^5, b*c^3-a^7, \
b^2*a^3*c^5*x-y*z*w^2, x*y*z-w*z^2*a*b, b*x-a*w*z^9)*R 
sage: time _ = I.radical() 
CPU times: user 0.21 s, sys: 0.05 s, total: 0.26 s
Wall time: 41.03 s

And now in Singular:
(Sages default termorder is degrevlex which is dp in Singular)

So in Singular this looks like this:
cat singulartest.sing
LIB "primdec.lib";
ring R =  0,(a,b,c,w,x,y,z),dp;
ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2 , xyz-wz2ab, bx-awz9;
ideal s = std(I);
ideal Ir = radical(s);
ideal Sr = std(Ir);
quit;

time Singular singulartest.sing
real0m31.848s
user0m31.201s
sys 0m0.303s

I can hardly believe that there are 10 seconds of message passing
between singular and python, maybe something is misconfigured here ??

> What is your machine/os? Mine:
> Intel Core2Duo 2.33Ghz 3GB RAM
> 64-bit Debian/GNU Linux

I'm using Core2Duo 1.6Ghz 3GB, 32bit Gentoo Linux, but I'm really
interested in the discrepancy being around 25% in my case... 

> For me usually working with Sage's native datatypes and calling 
> I.groebner_basis (which calls Singular via pexpect) is the way to go, because 
> my inputs and outputs are small but the GB computation takes considerable 
> time.

Alright, I think I understand that now, My case looks similar, I will do
many things in python and then from time to time call Singular for a
specific thing that takes long (compared to the time it takes to call
it)

thank you 
Thomas


signature.asc
Description: This is a digitally signed message part


[sage-support] Re: Singular Performance

2008-11-10 Thread Martin Albrecht

On Monday 10 November 2008, Thomas Kahle wrote:
> Hi again, thanks for your help
>
> > You are definitely not using libSingular but the Singular pexpect
> > interface. libSingular is the C++ interface to a subset of Singular (the
> > kernel).
>
> Then, how do I use libSingular ?
> Is it used if work directly with the types implemented in sage, like
> R = QQ['x,y,z']
> I = (x^2-y*z, z^7-x^2) * R
> I.primary_decomposition()
> ... and so on ?

Yes and no:

> R = QQ['x,y,z']
> I = (x^2-y*z, z^7-x^2) * R

So far you are using libSingular, i.e. Sage's native datatypes use 
libSingular.

> I.primary_decomposition()

This functionality is implemented as Singular script (i.e. in the interface 
language of Singular) and thus we call an external Singular process to 
perform it. This requires string passing back and forth. 

> > I can reproduce the discrepancy only to some extend:
> >
> > Singular
> > real0m22.033s
> > user0m21.026s
> > sys 0m0.856s
> >
> > Sage:
> > real0m23.251s
> > user0m0.846s
> > sys 0m0.303s
>
> Did you use my example ? 

Yes, I used your example.

> How can there be such a discrepancy on my machine ?

What is your machine/os? Mine:

Intel Core2Duo 2.33Ghz 3GB RAM
64-bit Debian/GNU Linux


> If it's as small as in your case I could easily live with it.
>
> > Some overhead is unavoidable because data has to be exchanged between
> > Singular and Sage. Since the radical command is only available as a
> > Singular script (rather than in the kernel) I don't see an immediate way
> > around it.
>
> an ideal in sage has the method .radical(), does that mean the pexpect
> interface is called in this case ?

As radical is implemented in Singular script rather than C/C++ by the Singular 
team we have to call the Singular interpreter via pexpect.

> Summarizing, what is the smartest way to use Singular from within Sage ?

It really depends on what you're trying to achieve. In your case, the last 
example I gave earlier might be the way to go. You can also write Singular 
scripts and call them from within Sage. 

For me usually working with Sage's native datatypes and calling 
I.groebner_basis (which calls Singular via pexpect) is the way to go, because 
my inputs and outputs are small but the GB computation takes considerable 
time.

Cheers,
Martin
-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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: Singular Performance

2008-11-10 Thread Thomas Kahle
Hi again, thanks for your help

> You are definitely not using libSingular but the Singular pexpect interface. 
> libSingular is the C++ interface to a subset of Singular (the kernel).
Then, how do I use libSingular ? 
Is it used if work directly with the types implemented in sage, like 
R = QQ['x,y,z']
I = (x^2-y*z, z^7-x^2) * R
I.primary_decomposition() 
... and so on ?

> I can reproduce the discrepancy only to some extend:
> 
> Singular
> real0m22.033s
> user0m21.026s
> sys 0m0.856s
> 
> Sage:
> real0m23.251s
> user0m0.846s
> sys 0m0.303s

Did you use my example ? How can there be such a discrepancy on my
machine ?
If it's as small as in your case I could easily live with it.

> Some overhead is unavoidable because data has to be exchanged between 
> Singular 
> and Sage. Since the radical command is only available as a Singular script 
> (rather than in the kernel) I don't see an immediate way around it.
an ideal in sage has the method .radical(), does that mean the pexpect
interface is called in this case ?

Summarizing, what is the smartest way to use Singular from within Sage ?

cheers
Thomas


signature.asc
Description: This is a digitally signed message part


[sage-support] Re: is it possible to show() a variable with "it's name = " in front of it

2008-11-10 Thread Stan Schymanski

In connection with another post by Andreas, I realised that the above
ashow() definition does not create nice output if decimal numbers are
involved:
y = 0.5*x
ashow('y')
returns:
y=0.500x

Is there a way of manipulating the eval() command to round a decimal
number? If so, I would be happy to apply for a trac account and post a
patch.

Cheers
Stan

On Oct 7, 5:11 pm, "William Stein" <[EMAIL PROTECTED]> wrote:

> Yes, that could be reasonable, if it has proper documentation, etc.
> Can somebody open a trac ticket and post it here?
>
> 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: latex output for real numbers without zeros at the end

2008-11-10 Thread Stan Schymanski

It seems that latex(eqn) just evaluates eqn and prints the result in
latex notation, without cutting off annoying 0s or giving the user the
opportunity to set a precision. I find this very annoying, as such
latex output is not very useful for illustration purposes. Does anyone
know a trick how to automatically round ugly numbers for the latex
output? I feel that this should be incorporated into the latex() code,
though.
Here is another illustration of the problem:

latex(0.6*x)
{0.600 x}

latex(0.6.n(digits=4)*x)
{0.585 x}

The second attempt became even uglier!

This is on sage 3.1.4 on an Intel Macbook Pro.

Thanks for your help! (Anyone?)
Stan

--~--~-~--~~~---~--~~
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: Singular Performance

2008-11-10 Thread Martin Albrecht

On Monday 10 November 2008, Thomas Kahle wrote:
> Dear all,
> I'm curious about performance of Singular computations which are run
> from sage:
>
> I tried the following test:
>
> ---
> cat singulartest.sage
> R = singular.ring(0,'(a,b,c,w,x,y,z)','lp');
> I = singular.ideal('x5-abc3', 'x7-w5a5b5', 'bc3-a7', 'b2a3c5x-yzw2',\
> 'xyz-wz2ab', 'bx-awz9')
> S = I.std()
> Ir = S.radical()
> Sr = Ir.std()
> quit
> ---
>
> VS:
>
> 
> LIB "primdec.lib";
> ring R =  0,(a,b,c,w,x,y,z),lp;
> ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2, xyz-wz2ab, bx-
> awz9;
> ideal s = std(I);
> ideal Ir = radical(s);
> ideal Sr = std(Ir);
> Sr;
> quit;
> 
>
> The result is
> time /usr/local/sage/local/bin/Singular singulartest.sing
> [...]
> real  0m32.112s
> user  0m31.509s
> sys   0m0.295s
>
> time sage singulartest.sage
> [...]
> real  0m42.653s
> user  0m1.027s
> sys   0m0.262s
>
> Looking at "top" during the computation it seems to me that the
> spawned Singular process is just taking more time to do the
> computation. It does not look like overhead of the python wrapper to
> me.
> Furthermore some experiments showed that the time difference scales
> with the size of the problem.
> Does anybody know what's going on here ? Is the bundled libsingular
> compiled with less optimization ??

Hi there,

You are definitely not using libSingular but the Singular pexpect interface. 
libSingular is the C++ interface to a subset of Singular (the kernel).

I can reproduce the discrepancy only to some extend:

Singular
real0m22.033s
user0m21.026s
sys 0m0.856s

Sage:
real0m23.251s
user0m0.846s
sys 0m0.303s

of this 22.101263 is the actual walltime in the computation (without 
Sage's startup).

Some overhead is unavoidable because data has to be exchanged between Singular 
and Sage. Since the radical command is only available as a Singular script 
(rather than in the kernel) I don't see an immediate way around it.

So I guess for now I don't see an easy solution, except maybe:

s = """LIB "primdec.lib";
ring R =  0,(a,b,c,w,x,y,z),lp;
ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2, xyz-wz2ab, bx-awz9;
ideal s = std(I);
ideal Ir = radical(s);
ideal Sr = std(Ir);
"""
%time _= singular.eval(s)
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 22.06 s

singular("Sr") is then what you are looking for.

Cheers,
Martin


-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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] Plotting with origin up-right (or north-east)

2008-11-10 Thread Paolo Crosetto

Hello,

I am trying to plot an edgevworth box in sage. To do so, I need to
plot contours of two different functions; one of them with the usual
origin and axes, the other turned upside-down - i.e. with origin north-
east.
To get a feeling of how this works, you can have a look at
http://en.wikipedia.org/wiki/Image:Contract-curve-on-edgeworth-box.svg

I can plot contours, but cannot find a way to:
1. set origin north-east
2. plot the second contour on the same plot of the first, but with the
different origin.

My code so far is:

from pylab import *
x = var('x')
y = var('y')
U1 = x^0.4*y^0.6
U2 = x^0.6*y^0.4

a = contour_plot(U1, (0,15), (0,15), fill=False, plot_points=100,
contours=(12), cmap='hsv')
b = contour_plot(U2, (0,15), (0,15), fill=False, plot_points=100,
contours=(12), cmap='hsv')

a+b

the code produces the superposition fo the two contour plots, but I
find no easy way of turning one of them upside-down (i.e. setting its
origin north-east).

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] Singular Performance

2008-11-10 Thread Thomas Kahle

Dear all,
I'm curious about performance of Singular computations which are run
from sage:

I tried the following test:

---
cat singulartest.sage
R = singular.ring(0,'(a,b,c,w,x,y,z)','lp');
I = singular.ideal('x5-abc3', 'x7-w5a5b5', 'bc3-a7', 'b2a3c5x-yzw2',\
'xyz-wz2ab', 'bx-awz9')
S = I.std()
Ir = S.radical()
Sr = Ir.std()
quit
---

VS:


LIB "primdec.lib";
ring R =  0,(a,b,c,w,x,y,z),lp;
ideal I = x5-abc3, x7-w5a5b5, bc3-a7, b2a3c5x-yzw2, xyz-wz2ab, bx-
awz9;
ideal s = std(I);
ideal Ir = radical(s);
ideal Sr = std(Ir);
Sr;
quit;


The result is
time /usr/local/sage/local/bin/Singular singulartest.sing
[...]
real0m32.112s
user0m31.509s
sys 0m0.295s

time sage singulartest.sage
[...]
real0m42.653s
user0m1.027s
sys 0m0.262s

Looking at "top" during the computation it seems to me that the
spawned Singular process is just taking more time to do the
computation. It does not look like overhead of the python wrapper to
me.
Furthermore some experiments showed that the time difference scales
with the size of the problem.
Does anybody know what's going on here ? Is the bundled libsingular
compiled with less optimization ??

I would love to use sage/python/cython since I want to combine
computations in different programs but it has to be as fast as
possible.

Any comment is appreciated

Thomas

-
Thomas Kahle
Max Planck Institute for Mathematics in the Sciences
Inselstr. 22-26, 04103 Leipzig
Tel: +49(0) 341-9959-545
[EMAIL PROTECTED], http://personal-homepages.mis.mpg.de/kahle/
-

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