Ask Your Question

chenming's profile - activity

2020-12-17 00:44:47 +0200 received badge  Famous Question (source)
2017-03-20 12:04:31 +0200 received badge  Notable Question (source)
2016-07-02 00:33:07 +0200 received badge  Popular Question (source)
2014-11-18 08:04:33 +0200 received badge  Notable Question (source)
2014-05-23 07:53:45 +0200 received badge  Popular Question (source)
2013-10-20 22:34:07 +0200 marked best answer integration ends up with hypergeometric function can not be done by sage

It seems sage's default algorithm can't do it. You can use mathematica's algorithm to do it in sage. You don't need mathematica installed on you computer. Just type the following command.

b=var('b')
integral(1/(x^b+1),x,algorithm='mathematica_free')
2013-10-16 20:57:57 +0200 asked a question integration ends up with hypergeometric function can not be done by sage

we know the integration of

1/(a^b+1)

with respect to a is going to get

2F1(1,1/a,1+1/a,-a^x)

where 2f1 is hypogeometric function. However, once we to that in sage, it is not possible to get results

sage: integrate(1/(x^b+1),x)  
integrate(1/(x^b + 1), x)

hope this can be fixed up latter or have some alternative way to work around.

2013-10-09 20:35:40 +0200 commented answer How to output numerical array (matrix) out as hdf5 format?

I tried to install that in my scientific linux but still the same error occurs. It may caused by low version of gcc, not the problem of sage.

2013-10-09 07:26:02 +0200 answered a question How to output numerical array (matrix) out as hdf5 format?

I think this is a problem to the linux system i use (Scientifc linux)

Once I tried to compile h5py in another genoo pc, it works great

2013-10-09 02:26:33 +0200 asked a question How to output numerical array (matrix) out as hdf5 format?

I wish to use some other tools to further processing the data generated by sage. the output format should be in hdf5 format. However, it seems very hard to install h5py because it depends on HDF5.

so when i run

./sage --python setup.py build

to install h5py, it say

sh5py/api_compat.h:21:18: fatal error: hdf5.h: No such file or directory

so how do you handle hdf5 format in sage, or do you have anyideas to get around this problem (the dataset may be huge so output into txt file may not be practical.)

2013-10-09 02:20:56 +0200 commented answer How to assign matrix (vector) value to variable

Thanks! this does the trick for me!

2013-10-09 02:20:36 +0200 received badge  Scholar (source)
2013-10-09 02:20:36 +0200 marked best answer How to assign matrix (vector) value to variable

In programs like Numpy or R, this would be very reasonable behavior to expect. Those are data analysis tools.

R:

> sin(c(1,2,3,4))
[1]  0.8414710  0.9092974  0.1411200 -0.7568025

Numpy:

sage: import numpy as np
sage: sin(np.array([1,2,3,4]))
array([ 0.84147098,  0.90929743,  0.14112001, -0.7568025 ])

Sage is mathematical, however. So you will have to explicitly apply the function to all entries. Python makes this easy using list comprehensions or the map function.

sage: [sin(l).n() for l in [1,2,3,4]]
[0.841470984807897, 0.909297426825682, 0.141120008059867, -0.756802495307928]
sage: map(sin,[1,2,3,4])
[sin(1), sin(2), sin(3), sin(4)]
sage: map( lambda x: sin(x).n(), [1,2,3,4])
[0.841470984807897, 0.909297426825682, 0.141120008059867, -0.756802495307928]
2013-10-08 21:17:13 +0200 received badge  Supporter (source)
2013-10-08 21:14:44 +0200 asked a question How to assign matrix (vector) value to variable

when I tried to assign a matrix or a vector to variables, something wrong happens:

sage: sin([1,2,3,4]).n()
Traceback (click to the left of this block for traceback)
...
TypeError: cannot coerce arguments: no canonical coercion from <type
'list'> to Symbolic Ring

what I want to achieve is that the out put gives a vector that equals to [sin(1),sin(2),sin(3),sin(4)].

Thanks in advance!