Ask Your Question

John Bao's profile - activity

2023-04-27 23:04:01 +0200 received badge  Notable Question (source)
2023-04-27 23:04:01 +0200 received badge  Popular Question (source)
2023-04-15 18:50:59 +0200 received badge  Famous Question (source)
2022-11-08 02:00:38 +0200 received badge  Notable Question (source)
2022-11-08 02:00:38 +0200 received badge  Popular Question (source)
2022-03-24 07:36:17 +0200 received badge  Notable Question (source)
2020-12-16 02:52:34 +0200 received badge  Popular Question (source)
2019-12-25 06:48:36 +0200 commented question How to make Taylor expansion with fixed numerical precision?

Thanks @Nasser. What I need is a numerical solution.

2019-12-25 05:37:23 +0200 asked a question How to make Taylor expansion with fixed numerical precision?

Following command

f(x)=sin(x)
taylor(f,x,1.0,2)

shows result:

x |--> -0.4207354924039483*(x - 1.0)^2 + 0.5403023058681398*x + 0.30116867893975674

The precision of result has too many bits, what I want is 3 bits, such as:

x |--> -0.420*(x - 1.0)^2 + 0.540*x + 0.301

How to do it?

Thanks for your help.

2019-09-13 11:31:37 +0200 asked a question More physics constants in Sagemath

I can you following command to load physics constants h and c:

 from scipy.constants import  h, c
 h, c   # show value of h and c

But, how can I load more physics constants such as Bohr magneton? Following command doesn't work,

 from scipy.constants import  Bohr magneton
 Bohr magneton   # to show Bohr magneton

I load physics constant from https://docs.scipy.org/doc/scipy/refe...

Thanks for help.

2019-09-08 08:53:38 +0200 commented question How to show more results in sagemathcell?

Thanks slelievre, is it possible to display full output in sagemathcell (not in Jupyter), not only last result? @slelievre

2019-07-04 11:22:14 +0200 received badge  Nice Question (source)
2019-07-03 15:56:25 +0200 asked a question Is there a way to remove "Terms of Service" popup?

My dear friends,

after using sagemath for a few of month, I want to introduce more people to use sagemath, because sagemath is really useful and powerful.

I live in China, and we have GFW, hence mnay site such as google, facebook, are blocked. I am not sure if sagemath.org would be blocked, hence I want to setup own sagemath server.

Thanks for the open source of sagemath, I almost have my own sagemath server! When I try embedded sagemath code in some sagemathcell, and Evaluate code, it always popup the "Terms of Service". Is there a way to remove it?

Please visit http://sagemath.askplanck.cn Put any sagemath code, such as, 1+2 You will find the popup.

Thanks for help!

John

2019-05-30 05:33:14 +0200 commented answer How to show more results in sagemathcell?

Thank you very much. I am working of @slelievre 's suggestion.

2019-05-27 03:27:09 +0200 commented answer How to show more results in sagemathcell?

Thank you, FrédéricC and Juanjo. But your answers is not what I want. I wish the ouput has 3 lines. My example is for simplity, other example cannot be written as an array. Is there any other suggestion?

2019-05-26 14:47:46 +0200 asked a question How to show more results in sagemathcell?

If I put following comand in http://sagemath.askplanck.cn/

1+2
10+20
100+200

If Evaluate above command, I can only get last result: 300. What I wish is too get 3 results one by one in my own sagemath server , How can I do in configure file.

In https://cocalc.com/, if I put above comand, it shows 3 results. This is nice,and is what I want. Is it possible in such like sagmathcell?

PS. I don't want to put command as following (which can show 3 results):

print 1+2
print 10+20
print 100+200

Thank you very much for your suggestion.

John

2019-04-11 08:37:26 +0200 commented answer Cannot solve differential equation (Lane-Emden equation) numerically

Thank you very muchfor you nice answer, Mr. Buring. For the first plot, is there a simple way to find t where y0=0?

2019-03-08 02:48:45 +0200 received badge  Supporter (source)
2019-03-08 02:48:42 +0200 received badge  Scholar (source)
2019-03-07 14:48:56 +0200 received badge  Student (source)
2019-03-07 14:29:18 +0200 received badge  Editor (source)
2019-03-07 12:06:38 +0200 asked a question Cannot solve differential equation (Lane-Emden equation) numerically

Hi, my friends,

I tried to solve Lane-Emden equation, as model of white dwarf,

$$ \frac{d^2x}{dt^2} +\frac2 t \frac{dx}{dt} + x^n = 0, ~~~~ where ~~~~n=\frac 3 2 $$

and I have some troubles in sagemath.

I am using following code:

T = ode_solver()
def f_1(t,y): return [y[1],-2/t*y[1]-y[0]^(3/2)]
T.function = f_1
def j_1(t,y): return [[0, 1], [-3/2*y[1]^(1/2), -2/t], [0,2*y[1]/t^2]]     #Jacobian matrix
T.jacobian = j_1
T.algorithm = "rk8pd"
T.ode_solve(y_0=[1,0], t_span=[0,10], num_points=1000)
f = T.interpolate_solution()
plot(f, 0, 10)

Above code is very similar of the example in sagemath reference: Van der Pol equation

Both equations (Lane-Emden and Van der Pol) are non-linear differential equation, therefore, are not easy to solve.

I don't know where comes to problem in above codes, can someone give me a help?

John