[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Oleksandr Kazymyrov
Hi Simon,

It is very strange. I use Ubuntu 11.10 and my parameters are:

hamsin@hamsin-pc:~/bin/sage-5.0.beta4$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric

hamsin@hamsin-pc:~/bin/sage-5.0.beta4$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hamsin@hamsin-pc:~/bin/sage-5.0.beta4$ uname -a
Linux hamsin-pc 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 
2012 x86_64 x86_64 x86_64 GNU/Linux

sage: version()
'Sage Version 4.8, Release Date: 2012-01-20'

I have compiled 5.0.beta4 and received the same bug:

sage: version()
'Sage Version 5.0.beta4, Release Date: 2012-02-14'
sage: load ./Main.sage
Compiling ./CFunc.spyx...
in c_PC
>>>
/home/hamsin/bin/sage-5.0.beta4/local/lib/libcsage.so(print_backtrace+0x31)[0x7f017a535ea9]
/home/hamsin/bin/sage-5.0.beta4/local/lib/libcsage.so(sigdie+0x14)[0x7f017a535edb]
/home/hamsin/bin/sage-5.0.beta4/local/lib/libcsage.so(sage_signal_handler+0x20c)[0x7f017a535b06]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10060)[0x7f0180453060]
/home/hamsin/bin/sage-5.0.beta4/local/lib/libreadline.so.6(PC+0x0)[0x7f017be1942a]


Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.

/home/hamsin/bin/sage-5.0.beta4/spkg/bin/sage: line 304: 16967 Segmentation 
fault  sage-ipython "$@" -i

Can anyone reproduce the same bug on Ubuntu?

Best regards,
Oleksandr

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


[sage-support] sage won't compile on Arch Linux i686

2012-02-17 Thread Rob Steenburgh
Hello:

I just began using sage and was very impressed with its capabilities.
Unfortunately, almost as soon as I began using it, I found out the latest
version won't compile on Arch Linux and some other distros.  Details can be
found at these links:

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

and

http://mailman.archlinux.org/pipermail/aur-general/2012-February/017571.html

Will these issues ever be addressed?  I'd love to keep learning and using
sage, but don't want to abandon my current flavor of Linux.

Thanks,
Rob

-- 
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: Reserved words (Sage + Cython)

2012-02-17 Thread Simon King
Dear Oleksandr,

On 17 Feb., 15:32, Oleksandr Kazymyrov 
wrote:
> Or just run "Main.sage" from a shell (in this case, variable PATH should
> has a path to the sage directory, like this one
> "PATH=/home/user/bin/sage/:$PATH").

Then I can not reproduce it.

I started a Sage shell, and did

%%%
(sage subshell) linux-sqwp:CythonBad simon$ PATH=/home/simon/SAGE/work/
cython_change/CythonBad/:$PATH
SAGE_ROOT=/home/simon/SAGE/sage-5.0.prealpha0
(sage subshell) linux-sqwp:CythonBad simon$ ls
CFunc.spyx  CSbox.sage  Functions.c  Main.py  Main.sage  Sbox.sage
SAGE_ROOT=/home/simon/SAGE/sage-5.0.prealpha0
(sage subshell) linux-sqwp:CythonBad simon$ ./Main.sage
Compiling ./CFunc.spyx...
in c_PC
>>>
in PC
<<<
out in_PC
PC  = 0
(sage subshell) linux-sqwp:CythonBad simon$ cat Functions.c
int PC()
{
printf("in PC\n");
return 0;
}

%

So, it is indeed the "bad" version, but there is no segmentation
fault.

As you can see, this is with a recent development version of Sage. The
machine:

simon@linux-sqwp:~> uname -a
Linux linux-sqwp.site 3.1.9-1.4-desktop #1 SMP PREEMPT Fri Jan 27
08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux
simon@linux-sqwp:~> cat /etc/issue
Welcome to openSUSE 12.1 "Asparagus" - Kernel \r (\l).


simon@linux-sqwp:~> gcc --version
gcc (SUSE Linux) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


Best regards,
Simon

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


[sage-support] Re: Simplification Issue Implicates Canonical Form

2012-02-17 Thread kcrisman
In some previous incarnation, where Sage used Maxima for things like
this, your simplification happened.


(%i1) 1/sqrt(5);
   1
