Skip to content

Instantly share code, notes, and snippets.

View raydsameshima's full-sized avatar
🤒
Out sick

Ray D. Sameshima raydsameshima

🤒
Out sick
  • NYCCT
  • Brooklyn, NY
View GitHub Profile
sage: j = var('j')
sage: k = var('k')
sage: f(j,k) = factorial(j+k)/( factorial(j-1) * factorial(k) ) * 1/2^k
sage: F(j) = sum( f(j,k),k,0,oo)
sage: F(j)
2^(j + 1)*factorial(j)/factorial(j - 1)
sage: Fj = F(j)
sage: Fj.simplify_factorial()
2^(j + 1)*j
@raydsameshima
raydsameshima / problem2
Created September 15, 2021 18:54
mt1_2
sage: t = var('t')
sage: r = 10*1000 - 400*t
sage: z = 300 + 110*t -10/2*t^2
sage: sol = solve( z, t)
sage: s = sol[1]
sage: z.subs(sol[1])
-5*(sqrt(181) + 11)^2 + 110*sqrt(181) + 1510
sage: expand(_)
0
sage: r.subs(sol[1])
@raydsameshima
raydsameshima / Example1.2 (p.13)
Created September 6, 2021 21:04
Modern Thermodynamics
sage: g = 9.8*units.length.meter/(units.time.second^2);
....: h = 10*units.length.meter;
....: cw = 4.1868*units.energy.joule/(units.temperature.celsius*units.mass.gram);t = g*h/cw
sage: t
23.4068978694946*celsius*gram*meter^2/(joule*second^2)
sage: tt = t/(units.temperature.celsius)
sage: tt.convert()
0.0234068978694946
@raydsameshima
raydsameshima / prob02.sage
Last active September 17, 2021 14:29
chapter 02 problems
print("Problem 3, 12, 18, 23, 44, 46, 66")
print("Problem 3:")
print("(a) distance traveled:", abs(10-2) + abs(8-10) + abs(11-8), " [m]")
print("(b) magnitude of the displacement:", abs(11-2), " [m]")
# (2.1)
print("(c) displacement:", 11-2, " [m].")
A.F.Beardon Complex Analysis page 13:
```maxima
(%i1) z: sqrt( 1/2*( sqrt(u^2+v^2) + u) ) + %i*(v/sqrt( 2*( sqrt(u^2+v^2) + u) ) );
2 2
sqrt(sqrt(v + u ) + u) %i v
(%o1) ----------------------- + -------------------------------
sqrt(2) 2 2
sqrt(2) sqrt(sqrt(v + u ) + u)
(%i2) z^2;
(%i73) assume(l>0);
(%o73) [l > 0]
(%i74) integrate( exp(-%i*l*t^2),t,-inf,inf);
1 %i
sqrt(%pi) (------- - -------)
sqrt(2) sqrt(2)
(%o74) -----------------------------
sqrt(l)
(%i75) polarform (%);
%i %pi
(%i13) limit(integrate( ev( (-%i*x)^(n-1)*exp(%i*x*(D+%i*e))/gamma(n), n:3), x,0,inf), e,0);
%i
(%o13) --
3
D
(%i14) limit(integrate( ev( (-%i*x)^(n-1)*exp(%i*x*(D+%i*e))/gamma(n), n:4), x,0,inf), e,0);
%i
(%o14) --
4
D
@raydsameshima
raydsameshima / gist:97c2097a3fdeec41c46af0d828ea1efa
Created August 15, 2020 01:00
2 by 2 example of Moon's formula
(%i12) a: (-s11+r11+r12)*(-s22+r21+r22)-s12*s21;
(%o12) ((- s11) + r12 + r11) ((- s22) + r22 + r21) - s12 s21
(%i13) b: (r12*r21-s12*s21) + (r21*(r11-s11)+ r12*(r22-s22)) + (r11-s11)*(r22-s22);
(%o13) (r11 - s11) (r22 - s22) + r12 (r22 - s22) - s12 s21 + r21 (r11 - s11)
+ r12 r21
(%i14) is(a=b);
(%o14) false
(%i15) a-b, expand;
(%o15) 0
(%i16) is(ev(a=b, expand));
(%i1) load("Schwinger.mac");
The list of functions:
schwinger_matrix(list_of_loop_momenta, list_of_denominators)
symanzik_u(ls,ds)
symanzik_f(ls,ds)
lee_pomeransky_g(ls,ds)
homogeneous_lee_pomeransky_g(ls,ds)
As helper functions, the following functions are used:
det_but_outer_egdes(matrix)
@raydsameshima
raydsameshima / gist:8ad7b3f7b2feee8ea169da34b5f0ec4d
Created February 13, 2020 18:32
u and f for oneloop massless box
$ maxima -qb box.mac
maxima_userdir is /home/rds/.maxima
(%i1) batch("box.mac")
read and interpret /home/rds/Documents/latex/IBP/Schwinger/box.mac
(%i2) kill(all)
(%o0) done
(%i1) display2d:false
(%o1) false
(%i2) load("Schwinger.mac")