solving equation with a sqrt inside a integral

8 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 12 Feb 2021
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))
y = 
part1 = int(x*y, [x Q(0.420305)])
part1 = 
part2 = int(y,[x Q(0.420305)])
part2 = 
z = Q(0.32446) == part1 / part2
z = 
k = solve(z,x)
k = 
vk = vpa(k)
vk = 
real_positive = vk(imag(vk) == 0 & vk > 0)
real_positive = 

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by