Precession of Mercury's orbit

260 days ago by reibaretti

# Mathematical Methods /Numerical codes #http://www1.uprh.edu/rbaretti #http://www1.uprh.edu/rbaretti/methodsoftheoreticalphysics.htm #http://www1.uprh.edu/rbaretti/MethodsofTheoreticalPhysicsPart2.htm #http://www1.uprh.edu/rbaretti/MethodsofTheoreticalPhysicsPart3.htm #http://www1.uprh.edu/rbaretti/MethodsofTheoreticalPhysicsPart4.htm #http://www1.uprh.edu/rbaretti/MethodsofTheoreticalPhysicsPart5.htm diff(x^3,x,2) 
       
6*x
6*x
f=x^2 diff(f,x) 
       
2*x
2*x
integral(f,x) 
       
x^3/3
x^3/3
integral(f,x,0,3) 
       
9
9
#x,y=var('x,y') # plot3d(16-x^2-y^2,(x,-2,2),(y,-2,2)) 
       
#y=plot(sin(x),0,pi) #show(y) 
       
y=plot(exp(-x),0,4) show(y) 
       
plot ((x^2+1),x,-2,2).show(xmin=-3,xmax=3,ymin=0.,ymax=6) 
       
integral(exp(-2*x),x,0,20) 
       
1/2 - e^-40/2
1/2 - e^-40/2
# two linear equations x, y = var('x, y') solve([8*x + y == 3, -x +7*y == 0],x,y) 
       
[[x == 7/19, y == 1/19]]
[[x == 7/19, y == 1/19]]
# example of Kirchoff eqs fro three currents i1,i2,i3=var('i1,i2,i3') solve([8*i1 + i2 +i3== 3, -i1 +7*i2 +i3== 0,i1+i2+i3==1],i1,i2,i3) 
       
[[i1 == 2/7, i2 == -1/14, i3 == 11/14]]
[[i1 == 2/7, i2 == -1/14, i3 == 11/14]]
# To solve the equation x''+9*x=0: t = var('t') # define a variable t x = function('x',t) # define x to be a function of that variable DE = lambda y: diff(y,t,2) +9*y desolve(DE(x(t)), [x,t]) 
       
k1*sin(3*t) + k2*cos(3*t)
k1*sin(3*t) + k2*cos(3*t)
# To solve the equation x''+ 9*x=0: t = var('t') # define the variable t x=function('x',t) DE=lambda x:diff(x,t,2)+diff(x,t)+ 9*x desolve (DE(x(t)),[x,t]) 
       
e^(-(t/2))*(k1*sin(sqrt(35)*t/2) + k2*cos(sqrt(35)*t/2))
e^(-(t/2))*(k1*sin(sqrt(35)*t/2) + k2*cos(sqrt(35)*t/2))
var('x,y,k ,L') x=10 f=2*k*L/(x^2+y^2)^(1/2) integral(f,y,0,100*x) 
       
2*arcsinh(100)*k*L
2*arcsinh(100)*k*L
# the R declaration defines the decimal result in terms of bits R=RealField(30) f=1/(5+x^2)^(1/2) g=integral(f,x,0,5) R(integral(f,x,0,5)) 
       
1.5444850
1.5444850
var('x, y') y = integral(sqrt(1 + x^2), x, 0, 2) print y # n(y,20) 
       
arcsinh(2) + 2 sqrt(5)
                             --------------------
                                      2
arcsinh(2) + 2 sqrt(5)
                             --------------------
                                      2
n((arcsinh(2) + 2*sqrt(5))/2,20) 
       
2.9579
2.9579
# 2x2 matrix A = matrix(2, 2,[1/(3), -1/(3), 1/(3), 1/(3)]); print(A) 
       
Syntax Error:
     A = matrix(2, 2,[1/(3), -1/(3), 1/(3), 1/(3)]);
Syntax Error:
     A = matrix(2, 2,[1/(3), -1/(3), 1/(3), 1/(3)]);
plot (.434*log(x),x,1,10).show(xmin=0,xmax=10,ymin=0.,ymax=1) 
       
a=pi;p=3; y=plot((a/pi)^(1/4)*cos(p*x)*exp(-a*x^2/2),-3,3) show(y) #cos(px/h') (α/π )1/4 exp ( - αx2 /2) 
       