(%o1)   ---
sqrt(5)
(%i2) sqrt(5)/5;
   1
(%o2)   ---
sqrt(5)


Now we use Ginac for basic symbolic stuff.  Once in a while we (i.e.,
Burcin) changes some internal representation, or Ginac does.   But in
general I think it just goes for positive powers - you may want to
read its documentation.  In particular, "sqrt" is not a builtin
function ("square root (not a GiNaC function, rather an alias for
pow(x, numeric(1, 2)))"), so the behavior is analogous to

sage: 1/5^(1/3)
1/5*5^(2/3)

Naturally, GiNaC is Not a CAS, so perhaps that is one reason for the
distinction.  You are also right about black arts!  So I don't pretend
to judge Maxima *or* Ginac on this one.

I'm sorry if that doesn't help, but it might give you some background,
at least.

- 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] Simplification Issue Implicates Canonical Form

2012-02-17 Thread Mark Rahner
Hello sage-support,

I'm a Sage newbie who just joined the group.  Before I get to the meat
of my post, I'd like to thank the open source math software community
for all of your hard work!  Nothing I say should be misinterpreted as
a complaint.  I have only admiration and gratitude.

I ran into an issue that I thought was worth reporting.  As I worked
on a relatively simple math problem, I noticed that my screen became
filled with complicated expressions involving square roots of small
integers.  I knew the result couldn't be as complicated as it looked.
Trying the various simplify methods didn't help.  I scratched my head
for a while and experimented.  I eventually isolated the issue to the
fact that Sage doesn't simplify "sqrt(5) / 5" to "1 / sqrt(5)".
Worse, it dutifully replaces "1 / sqrt(5)" with "sqrt(5) / 5",
implying that an underlying canonical form definition is
systematically making expressions more complicated than necessary.

I can imagine a theoretical argument about positive exponents being
"simpler" than negative exponents of the same magnitude but that
argument falls apart quickly in practice.  The problem with keeping
expressions like "sqrt(5) / 5" is that they grow uncontrollably with
subsequent operations.  For example, it keeps expressions like
"-1/5*(sqrt(-2*sqrt(5) + 5) - sqrt(5))*sqrt(5)" from simplifying to "-
sqrt(-2/sqrt(5) + 1) + 1".  Several operations later, a screenful of
unnecessary radicals completely obscures the underlying math.  Given
how common square roots of small integers are, particularly in newbie
math problems, I expect this issue to be a significant stumbling block
for many folks trying to learn Sage.

I know that expression simplification is a black art so I can't
pretend to know how to fix this issue.  However, I'm certain that "1 /
sqrt(5)" is simpler than "sqrt(5) / 5" in some important way.  For
what it's worth, I think that most of us would make that substitution
if we were doing math without automated support.

-Mark

-- 
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: Reserved words (Sage + Cython)

2012-02-17 Thread Oleksandr Kazymyrov
Dear Simon,

>> But the only difference between the good and the bad version is that some 
function is called PC in the bad file and PCc in the good file
Yes, exactly.

>> However, Oleksandr: What is one supposed to do in order to reproduce the 
error? When I start a sage session and attach Main.sage, then it fails with 
both the bad and the good version.
You should replace:

if __name__ == "__main__":
sys.exit(main())
by

main()

Or just run "Main.sage" from a shell (in this case, variable PATH should 
has a path to the sage directory, like this one 
"PATH=/home/user/bin/sage/:$PATH"). 

Best regards,
Oleksandr

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


[sage-support] Re: How-to change the size of ticks ? ( use of graphs for presentations )

2012-02-17 Thread Jason Grout

On 2/17/12 7:40 AM, Goebbe wrote:

Thank you very much Jason,
your help is highly appreciated! It seems that the interaction with
matplotlib is a bit more complicated than what I imagined. :-)



Yes, a long-term project is to overhaul the graphics code so that it 
exposes more of the powerful matplotlib functionality, or at least makes 
it easier to use matplotlib directly.  Already, the .matplotlib() 
function goes a long ways towards that (before the matplotlib method, it 
was much more complicated to do things in matplotlib with Sage figures).


Thanks,

Jason


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


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Simon King
Hi Dima, hi Oleksandr,

