solving equation with a sqrt inside a integral
5 次查看(过去 30 天)
显示 更早的评论
freddy alexander rodriguez torres
2021-2-12
评论: freddy alexander rodriguez torres
2021-2-12
I've been trying to solve a equation that use a integral, the variable that I want to solve is the lower limit of the integral but when matlab solve the integral has to solve a sqrt giving me more than one solution (because as we know sqrt has two valid solutions), the code is:
syms x
y=(-167345*x^6+200645*x^5-90447*x^4+18683*x^3-1852.8*x^2+58.263*x+48.285);
z=(0.32446==((int(x*y, [x 0.420305]))/(int(y,[x 0.420305]))));
k=(solve(z,x));
fprintf('%.15f is the result\n',k);
and the result is:
-0.174670861644735 is the result
0.246003981099967 is the result
0.003755115444164 is the result
0.003755115444164 is the result
0.378689560826992 is the result
0.378689560826992 is the result
0.484558368289631 is the result
I just want that matlab shows the second result; I'm using matlab R2020a - academic use
thanks a lot.
0 个评论
采纳的回答
Walter Roberson
2021-2-12
You are mistaken, there is no square root.
You have a degree 6 polynomial that you multiply by x, giving a degree 7 polynomial. You integrate that, giving a degree 8 polynomial.
You have a degree 6 polynomial that you integrate, giving a degree 7 polynomial.
You have the ratio of those two equaling a constant. Multiply through by the degree 7 polynomial to get degree 7 on one side and degree 8 on the other. Bring all the terms to the same side and you have a degree 8 polynomial. That has 7 roots.
No square roots involved.
No particular reason to favor one over another if they are real-valued (and perhaps favour real and positive)
syms x
Q = @(v) sym(v);
y=(-Q(167345)*x^6+Q(200645)*x^5-Q(90447)*x^4+Q(18683)*x^3-Q(1852.8)*x^2+Q(58.263)*x+Q(48.285))
part1 = int(x*y, [x Q(0.420305)])
part2 = int(y,[x Q(0.420305)])
z = Q(0.32446) == part1 / part2
k = solve(z,x)
vk = vpa(k)
real_positive = vk(imag(vk) == 0 & vk > 0)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!