摘要: import numpy as np import pandas as pd import sympy as sp sp.init_printing(use_latex=True) from scipy.integrate import odeint import matplotlib.pyplot 阅读全文
posted @ 2024-11-18 17:06 唐锦珅 阅读(1) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd import sympy as sp sp.init_printing(use_latex=True) from scipy.integrate import odeint import matplotlib.pyplot 阅读全文
posted @ 2024-11-18 17:04 唐锦珅 阅读(1) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from scipy.interpolate import interp1d, interp2d, UnivariateSpline, griddata import matplotlib.pyplot as plt t0 = np.linspace(700, 阅读全文
posted @ 2024-11-18 17:02 唐锦珅 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from scipy.interpolate import interp1d, interp2d, UnivariateSpline, griddata import matplotlib.pyplot as plt np.random.seed(114514) 阅读全文
posted @ 2024-11-18 17:01 唐锦珅 阅读(1) 评论(0) 推荐(0) 编辑
摘要: import numpy as np matches = np.array([ [0, 1, 0, 1, 1, 1], # 1队 [0, 0, 0, 1, 1, 1], # 2队 [1, 1, 0, 1, 0, 0], # 3队 [0, 0, 0, 0, 1, 1], # 4队 [0, 0, 1, 阅读全文
posted @ 2024-10-27 21:32 唐锦珅 阅读(0) 评论(0) 推荐(0) 编辑
摘要: import numpy as np distances = np.array([ [0, 2, 7, np.inf, np.inf, np.inf], [2, 0, 4, 6, 8, np.inf], [7, 4, 0, 1, 3, np.inf], [np.inf, 6, 1, 0, 1, 6] 阅读全文
posted @ 2024-10-27 21:31 唐锦珅 阅读(0) 评论(0) 推荐(0) 编辑
摘要: initial_costs = [2.5, 2.6, 2.8, 3.1] salvage_values = [2.0, 1.6, 1.3, 1.1] maintenance_costs = [0.3, 0.8, 1.5, 2.0] dp = [[float('inf')] * 2 for _ in 阅读全文
posted @ 2024-10-27 21:30 唐锦珅 阅读(0) 评论(0) 推荐(0) 编辑
摘要: import heapq def prim(graph, start): num_nodes = len(graph) visited = [False] * num_nodes min_heap = [(0, start, -1)] mst_cost = 0 mst_edges = [] whil 阅读全文
posted @ 2024-10-27 21:30 唐锦珅 阅读(0) 评论(0) 推荐(0) 编辑
摘要: edges = [ ("Pe", "T", 13), ("Pe", "N", 68), ("Pe", "M", 78), ("Pe", "L", 51), ("Pe", "Pa", 51), ("T", "N", 68), ("T", "M", 70), ("T", "L", 6 阅读全文
posted @ 2024-10-27 21:29 唐锦珅 阅读(1) 评论(0) 推荐(0) 编辑
摘要: import networkx as nx import matplotlib.pyplot as plt G = nx.Graph() nodes = ['v1', 'v2', 'v3', 'v4', 'v5', 'v6'] G.add_nodes_from(nodes) edges = [ (' 阅读全文
posted @ 2024-10-27 21:28 唐锦珅 阅读(1) 评论(0) 推荐(0) 编辑