On 17 Feb., 14:07, Dima Pasechnik  wrote:
> I imagine the behaviour is similar to Python's, where it's jolly possible
> to do "list=2" and see stuff beginning to happen...

But the only difference between the good and the bad version is that
some function is called PC in the bad file and PCc in the good file. I
guess that PC is not a reserved word.

However, Oleksandr: What is one supposed to do in order to reproduce
the error? When I start a sage session and attach Main.sage, then it
fails with both the bad and the good version.

Cheers,
Simon

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


[sage-support] Re: How-to change the size of ticks ? ( use of graphs for presentations )

2012-02-17 Thread Goebbe
Thank you very much Jason,
your help is highly appreciated! It seems that the interaction with
matplotlib is a bit more complicated than what I imagined. :-)

I tried your code and it worked fine, but the xmin, xmax ... has been
ignored. After experimenting I found the place, where I have to put
these
parameters.

Here is the code:

P = [1/6,1/6,1/6,1/6,1/6,1/6]
X = [1,2,3,4,5,6]
discrDistr = [(X[_],P[_]) for _ in range(len(P))]  # Prepare values
for scatter_plot
p1 = scatter_plot(discrDistr, markersize=100,facecolor='blue')
counter = 0
for expr in P:
 p1 += line([(X[counter],0),
(X[counter],expr)],linestyle="--",color='black',thickness=2)
 counter = counter + 1
p1.axes_width(2)

m=p1.matplotlib(fontsize=20,xmin=0,xmax=(len(P)+0.5),ymax=0.3 )

from matplotlib import pyplot
xticks = pyplot.getp(m.axes[0], 'xticklines')  #get tick
parameters
yticks = pyplot.getp(m.axes[0], 'yticklines')
pyplot.setp(xticks, markeredgewidth=2, markersize=10)  #set tick
parameters
pyplot.setp(yticks, markeredgewidth=2, markersize=10)

from matplotlib.backends.backend_agg import FigureCanvasAgg
m.set_canvas(FigureCanvasAgg(m))
m.savefig('test.png')


Thanks again!
Goebbe

-- 
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] Fastest Lattice Reduction

2012-02-17 Thread Santanu Sarkar
I need to reduce a lattice of dimension
200 with its entries sizes  are of size like 3000 bit.  I use
LLL(algorithm="fpLLL:fast")
for faster lattice reduction. But it seems there is a problem in the
function. Reduction is
very bad. Is there any way to reduce this size of matrix efficiently?

-- 
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: Reserved words (Sage + Cython)

2012-02-17 Thread Dima Pasechnik
In gmane.comp.mathematics.sage.support, you wrote:
> After upgrading from version 4.7.2 to 4.8, one function of dozen is stopped 
> working. I use a combination of Sage + Cython. You can find examples in the 
> attachments.
>
> The main problem is: when you use "PC" as the function name in "*.c" file 
> sage gives an error
>
> /home/hamsin/bin/sage/local/lib/libcsage.so(print_backtrace+0x31)[0x7f3c8b89e3a3]
> /home/hamsin/bin/sage/local/lib/libcsage.so(sigdie+0x14)[0x7f3c8b89e3d5]
> /home/hamsin/bin/sage/local/lib/libcsage.so(sage_signal_handler+0x20e)[0x7f3c8b89e000]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060)[0x7f3c8dc93060]
> /home/hamsin/bin/sage/local/lib/libreadline.so.6(PC+0x0)[0x7f3c861f83cc]
>
> 
> Unhandled SIGSEGV: A segmentation fault occurred in Sage.
> This probably occurred because a *compiled* component of Sage has a bug
> in it and is not properly wrapped with sig_on(), sig_off(). You might
> want to run Sage under gdb with 'sage -gdb' to debug this.
> Sage will now terminate.
> 
> local/bin/sage-sage: line 460: 10163 Segmentation fault  python "$@"
>
> If I use "PCc" or "PC_1", then there are no problems. So this is a bug, 
> feature or Cython has limitations on function names. If the last point, 
> then where I can see this limitations.

I imagine the behaviour is similar to Python's, where it's jolly possible
to do "list=2" and see stuff beginning to happen...

Just in case,
Dima

>
> Best regards,
> Oleksandr

-- 
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: Modular operation in multivariate polynomials

2012-02-17 Thread Simon King
Hi all,

