How to solve a system of equations with integrals

14 ビュー (過去 30 日間)
Jingjiao Guan
Jingjiao Guan 2021 年 3 月 7 日
コメント済み: Jingjiao Guan 2021 年 3 月 9 日
x1, x2 and x3 are variables. Could anyone tell me how to solve the below system of equations? Thanks!

採用された回答

Walter Roberson
Walter Roberson 2021 年 3 月 8 日
syms x1 x2 x3 t real
assume(x1>=0 & x2>=0 & x3>=0 & t>=0)
eqn1 = simplify(int(x1*x2*t, t, x3, 0.8)) == 0.5
eqn1 = 
eqn2_part1 = simplify(int(x1*x2*t, t, x3, t))
eqn2_part1 = 
eqn2_part2 = simplify(x1+x2+t)
eqn2_part2 = 
eqn2_part3 = simplify(int(eqn2_part1 / eqn2_part2, t, 0.1, x3))
eqn2_part3 = 
eqn2 = simplify(eqn2_part3 == 0.4)
eqn2 = 
eqns = (subs([eqn1; eqn2], x3, 1-x1-x2))
eqns = 
sol = solve(eqns, 'returnconditions', true)
sol = struct with fields:
x1: [1×1 sym] x2: [1×1 sym] parameters: [1×2 sym] conditions: [1×1 sym]
sol.x1
ans = 
z
sol.x2
ans = 
sol.conditions
ans = 
eqnexpr = lhs(eqns)-rhs(eqns);
char(eqnexpr)
ans = '[- (x1*x2*(25*(x1 + x2 - 1)^2 - 16))/50 - 1/2; 5*x1*x2*(x1/10 + x2/10 + (x1 + x2 - 1)^2/2 - log(x1 + x2 + 1/10)*(x1 + x2)^2 + (x1 + x2)*(x1 + x2 - 1) - 1/200) + 5*x1*x2*log(x1 + x2 + 1/10)*(x1 + x2 - 1)^2 - 4]'
Feqns = matlabFunction(eqnexpr, 'vars', {[x1, x2]})
Feqns = function_handle with value:
@(in1)[in1(:,1).*in1(:,2).*((in1(:,1)+in1(:,2)-1.0).^2.*2.5e+1-1.6e+1).*(-1.0./5.0e+1)-1.0./2.0;in1(:,1).*in1(:,2).*(in1(:,1)./1.0e+1+in1(:,2)./1.0e+1+(in1(:,1)+in1(:,2)-1.0).^2./2.0-log(in1(:,1)+in1(:,2)+1.0./1.0e+1).*(in1(:,1)+in1(:,2)).^2+(in1(:,1)+in1(:,2)).*(in1(:,1)+in1(:,2)-1.0)-1.0./2.0e+2).*5.0+in1(:,1).*in1(:,2).*log(in1(:,1)+in1(:,2)+1.0./1.0e+1).*(in1(:,1)+in1(:,2)-1.0).^2.*5.0-4.0]
nsol = fsolve(Feqns, [1/2 1/3])
No solution found. fsolve stopped because the problem appears regular as measured by the gradient, but the vector of function values is not near zero as measured by the value of the function tolerance.
nsol = 1×2
1.0756 1.0757
  4 件のコメント
Walter Roberson
Walter Roberson 2021 年 3 月 8 日
There are other approaches as well, but their success depends upon knowing the constraints.
Jingjiao Guan
Jingjiao Guan 2021 年 3 月 9 日
Thanks again! Below is my real system of equations. x3 is between 0 and 1. x4 is between 0 and 2. x1 and x2 should be real numbers. I modified your code (I only kept things I understand). Please see the code under the equations. It has been running for almost an hour without giving out result. I would really appreciate if you could tell me if it is correct or if can be accelerated.
syms x1 x2 x3 x4 t
eqn1 = int(((x1*t+x2/t)^(-2)-1)^(-0.5), t, x3, 0.8) - x4 == 0
eqn2_part1 = 1 - (int(((x1*t + x2/t)^(-2)-1)^(-0.5), t, x3, t))^2 - t^2
eqn2_part2 = ((x1*t + x2/t)^(-2)-1)^(-0.5)
eqn2_part3 = int(eqn2_part1 / eqn2_part2, t, 0.8, x3 )
eqn2 = 0.75 * eqn2_part3 - 0.1 == 0
eqn3 = (x1 - 1) * x3^2 + x2 == 0
eqn4 = x3^2 + (1-x4)^2 - 1 == 0
eqns = [eqn1, eqn2, eqn3, eqn4];
sol = solve(eqns, [x1 x2 x3 x4])
sol.x1
sol.x2
sol.x3
sol.x4

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by