摘要:import numpy as np def f(x): """定义被积函数 f(x) = ln(1 + x) / (1 + x^2)""" return np.log(1 + x) / (1 + x ** 2) def trapezoidal_rule(a, b, n, func): """梯形法
阅读全文
摘要:import numpy as np # 定义非线性方程组 def f(x): f1 = x[0] - 0.7 * np.sin(x[0]) - 0.2 * np.cos(x[1]) f2 = x[1] - 0.7 * np.cos(x[0]) + 0.2 * np.sin(x[1]) return
阅读全文
摘要:import numpy as np import matplotlib.pyplot as plt from scipy.stats import uniform, bernoulli, binom, geom, nbinom, hypergeom, poisson, multinomial #
阅读全文
摘要:import numpy as np import matplotlib.pyplot as plt from scipy.stats import uniform, norm, lognorm, t, f, expon, gamma, chi2, beta, laplace, cauchy, pa
阅读全文
摘要:\documentclass{ctexart} \usepackage{amsmath} \usepackage{amssymb} % 添加这个包以支持更多的数学符号 \usepackage{mathtools} % 添加这个包以支持更多的数学环境 \begin{document} \section
阅读全文
摘要:\documentclass[11pt]{ctexart} \usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry} \usepackage{algorithm} \usepackage{algorithmicx} \usepac
阅读全文
摘要:生成word 文档 请帮我写一个关于 解方程组迭代解法 的讲义。例题种类要多,题目丰富,以html格式输出,要有以word文档下载功能,并且 能直接下载word文档
阅读全文
摘要:import numpy as np def conjugate_gradient(A, b, x0=None, tol=1e-10, max_iter=1000): """共轭梯度法求解线性方程组 Ax = b 参数: A: 系数矩阵(n×n) b: 右侧向量(n) x0: 初始猜测解(可选) t
阅读全文
摘要:import numpy as np import time # 导入time模块用于计时 # 记录开始时间 start_time = time.time() def vandermonde_matrix(x, n): """生成范德蒙矩阵,x 是输入向量,n 是矩阵阶数""" return np.
阅读全文
摘要:import numpy as np import time # 导入time模块用于计时 # 记录开始时间 start_time = time.time() def hilbert_matrix(n): """生成 n 阶希尔伯特矩阵""" return np.fromfunction(lambd
阅读全文
摘要:项目总览结构 pom.xml <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>3.0.4</version> <
阅读全文
摘要:简化版的RK4代码 # 定义函数f,表示微分方程dy/dx = y - 2x/y def f(x, y): return y - 2 * x / y def rk4_step02(f, x, y, h): k1 = f(x, y) k2 = f(x + h / 2, y + k1*h / 2) k3
阅读全文
摘要:def bisect_method(a, b, tol=1e-6, max_iter=1000): """ 使用二分法求解方程 f(x) = x³ - 2x -5 = 0 在区间 [a,b] 内的根 参数: a -- 区间左端点 b -- 区间右端点 tol -- 允许的误差 (默认 1e-6) m
阅读全文