On 17 Feb., 10:53, Simon King  wrote:
> > No, I havn't. If this is not a problem for you then open.
>
> OK, I'll do so later today.

I opened http://trac.sagemath.org/sage_trac/ticket/12529

Best regards,
Simon

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


[sage-support] Reserved words (Sage + Cython)

2012-02-17 Thread Oleksandr Kazymyrov
Hi All,

After upgrading from version 4.7.2 to 4.8, one function of dozen is stopped 
working. I use a combination of Sage + Cython. You can find examples in the 
attachments.

The main problem is: when you use "PC" as the function name in "*.c" file 
sage gives an error

/home/hamsin/bin/sage/local/lib/libcsage.so(print_backtrace+0x31)[0x7f3c8b89e3a3]
/home/hamsin/bin/sage/local/lib/libcsage.so(sigdie+0x14)[0x7f3c8b89e3d5]
/home/hamsin/bin/sage/local/lib/libcsage.so(sage_signal_handler+0x20e)[0x7f3c8b89e000]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10060)[0x7f3c8dc93060]
/home/hamsin/bin/sage/local/lib/libreadline.so.6(PC+0x0)[0x7f3c861f83cc]


Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.

local/bin/sage-sage: line 460: 10163 Segmentation fault  python "$@"

If I use "PCc" or "PC_1", then there are no problems. So this is a bug, 
feature or Cython has limitations on function names. If the last point, 
then where I can see this limitations.

Best regards,
Oleksandr

Machine:
linux: Linux pcen 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 
2012 x86_64 x86_64 x86_64 GNU/Linux
sage: 'Sage Version 4.8, Release Date: 2012-01-20'

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


Cython_bad.tar.gz
Description: Binary data


Cython_good.tar.gz
Description: Binary data


[sage-support] Re: How-to change the size of ticks ? ( use of graphs for presentations )

2012-02-17 Thread Jason Grout

On 2/17/12 3:32 AM, Goebbe wrote:

Hi,
this is my first post. Please keep in mind that I have just started to
use Sage.

I use the sage notebook in order to prepare graphs for a introductory
statistics class.
Since I use the graphs in presentations (powerpoint) - I modified
linewidth, fontsize in
order to get a graph that is easily visible in the presentation (even
from the back of the room).

Unfortunately I did not find a way to change the size of ticks. I
already searched the documentation of sage and of matplotlib, but I
just did not manage to get this work.


Yeah, you have to use matplotlib.  I followed this message:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18998.html

Here is the result:

http://aleph.sagemath.org/?q=1de1fd37-f4cb-4501-a13e-84769fd5befe

(click Evaluate, then look at the png file at the bottom)

Here is the code:

P = [1/6,1/6,1/6,1/6,1/6,1/6]
X = [1,2,3,4,5,6]
discrDistr = [(X[_],P[_]) for _ in range(len(P))]   # Prepare values 
for scatter_plot

p1 = scatter_plot(discrDistr, markersize=100,
facecolor='blue',xmin=0,xmax=(len(P)+0.5),ymax=0.3)
counter = 0
for expr in P:
p1 += line([(X[counter],0),(X[counter],expr)], 
linestyle="--",color='black',thickness=2)

counter = counter + 1

p1.axes_width(2)
m=p1.matplotlib(fontsize=20)

from matplotlib import pyplot
xticks = pyplot.getp(m.axes[0], 'xticklines')
yticks = pyplot.getp(m.axes[0], 'yticklines')

# adjust markeredgewidth and markersize to adjust the width and length 
of tickmarks

pyplot.setp(xticks, markeredgewidth=4, markersize=10)
pyplot.setp(yticks, markeredgewidth=2, markersize=12)

from matplotlib.backends.backend_agg import FigureCanvasAgg
m.set_canvas(FigureCanvasAgg(m))
m.savefig('test.png')


Thanks,

Jason

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


Re: [sage-support] Normal Distribution

2012-02-17 Thread Santanu Sarkar
Thanks for the help.

