摘要: import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import griddata def f(x, y): return (x2 - 2*x) * np.exp(-x2 - y**2 - x*y) x_ 阅读全文
posted @ 2024-11-10 15:17 Tsuki* 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d, CubicSpline T = np.array([700, 720, 740, 760, 780]) V = np. 阅读全文
posted @ 2024-11-10 15:06 Tsuki* 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd import networkx as nx import matplotlib.pyplot as plt a = pd.read_excel(r"ti6_7.xlsx") b = a.values s = list(b[ 阅读全文
posted @ 2024-10-27 14:28 Tsuki* 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import networkx as nx import matplotlib.pyplot as plt G = nx.Graph() G.add_nodes_from([1, 2, 3, 4, 5, 6]) edges = [(1, 2), (1, 3), (1, 4), (2, 3), (2, 阅读全文
posted @ 2024-10-26 21:33 Tsuki* 阅读(9) 评论(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-26 20:49 Tsuki* 阅读(3) 评论(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-22 17:29 Tsuki* 阅读(3) 评论(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-22 16:58 Tsuki* 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import matplotlib.pyplot as plt import numpy as np import cvxpy as cp x = cp.Variable(6, pos=True) obj = cp.Minimize(x[5]) a1 = np.array([0.025, 0.015 阅读全文
posted @ 2024-10-22 16:31 Tsuki* 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import numpy as np from scipy.sparse.linalg import eigs import pylab as plt w = np.array([[0, 1, 0, 1, 1, 1], [0, 0, 0, 1, 1, 1], [1, 1, 0, 1, 0, 0], 阅读全文
posted @ 2024-10-22 16:20 Tsuki* 阅读(4) 评论(0) 推荐(0) 编辑
摘要: import sympy as sp def solve_difference_equation(): n = sp.symbols('n') x = sp.Function('x') eq = sp.Eq(x(n + 2) - x(n + 1) - 2 * x(n), 0) sol = sp.rs 阅读全文
posted @ 2024-10-22 16:13 Tsuki* 阅读(3) 评论(0) 推荐(0) 编辑