Ask Your Question

Shashank's profile - activity

2018-09-21 11:32:25 -0500 received badge  Popular Question (source)
2018-09-21 11:32:25 -0500 received badge  Notable Question (source)
2018-06-05 12:41:45 -0500 received badge  Nice Answer (source)
2018-05-29 04:49:02 -0500 received badge  Famous Question (source)
2018-04-03 02:28:49 -0500 received badge  Nice Answer (source)
2018-03-29 04:00:41 -0500 received badge  Popular Question (source)
2018-03-25 18:19:49 -0500 received badge  Famous Question (source)
2018-02-16 05:42:19 -0500 received badge  Popular Question (source)
2018-01-15 04:35:15 -0500 received badge  Good Answer (source)
2017-08-20 15:15:31 -0500 received badge  Popular Question (source)
2017-08-15 01:49:25 -0500 received badge  Famous Question (source)
2017-06-30 18:51:58 -0500 received badge  Famous Question (source)
2017-06-21 02:17:55 -0500 received badge  Good Answer (source)
2017-06-09 13:16:02 -0500 received badge  Nice Answer (source)
2017-03-21 15:18:51 -0500 received badge  Notable Question (source)
2017-03-21 15:15:57 -0500 received badge  Famous Question (source)
2017-03-21 15:15:57 -0500 received badge  Notable Question (source)
2017-03-20 06:05:41 -0500 received badge  Famous Question (source)
2017-02-17 09:20:46 -0500 marked best answer Is there a way to simplify_full and trig_reduce a matrix?

I know I can do it component by component and then construct a matrix out of the output. But it would be nice if I could just say matrix.trig_reduce() and get a matrix with all the components trig_reduced. Thanks in advance

2017-02-17 08:14:31 -0500 received badge  Great Question (source)
2017-01-23 23:27:16 -0500 received badge  Notable Question (source)
2016-11-05 06:23:06 -0500 received badge  Famous Question (source)
2016-09-25 14:02:23 -0500 received badge  Notable Question (source)
2016-09-05 20:31:13 -0500 received badge  Famous Question (source)
2016-08-11 13:45:40 -0500 received badge  Famous Question (source)
2016-07-28 18:16:04 -0500 received badge  Notable Question (source)
2016-07-21 17:24:56 -0500 received badge  Notable Question (source)
2016-05-19 06:50:27 -0500 received badge  Famous Question (source)
2016-05-12 20:31:47 -0500 received badge  Famous Question (source)
2016-04-26 21:59:15 -0500 received badge  Popular Question (source)
2016-03-14 05:32:03 -0500 received badge  Famous Question (source)
2016-02-21 07:10:46 -0500 received badge  Notable Question (source)
2015-12-22 10:52:37 -0500 received badge  Popular Question (source)
2015-12-22 10:52:37 -0500 received badge  Notable Question (source)
2015-11-11 13:49:50 -0500 received badge  Civic Duty (source)
2015-11-09 14:38:01 -0500 asked a question substitute function for an array of functions

Hello, I have an array of functions defined as

arr = [function("y%d" % i,x) for i in [0..(2)]]

I also have a function of function

def square(x):

If I use substitute_function on the function of function it works.


However, the following command does not work,


The reason I think is that arr[0] has an argument by y0 does not. Is it possible to use substitute_function where the arguments have arguments?

2015-08-10 13:51:03 -0500 received badge  Famous Question (source)
2015-04-17 09:07:24 -0500 received badge  Notable Question (source)
2015-03-26 22:12:09 -0500 marked best answer Problem calling np.random.multinomial from notebook

According to np.random.multinomial? this is what I should expect

np.random.multinomial(20, [1/6.]*6, size=2)
array([[3, 4, 3, 3, 4, 3],
       [2, 4, 3, 4, 0, 7]])

