//p[@class="parrafo" and contains(text(), "diferencial")]
dissabte, 17 de febrer del 2024
dimecres, 14 de febrer del 2024
How To Make A Graph On Google Sheets With Multiple Data Sets & Independent Variables
How To Make A Graph On Google Sheets With Multiple Data Sets & Independent
Variables
dimecres, 7 de febrer del 2024
Inserir salt de pàgina en codi html
First page (this will be on page n.1)
<div style="break-after:page"></div>
Second page (This will be on page n.2)
dilluns, 15 de gener del 2024
dimarts, 9 de gener del 2024
Pgmpy: probabilistic graphical models using Python by A. Ankan, A. Panda
https://conference.scipy.org/proceedings/scipy2015/ankur_ankan.html
dijous, 28 de desembre del 2023
Gershgorin with montecarlo
import numpy as np
from itertools import permutations
def is_in_gershgorin_disks(matrix):
# Check if all eigenvalues of the matrix are in the Gershgorin disks
eigenvalues = np.linalg.eigvals(matrix)
n = matrix.shape[0]
for i in range(n):
center = matrix[i, i]
radius = np.sum(np.abs(matrix[i, :])) - np.abs(center)
if not np.all(np.abs(eigenvalues - center) <= radius):
return False
return True
def permute_rows(matrix, permutation):
# Permute rows in the matrix based on the given permutation
return matrix[list(permutation), :]
def monte_carlo_approximation(matrix, num_samples=1000):
n = matrix.shape[0]
for _ in range(num_samples):
# Randomly sample a permutation
permutation = np.random.permutation(n)
# Permute rows
permuted_matrix = permute_rows(matrix, permutation)
# Check if the permuted matrix satisfies Gershgorin's Circle Theorem
if is_in_gershgorin_disks(permuted_matrix):
return permutation, permuted_matrix
return None, None
# Input matrix
original_matrix = np.array([
[0, 0, 1],
[1, 0, 0],
[0, 1, 0]
])
# Monte Carlo approximation
permutation, permuted_matrix = monte_carlo_approximation(original_matrix, num_samples=1000)
if permutation is not None:
print(f"\nRows permutation {permutation} results in a matrix satisfying Gershgorin's Circle Theorem:")
print(permuted_matrix)
else:
print("No permutation found in the Monte Carlo approximation.")
Gershgorin Circle Theorem
I want to get the matrice where all ones are next to diagonal.
Seems it could be get from
import numpy as np |
.jpg)
.jpg)