Borrar filtros
Borrar filtros

How can I solve for specific complex solutions?

2 visualizaciones (últimos 30 días)
Ali Almakhmari
Ali Almakhmari el 9 de Sept. de 2023
Editada: Dyuman Joshi el 9 de Sept. de 2023
Hey guys, so I have the following expression:
syms ue
ye = (5/(6*(((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3)) + (((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3));
With ue being a real number, but ye can be either real or complex.
My goal is to solve for the values of ue that will make have a positive real number. If results in a complex number, then I am looking for the values of ue that will make the real part of the complex number positive. I hope someone can help.

Respuesta aceptada

Star Strider
Star Strider el 9 de Sept. de 2023
I am not certain what you want.
The first step in solving this is to plot the functions. They may either guide you to a solution or provide the complete solution.
In this instance, will have a positive real part if .
Try this —
syms ue
ye(ue) = (5/(6*(((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3)) + (((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3));
figure
fplot(real(ye),[-1 1], 'DisplayName','Re', 'MeshDensity',100)
hold on
fplot(imag(ye),[-1 1], 'DisplayName','Im', 'MeshDensity',100)
hold off
grid
xlabel('$u_e$', 'Interpreter','latex')
legend('Location','best')
title('$y_e$', 'Interpreter','latex')
f(ue) = 1.2*ye(ue)^2-1;
uev = solve(f == 0, ue)
uev = 
figure
fplot(real(f),[-1 1], 'DisplayName','Re', 'MeshDensity',100)
hold on
fplot(imag(f),[-1 1], 'DisplayName','Im', 'MeshDensity',100)
hold off
grid
xlabel('$u_e$', 'Interpreter','latex')
legend('Location','best')
title('$1.2y_e^2-1$', 'Interpreter','latex')
xline(double(uev),'--k',sprintf('$u_e$ = %.6f',double(uev)), 'Interpreter','latex')
.

Más respuestas (1)

Dyuman Joshi
Dyuman Joshi el 9 de Sept. de 2023
Editada: Dyuman Joshi el 9 de Sept. de 2023
Starting with the basics - solving for a real number can be achieved by solving for imaginary part equal to 0.
syms ue
ye = (5/(6*(((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3)) + (((225*ue^2)/16 - 125/216)^(1/2) - (15*ue)/4)^(1/3));
f = 1.2*ye^2-1;
Firstly - Let's try solving symbolically.
y = solve(imag(f)==0)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
y = 
0
As you can see, solve() could not help us.
Not to worry, we have another weapon in our arsenal, another way of checking values and that is the graph/plot of the expression.
Let's plot the imaginary values of the plot -
fplot(imag(f),1e5*[-1 1])
As one can observe from the above plot, there seems to be a trend for the negative values. Let's zoom more into the those values to examine the trend -
(After some experimentation with numbers, I found that this is the largest range for which we can plot via fplot; Though one is free to continue the experimentation and report accordingly)
fplot(imag(f),[-realmax("single") 0])
Now, it can be assumed (or extrapolated) from the plot that for any and all negative values, the imaginary part of the expression is 0 meaning the expression is real.
Task 1 is done.
Task 2 in hand, is to find positive real number. As we have established that our domain of concern is negative numbers, it's time to plot the graph for real values of the expression for negative inputs and note how values vary there -
fplot(real(f),1e5*[-1 0])
From a sample of values, the real part of the expression so far is positive. Time to plot using the experimentation numbers -
fplot(real(f),[-realmax("single") int64(0)])
It seems that we can make a similar conclusion as the one we did above i.e. the real values of the expression are positive for negative inputs.
"My goal is to solve for the values of ue that will make 1.2*ye^2-1 have a positive real number. "
The goal has been obtained! The solution is ue belongs to ( -Inf, 0 ]
I hope you can extend this work to obtain your 2nd goal as well.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by