如何求解包含一个积分和 2 个参数的方程
这是我想要求解的方程组的一个例子。 方程
a 和 b 的选择方式必须使这些积分的结果为 0。 但如果我不能像 Ax=b 这样写的话,我不知道
- 如何与参数集成
- 如何求解方程组。如果是这样我可以用 x = A\b 解决它
This is an example of a system of equations which I would like to solve.
equations
a and b must be selected in such a way that the results of these integrals are 0.
But I don't know
- how to integrate with parameters
- how to solve a system of equations if I can't write it like Ax=b. If so I could solve it with x = A\b
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您无法解析求解积分,则可以将
int
与syms
结合使用来获取积分的表达式。您可以通过
solve
找到其根比较每个方程的根会告诉您是否存在可以求解方程的
a
和b
。Assuming you can't solve the integrals analytically, you can use
int
withsyms
to get an expression of the integrals.which you can find the roots of by
solve
Comparing the roots for each equation would tell you if there is an
a
andb
that solves the equations.积分是线性的,因此可以立即提取参数。您的示例中有
a * I1 + b * I2 = 0
和a * I3 + b * I4 = 0
,其中I1
是(x-8)^3 的从 0 到 1 的积分等。这种情况下的被积函数是平凡多项式(即使在 u 替换后也是单项式)。您可以轻松地手动计算积分,尽管这里很简单,只需观察所有积分都必须非零。因此,您得到了
A * [a, b]' = 0
形式的一般线性系统,其中A
中的所有条目均非零。除了退化系统(本例不是)之外,唯一的解决方案是a = b = 0
。一般来说,假设右侧有可能非零,您将使用相同的想法。将积分分布在参数上,得到一个方程组,其中参数乘以常数(非参数化积分的值)。通过分析或数值方式评估积分。如果方程组的参数始终是线性的,则以通常的方式求解所得方程组,只需使用
A \ rhs
即可。Integration is linear, so the parameters can immediately just be pulled out. You have
a * I1 + b * I2 = 0
anda * I3 + b * I4 = 0
in your example, whereI1
is the integral from 0 to 1 of (x-8)^3, etc.The integrands in this case are trivial polynomials (monomials even after u-substitution). You can easily evaluate the integrals by hand, though it's simple here to just observe that all must be nonzero. Hence you've got a general linear system of the form
A * [a, b]' = 0
with all the entries inA
nonzero. Aside from a degenerate system (which this case isn't), then the only solution isa = b = 0
.In general, assuming you have the possibility of a nonzero right-hand side, you'll use the same idea. Distribute the integration over the parameters, getting a system of equations with parameters being multiplied by constants that are the values of the non-parameterized integrals. Evaluate the integrals, either analytically or numerically. Solve the resulting system of equations in the usual way, with just
A \ rhs
if the system is always linear in the parameters.