例题
各主题下使用求解器的示例。打开一个查看它的解答,再改成你自己的题目即可求解。
代数
方程
不等式
导数
积分
极限
级数与求和
数列
- 平方数
find_sequence_function([1, 4, 9, 16, 25], n) - 斐波那契数列
find_sequence_function([1, 1, 2, 3, 5, 8, 13], n) - 三角数
find_sequence_function([1, 3, 6, 10, 15, 21, 28], n) - 2 的幂
find_sequence_function([2, 4, 8, 16, 32], n) - 阶乘
find_sequence_function([1, 2, 6, 24, 120, 720], n) - 卡特兰数
find_sequence_function([1, 1, 2, 5, 14, 42, 132], n) - 下一项是什么
next_terms([5, 11, 23, 47, 95, 191]) - 递推关系
find_linear_recurrence([1, 3, 4, 7, 11, 18, 29])
统计学
- 平均数
mean([2, 4, 4, 4, 5, 5, 7, 9]) - 中位数
median([3, 1, 4, 1, 5, 9, 2, 6]) - 标准差
standard_deviation([2, 4, 4, 4, 5, 5, 7, 9]) - 相关性
correlation([1, 2, 3, 4], [2, 4, 5, 9]) - 最佳拟合直线
fit([[0, 1], [1, 3], [2, 5], [3, 8]], [1, x], x) - 正态概率
probability(x > 1, distributed(x, normal_distribution(0, 1))) - 二项概率
probability(1 < x < 4, distributed(x, binomial_distribution(5, 1/2))) - 期望值
expectation(x^2, distributed(x, poisson_distribution(lambda)))
线性代数
- 行列式
det([[2, 0, 1], [1, 3, 2], [0, 1, 4]]) - 特征值
eigenvalues([[2, 1], [1, 2]]) - 特征向量
eigenvectors([[4, 1], [2, 3]]) - 秩
rank([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) - 零空间
null_space([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) - 行化简
row_reduce([[1, 2, 3], [4, 5, 6]]) - 线性方程组
linear_solve([[2, 1], [1, 3]], [3, 5]) - 矩阵指数
matrix_exp([[0, 1], [-1, 0]]) - 矩阵乘积
dot([[1, 2], [3, 4]], [[5, 6], [7, 8]]) - 矩阵幂
matrix_power([[1, 1], [1, 0]], 10) - 转置
transpose([[1, 2, 3], [4, 5, 6]]) - 叉积
cross([1, 2, 3], [4, 5, 6])
微分方程
随机微积分
- 伊藤公式
ito_formula(x^2, x, mu·x, sigma·x, t) - 几何布朗运动的对数
ito_formula(ln(x), x, mu·x, sigma·x, t) - 布朗运动的平方
ito_formula(x^2, x, 0, 1, t) - W dW 的伊藤积分
ito_integral(w, w, s, t) - W² 的伊藤积分
ito_integral(w^2, w, s, t) - 时间函数的积分
ito_integral(exp(s), w, s, t) - 伊藤等距
variance(ito_integral(w, w, s, t)) - GBM 的显式路径
geometric_sde_path(mu, sigma, x0, w, t) - OU 过程的均值
mean(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t) - OU 过程的方差
variance(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t) - GBM 的方差
variance(geometric_brownian_motion_process(mu, sigma, x0), t) - OU 过程的平稳分布
stationary_distribution(ornstein_uhlenbeck_process(mu, sigma, theta, x0)) - 仿射 SDE 的矩
affine_sde_moments(a, b, sigma, x0, t)
复数
优化
- 最小值
minimize(x^2 - 4x + 7, x) - 最大值
maximize(x·(10 - x), x) - 两个变量
minimize(x^2 + y^2 - 2x, [x, y]) - 一个线性规划
minimize([x + y, x + 2y >= 4, 3x + y >= 6, x >= 0, y >= 0], [x, y]) - 整数
maximize([5x + 4y, 6x + 4y <= 24, x + 2y <= 6, x >= 0, y >= 0, [x, y] : integer], [x, y]) - 绝对值
minimize([abs(x - 2) + abs(y + 1) + abs(x + y - 5), x >= 0, y >= 0], [x, y]) - 若干数中的最大值
minimize([max(x + y, 2x - y, 3 - x), x >= -5, x <= 5, y >= -5, y <= 5], [x, y]) - 距离之和
minimize([norm([x - 1, y - 2]) + norm([x + 1, y]), x + y >= 0], [x, y]) - 非凸,整数
minimize([x·y - 3x + 2y, x >= -2, x <= 3, y >= -1, y <= 4, [x, y] : integer], [x, y]) - 全局数值搜索
numeric_minimize([sin(3x) + (x - 1)^2/10, x >= -10, x <= 10], x)
特殊函数
变换
数论
逻辑
- 化简条件
boolean_minimize((p and q) or (p and not q)) - 多数表决
boolean_minimize((a and b) or (a and c) or (b and c and not a)) - 德摩根定律
is_tautology(not (p and q) == (not p or not q)) - 重言式
is_tautology(implies(p, q) or implies(q, p)) - 让它为真
satisfiability_instances(p and (q or not p)) - 数出所有情况
satisfiability_count(a or b or c) - 分配
logical_expand((p or q) and r) - 矛盾式
is_satisfiable(p and not p) - 规则链
is_tautology(implies(implies(p, q) and implies(q, r), implies(p, r)))
规则
- 相互冲突的规则
is_satisfiable((x > 1 or y > 1) and x <= 0 and y < 0) - 哪些定价规则冲突
conflicting_rules([implies(premium, d <= 3/10), premium, d > 1/2, p >= 0]) - 一项策略中的两处冲突
conflicting_rules([implies(premium, d <= 3/10), premium, d > 1/2, s >= 2, s <= 1]) - 自相矛盾的策略
conflicting_rules([implies(admin, mfa), implies(mfa, phone), admin, not phone, audit]) - 两个预订重叠
eliminate_quantifiers(exists(x, a <= x <= b and c <= x <= d)) - 一个时段落在另一个之内
eliminate_quantifiers(for_all(x, implies(a <= x <= b, c <= x <= d))) - 超过 100 的订单
eliminate_quantifiers(exists(n, n > 0 and n < 10 and n·p > 100)) - 两项任务的截止时间
eliminate_quantifiers(exists([s, t], s >= 0 and t >= s + 3 and t + 2 <= d)) - 预算内的折扣
eliminate_quantifiers(exists(d, d >= 0 and d <= 1/5 and p·(1 - d) <= 100)) - 满足规则的点
find_instance(x + y > 10 and x - y < 2 and x < 5, [x, y], real) - 圆上的一个有理点
find_instance(x^2 + y^2 = 1 and x > 3/5 and y > 3/5, [x, y], real) - 永不为负的抛物线
eliminate_quantifiers(for_all(x, x^2 + b·x + c >= 0)) - 始终不低于零的直线
eliminate_quantifiers(for_all(t, implies(0 <= t <= 1, a·t + b >= 0))) - 用6人桌和4人桌坐40位客人
conflicting_rules([6·t + 4·u = 40, t >= 5, u >= 2], integer) - 永远凑不齐的包装
find_instance(2·x + 4·y = 7, [x, y], integer)
算法
- 归并排序
solve_recurrence([t(n) = 2·t(n/2) + n, t(1) = 1], t, n) - 二分查找
solve_recurrence([t(n) = t(n/2) + 1, t(1) = 1], t, n) - 卡拉茨巴乘法
solve_recurrence([t(n) = 3·t(n/2) + n, t(1) = 1], t, n) - 施特拉森矩阵乘法
solve_recurrence([t(n) = 7·t(n/2) + n^2, t(1) = 1], t, n) - 主定理
recurrence_growth(t(n) = 2·t(n/2) + n^2, t, n) - 不等分划分
recurrence_growth(t(n) = t(n/3) + t(2·n/3) + n, t, n)
密码学
金融
排队与可靠性
- M/M/1 队列中的顾客数
sum(n·(1 - rho)·rho^n, n = 0..inf) - 可修复单元
solve([-l·p0 + m·p1 = 0, p0 + p1 = 1], [p0, p1]) - 威布尔生存概率
probability(x > 50, distributed(x, weibull_distribution(2, 100))) - 串联系统
integrate(exp(-(l1 + l2 + l3)·t), t = 0..inf, assuming = [l1 > 0, l2 > 0, l3 > 0]) - 三取二
integrate(3·exp(-2·l·t) - 2·exp(-3·l·t), t = 0..inf, assuming = l > 0)