Ask Your Question

kote's profile - activity

2016-09-07 21:19:33 +0200 received badge  Famous Question (source)
2016-09-07 21:19:33 +0200 received badge  Popular Question (source)
2016-09-07 21:19:33 +0200 received badge  Notable Question (source)
2016-04-23 21:37:32 +0200 received badge  Famous Question (source)
2015-05-21 05:19:28 +0200 received badge  Notable Question (source)
2015-01-14 11:57:59 +0200 received badge  Notable Question (source)
2014-10-07 00:01:53 +0200 asked a question integral from sin at plus minus infinity seems to be bad

This doesn't seem right to me

integrate(sin(x), x, -oo, +oo)
0

And this looks bad at all

integrate(sin(x), x, -oo, +2*oo)
0

Why this happening?

2014-04-13 13:45:15 +0200 received badge  Good Question (source)
2013-12-01 13:51:15 +0200 received badge  Popular Question (source)
2013-08-01 15:15:14 +0200 received badge  Popular Question (source)
2013-06-16 07:48:27 +0200 received badge  Nice Question (source)
2012-08-17 22:05:00 +0200 answered a question Matplotlib curve is out of axes boundaries

I export figure to the svg format. This is bug in my OS - some svg files displayed incorrectly. Firefox and Inskape open this svg correctly. Old version of SageMath gives little different svg-file, but sure that it is not a SageMath fault.

2012-08-16 23:49:11 +0200 asked a question Matplotlib curve is out of axes boundaries

I am using matplotlib to plot some figures. But after update from sage 4.8 to sage 5.2, I get some "tails" out of axes boundaries. How to turn it off?

image description

Thanks!

2012-04-16 08:36:21 +0200 commented question Cyrillic in matplotlib

omg, even this forum **** the cyrillic symbols(

2012-04-16 08:35:37 +0200 received badge  Editor (source)
2012-04-16 08:34:31 +0200 asked a question Cyrillic in matplotlib

I try to add some utf8 chars for figure legend and axis labels. This don't work. Found some example

#!/usr/bin/env pytnon
reset()
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
rc('text.latex',unicode=True)
rc('text.latex',preamble='\usepackage[utf8]{inputenc}')
rc('text.latex',preamble='\usepackage[russian]{babel}')

from pylab import *

x = linspace(0,2*pi,100)
y = sin(x)
plot(x,y,'-')
xlabel(u"??? ???????")
ylabel(u"??? ???????")
savefig('1.png')

but it also don't work correctly. I get latex error (when trying to save figure to *.svg - "Package ucs Error: Unknown Unicode character 134 = U+0086") or wrong characters that obviously not cyrillic. What to do?

2011-12-14 19:44:29 +0200 marked best answer How to multiply vector by number

This behaviour is part of Python (the following code is evaluated in the standard python shell, although it should also work in sage or a sage notebook):

>>> W = [1, 8, 4, 7, 10, 1, 6, 3]
>>> 2*W
[1, 8, 4, 7, 10, 1, 6, 3, 1, 8, 4, 7, 10, 1, 6, 3]

The standard thing to do is to either use list comprehension

>>> [3*i for i in W]
[3, 24, 12, 21, 30, 3, 18, 9]

or map (for a comparison, see http://stackoverflow.com/q/1247486/42...)

>>> map(lambda i: 3*i, W)
[3, 24, 12, 21, 30, 3, 18, 9]

Although, if you're using just numerical lists and are used to matlab, then maybe you should use numpy:

>>> import numpy
>>> npW = numpy.array(W)
>>> npW*3
array([ 3, 24, 12, 21, 30,  3, 18,  9])

For large arrays, NumPy will be faster at this type of operation than the pythonic methods above. For a discussion of NumPy in sage see http://www.sagemath.org/doc/numerical...


Of course, the standard sage approach is to use a vector object (see Laurent's answer)

2011-12-14 10:44:11 +0200 marked best answer How to multiply vector by number

Your W is not a vector but a list. If you want a vector you have to do the following :

sage: v=vector([1,2])
sage: v
(1, 2)
sage: 3*v
(3, 6)
sage: 
sage: v.column()
[1]
[2]

Laurent

2011-12-14 10:44:11 +0200 received badge  Scholar (source)
2011-12-14 10:44:02 +0200 received badge  Supporter (source)
2011-12-14 04:12:27 +0200 received badge  Student (source)
2011-12-14 03:25:23 +0200 asked a question How to multiply vector by number

I have vector

W = [1, 8, 4, 7, 10, 1, 6, 3]

I need to multiply it by number, but command 2*W gives just concatenated vector by itself

[1, 8, 4, 7, 10, 1, 6, 3, 1, 8, 4, 7, 10, 1, 6, 3]

I dont need it, I need multiply all elements of vector to number