var('x,n '); n=9; f=n/(pi*(1+(n*x)^2)); integral(f,x,-10,10) 
       
2*arctan(90)/pi
2*arctan(90)/pi
R=RealField(30) R(2*arctan(90)/pi) 
       
0.99292674
0.99292674
var('x,mu,sigma');sigma=.001;mu=0;eta=20; gauss=(1/sigma)*(1/(2*pi)^(1/2))*exp(-(x-mu)^2/(2*sigma^2)); y=plot(-eta*gauss,x,-3*sigma,3*sigma) show(y) 
       
var('x,mu,sigma');sigma=.001;mu=0;eta=20; gauss=(1/sigma)*(1/(2*pi)^(1/2))*exp(-(x-mu)^2/(2*sigma^2)); integral(gauss,x,-oo,oo) 
       
0.707106781187*sqrt(2)
0.707106781187*sqrt(2)
var('t'); y=plot(10*t*exp(-t^2),0,2.5) show(y) 
       
#f=2*x^2+1 ; #integral(f,x,2,5) K=81, m=0.6 , v=(2*K/m)^(1/2) 
       
Traceback (click to the left of this block for traceback)
...
ValueError: need more than 1 value to unpack
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sage/sagenb/sage_notebook/worksheets/reibaretti/11/code/6.py", line 8, in <module>
    K=_sage_const_81 , m=_sage_const_0p6  ,
ValueError: need more than 1 value to unpack
K=81; m=0.6 ; n(2*K/m)^(1/2) 
       
16.4316767251550
16.4316767251550
var('t') x=5*t^2+3*t; v=diff(x,t); 
       
10*t + 3
10*t + 3
var('x'); y=5*x^2;v=diff(y,x) x=2; show(v) 
       
10 \, x
10 \, x
r = 4 area = pi*r^2 area,area.n() 
       
(16*pi, 50.2654824574367)
(16*pi, 50.2654824574367)
var('x'); y=5*x^2; v=diff(y,x) v 
       
10*x
10*x
v=10*x x=3 v,v.n() 
       
(30, 30.0000000000000)
(30, 30.0000000000000)
var('r'); f=27- 18*r + 2*r^2 ; y=plot(f,r,0,10) show (y) 
       
f=r^3*exp(-r); exp(r)*diff(f,r,3) 
       
-(r^3*e^(-r) - 9*r^2*e^(-r) + 18*r*e^(-r) - 6*e^(-r))*e^r
-(r^3*e^(-r) - 9*r^2*e^(-r) + 18*r*e^(-r) - 6*e^(-r))*e^r
#( 27- 18 r + 2 r2 )2 exp( -2r/3) 4π r2 f=(27- 18*r + 2*r^2)^2*4*pi*r^2*exp(-2*r/3); integral(f,r,0,oo) 
       
19683*pi
19683*pi
81^2*3 
       
19683
19683
#{ 81(3 π) }-1/2 ( 27- 18 r + 2 r2 )2 exp( -2r/3) f=(81*3*pi)^(-1/2)*( 27- 18*r + 2*r^2)*exp( -r/3) plot(f,r,0,20) 
       
u=var('u'); #(1/2)*( 5*x^3 - 3*x) #f=(1/2)*(5*(2*u-1)^3 -3*(2*u-1) ); f1=5*(2*u-1)^3; f1 
       
5*(2*u - 1)^3
5*(2*u - 1)^3
u=var('u'); p2(u)= 6*u^2 -6*u + 1; p3(u)=20*u^3 -30*u^2 +12*u -1; integral(p2(u)*p3(u),u,0,1) 
       
0
0
var('a');Z=2;En=(5/4)*(a^2/2 -Z*a); E1= 2*(a^2/2 -Z*a);E2= 2*(1/4)*(a^2/2 -Z*a); e=(5/4)*(a^2 /2 -Z*a) + (17/81)*a + (8.936E-2* a)^2 /(En -E1)+ (8.582e-3*a)^2/(En -E2); plot(e,a,1.4,2.2) 
       
integral(1/(1+x^2),x) 
       
arctan(x)
arctan(x)
f(x)=exp(-x^2); integral(f(x),x,-oo,oo) 
       
sqrt(pi)
sqrt(pi)
n( pi^(1/2) ) 
       
1.77245385090552
1.77245385090552