On 17 February 2012 16:00, Vegard Lima  wrote:
> On Fri, Feb 17, 2012 at 10:52 AM, Santanu Sarkar
>  wrote:
>> How to generate 1000 random integers which follow normal
>> distribution with mean 0 and variance 0.1?
>
> You can do this with numpy:
>
> sage: import numpy as np
> sage: mu, sigma = 0, sqrt(0.1) # mean and standard deviation
> sage: s = np.random.normal(mu, sigma, 1000)
>
> Note that it takes std.deviation as input not variance.
>
>
> Cheers,
> --
> Vegard
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

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


[sage-support] Re: Normal Distribution

2012-02-17 Thread Goebbe
Not sure what generating "integers" means, when drawing from a
normal,
but if you just want to draw random numbers, the following should do
it:

NV001 = RealDistribution('gaussian',sqrt(0.1))  #N(0,0.1)  mean=0 std
dev = sqrt(0.1)
randomdraws = [NV001.get_random_element() for _ in range(1000)]

-- 
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] How-to change the size of ticks ? ( use of graphs for presentations )

2012-02-17 Thread Goebbe
Hi,
this is my first post. Please keep in mind that I have just started to
use Sage.

I use the sage notebook in order to prepare graphs for a introductory
statistics class.
Since I use the graphs in presentations (powerpoint) - I modified
linewidth, fontsize in
order to get a graph that is easily visible in the presentation (even
from the back of the room).

Unfortunately I did not find a way to change the size of ticks. I
already searched the documentation of sage and of matplotlib, but I
just did not manage to get this work.
This is what I have currently:

P = [1/6,1/6,1/6,1/6,1/6,1/6]
X = [1,2,3,4,5,6]
discrDistr = [(X[_],P[_]) for _ in range(len(P))]   # Prepare
values for scatter_plot
p1 = scatter_plot(discrDistr, markersize=100,
facecolor='blue',xmin=0,xmax=(len(P)+0.5),ymax=0.3)
counter = 0
for expr in P:
p1 += line([(X[counter],0),(X[counter],expr)],
linestyle="--",color='black',thickness=2)
counter = counter + 1
p1.axes_width(2)
p1.show(fontsize=20)

If you evaluate the code in Notebook, you will get a nice, simple
graph with big fonts and larger lines.
However the ticks (small lines at the axis) are too small to be
visible. How can I manage to change the size/width of the ticks?
Any help would be appreciated. Thanks in advance

-- 
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] Normal Distribution

2012-02-17 Thread Vegard Lima
On Fri, Feb 17, 2012 at 10:52 AM, Santanu Sarkar
 wrote:
> How to generate 1000 random integers which follow normal
> distribution with mean 0 and variance 0.1?

You can do this with numpy:

sage: import numpy as np
sage: mu, sigma = 0, sqrt(0.1) # mean and standard deviation
sage: s = np.random.normal(mu, sigma, 1000)

Note that it takes std.deviation as input not variance.


Cheers,
-- 
Vegard

-- 
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: Modular operation in multivariate polynomials

2012-02-17 Thread Oleksandr Kazymyrov
Hi Simon,

I agree with you. My previous message is true only for GF(2^n).

Best regards,
Oleksandr

-- 
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: Modular operation in multivariate polynomials

2012-02-17 Thread Simon King
Hi Oleksandr,

On 17 Feb., 10:33, Oleksandr Kazymyrov 
wrote:
> No, I havn't. If this is not a problem for you then open.

OK, I'll do so later today.

> At the moment I use the following code:
>
> pol=sum([g.mod(P("y^{0}+y".format(1< = GF(3)[]
 sage: p = P.random_element()
 sage: p
 x^2 + x*y - 1
 sage: p.monomials()
 [x^2, x*y, 1]
 sage: p.coefficients()
 [1, 1, 2]
 sage: sum(p.monomials()) == p
 False

So, you must not forget to multiply each monomial with its
coefficient, for example:
 sage: sum([c*m for c,m in zip(p.coefficients(),p.monomials())]) == p
 True

Best regards,
Simon

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


[sage-support] Normal Distribution

2012-02-17 Thread Santanu Sarkar
How to generate 1000 random integers which follow normal
distribution with mean 0 and variance 0.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: Modular operation in multivariate polynomials

2012-02-17 Thread Oleksandr Kazymyrov
Hi Simon,

>> Do you have a trac account, or shall I open a trac ticket myself? 
No, I havn't. If this is not a problem for you then open.

At the moment I use the following code:

pol=sum([g.mod(P("y^{0}+y".format(1