Skip to content

Instantly share code, notes, and snippets.

@kumanna
Created September 29, 2025 07:11
Show Gist options
  • Select an option

  • Save kumanna/ff1b0d339ce6ca9edc4f01869e24b6d5 to your computer and use it in GitHub Desktop.

Select an option

Save kumanna/ff1b0d339ce6ca9edc4f01869e24b6d5 to your computer and use it in GitHub Desktop.
import numpy as np
M = 4
p = 2
beta = 1
c = p * M + beta
C = np.array([-3 / 4, -1 / 4, 1 / 4, 3 / 4]) * c
C_new = np.zeros_like(C)
L = 1
for i, v in enumerate(C):
C_new[i] = C[i]
while C_new[i] > L:
C_new[i] -= 2 * L
while C_new[i] < -L:
C_new[i] += 2 * L
print(C_new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment