metagraphoptimization.jl/notebooks/num_diagrams.ipynb

124 lines
2.2 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"using Combinatorics"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"num_diagrams (generic function with 3 methods)"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"function num_diagrams(m::Int, e::Int, u::Int = 0, t::Int = 0)\n",
" n = e + u + t\n",
" return Int(factorial(3n-3) / factorial(2n-1)) * binomial(m+3n-3, 3n-3) * factorial(m) * factorial(e) * factorial(u) * factorial(t)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Trident:\n",
"num_diagrams(1, 2)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7-element Vector{Int64}:\n",
" 2\n",
" 6\n",
" 24\n",
" 120\n",
" 720\n",
" 5040\n",
" 40320"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# n-Photon Compton:\n",
"[num_diagrams(n, 1) for n in 2:8]"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6-element Vector{Int64}:\n",
" 2\n",
" 36\n",
" 1728\n",
" 158400\n",
" 23587200\n",
" 5181926400"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# fermion scattering\n",
"[num_diagrams(0, n) for n in 2:7]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.4",
"language": "julia",
"name": "julia-1.9"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}