However when I type the same thing in notebook I get an error. The same command works fine in my system python. In sage notebook it works when I drop the argument size=2. This seems to be problem with sage notebook. Any suggestions?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 10, in <module>
    exec compile(u'open("","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW1wb3J0IG51bXB5IGFzIG5wCm5wLnJhbmRvbS5tdWx0aW5vbWlhbCgxMDAsIFsxLzIuMF0qMixzaXplPTMp"),globals())+"\\n"); execfile(os.path.abspath(""))
  File "", line 1, in <module>

  File "/tmp/tmpARgtW7/", line 4, in <module>
    exec compile(u'np.random.multinomial(_sage_const_100 , [_sage_const_1 /_sage_const_2p0 ]*_sage_const_2 ,size=_sage_const_3 )
  File "", line 1, in <module>

  File "mtrand.pyx", line 4050, in mtrand.RandomState.multinomial (numpy/random/mtrand/mtrand.c:17809)
  File "element.pyx", line 1305, in sage.structure.element.RingElement.__add__ (sage/structure/element.c:11569)
  File "coerce.pyx", line 797, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7467)
TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and '<type 'tuple'>'
2015-03-26 22:12:09 -0500 marked best answer Is it possible to join matrices in to a bigger matrix?

I have two symbolic $2 \times 2$ matrices $A$ and $B$. I want to join them into a $4 \times 4$ matrix of the form $\begin{pmatrix}A & B \cr B & A\end{pmatrix}$.

The problem is that when I give


I get a three dimensional object, not a four by four matrix. The actual matrices I am working with are bigger than this, so I don't want to do it by hand. Is there a way of doing this without a bunch of for loops?

2015-03-26 22:12:06 -0500 marked best answer Is it possible to convert a string to mapping?

I am trying to develop a program which involves plotting. I am using matplotlib as a backend to plot histograms. In order to give the users more control over the plotting, I am trying to take a string from the users of the form

str = '\{\'alpha\':\'0.2\'\}'

and then passing is to a histogram using

kwargs = str

I get a error saying that kwargs must be a mapping not a string. Is there a way to convert a string to kwargs mapping? I am not trying to do this so that it works just for alhpa, but any option that hist accepts.

2015-03-26 22:12:04 -0500 marked best answer Interface of maxima atensor with sage

I am trying to use the atensor module of maxima in sage. I have trouble understanding the meaning of the symbols. According to the manual the basis of the algebra is given by v[1], v[2] etc, and atensimp(v[1].v[1]) should give -1. But, when I try to reproduce the result, I get the following.



I am trying to reproduce the algebra of gamma matrices

{gamma^mu,gamma^nu}=2 eta^{mu nu}

where {,} stands for anticommutator. and eta^{mu nu} is the metric. as described here

2015-03-26 22:12:00 -0500 marked best answer Compatibility of sagetex with arXiv and journals?

I was wondering whether anybody has any experience with trying to upload a draft created with sagetex on arXiv or journal servers. Normally arXiv prefers a tex file with figures in a tar.gz file. However, I was just trying to include a figure in a document and trying to compile it with sagetex. The problem is that I don't get a tex file and figure that I can upload on arXiv.

Is there a way to get a tex file and eps figues from sagetex, so that the whole thing can be compiled by the arXiv and journal servers (APS for example)

2015-03-26 22:11:50 -0500 marked best answer why won't simplify multiply out square roots?

I was trying to remove half angles in an expression. And it seems simplify() does not like to multiply out square root.


The output I get is $\frac{1}{2}\sqrt{-\cos\left(\theta\right) + 1} \sqrt{\cos\left(\theta\right) + 1}$

Is there a way I can make sage multiply out the the expression and give me $(1/2)sin \theta$

2015-03-26 22:10:30 -0500 marked best answer Is it possible to find the exponential of a symbolic matrix using sage?

I am searching for a function that is equivalent to mathematica's MatrixExp, that will calculate the exponential of a symbolic matrix. I don't want a term by term exponential but a something like expm() in scipy but for symbolic matrices.

Is it possible in sage?

2015-03-26 22:08:28 -0500 marked best answer Is there a way to save to to animations in the same avi file

I have two animations, I created using the animate command, which I want to save in the same avi or gif file one below another. Is there a way to do it. I tried (a+b).savefig(), but it saves the two animations on top of one another. I want something like the graphics_array but for animations.

Thanks in advance.