Files
Masterprojekt/test.py

29 lines
560 B
Python

import numpy as np
from scipy.special import factorial as fact
from math import comb
J = np.array([
[2, 3, 0],
[0, 3, 0],
[6, 0, 4]
])
xi = np.array([1, 2, 3])
xi_col = xi.reshape(-1, 1)
print(xi_col)
xi_row = xi_col.reshape(1, -1).flatten()
print(xi_row)
# Spaltenvektor-Variante
res_col = xi[:, None] - J @ xi[:, None]
# Zeilenvektor-Variante
res_row = xi[None, :] - xi[None, :] @ J
print("Spaltenvektor:")
print(res_col[0,0])
print("Zeilenvektor:")
print(res_row)
t = 5
l = 2
print(fact(t+1-l) / (fact(t+1-l) * fact(l-1)), comb(l-1, t+1-l))