Solve 𝑔 ′ ( 𝑥 ) = 0 for z in terms of N, a positive integer
53 views (last 30 days)
Show older comments
Fatima Majeed
on 19 Nov 2024 at 21:08
Answered: Walter Roberson
on 21 Nov 2024 at 2:50
I need help solving for z in terms of N, where . The function is:
where N is a positive integer. I computed the derivative :
Setting , I simplified the equation as:
where
# Goal:
I want to find a general expression for z in terms of N, such as , or understand how z depends on N.
# Questions:
1. How can I solve this cubic equation in MATLAB symbolically for z in terms of N ?
2. Is there a straightforward way to determine if is decreasing for general N ?
Thank you for your help!
0 Comments
Accepted Answer
John D'Errico
on 19 Nov 2024 at 23:00
Edited: John D'Errico
on 20 Nov 2024 at 0:06
First, it is not a cubic equation!
Yes, you can replace sqrt(x) with a new variable z, thus a transformation. But doing so can sometimes introduce spurious or false solutions. For example, if a negative value for z is one of the solutions, then it is not a solution to your problem, but it may be a solution to the transformed problem in z. You will generally need to test to see if what you find really is a solution to the original problem.
You already have the problem in the form of a cubic polynomial in z.
Can you write down the general solution to a cubic polynomial in terms of the coefficisnts? Yes. This has been known for longer than any of us have been alive.
Just apply solve to the result. Note that it will be a mess, with imaginary terms in it. And depending on the value of N, you will have exactly 1 or 3 real solutions.
syms z N
EQ = 2*N*sqrt(2*sym(pi))*z^3 + 4*N*sqrt(2*sym(pi))*z^2 - 4
zsol = solve(EQ,maxdegree = 3)
zsol =
4/(9*(((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)) + (((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3) - 2/3
- 2/(9*(((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)) - (((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)/2 - (3^(1/2)*(4/(9*(((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)) - (((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3))*1i)/2 - 2/3
- 2/(9*(((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)) - (((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)/2 + (3^(1/2)*(4/(9*(((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3)) - (((2^(1/2)/(2*N*pi^(1/2)) - 8/27)^2 - 64/729)^(1/2) + 2^(1/2)/(2*N*pi^(1/2)) - 8/27)^(1/3))*1i)/2 - 2/3
And again, it will depend on the value of N what will happen.
3 Comments
John D'Errico
on 21 Nov 2024 at 1:36
Edited: John D'Errico
on 21 Nov 2024 at 1:41
I'm sorry, but I don't do homework, and this is sounding far too much like homework now. Next, please don't ask completely new questions as a comment to an old question.
Can you identify where the two functions are equal? (Hint: subtract them, and find where the difference is zero. What tool will locate that point? Hint #2, use fzero.)
Make sure you locate multiple locations where they cross, if that happens. Plotting the difference function can help you learn if there are multiple such intersections.
Once you know where the functions cross, can you simply test to see which is larger in the intervals between the crossing points?
More Answers (1)
Walter Roberson
on 21 Nov 2024 at 2:50
Let's try...
Q = @(v) sym(v);
syms f(x) g(x) G(z)
syms z positive
syms N integer
assumeAlso(N, 'positive');
g(x) = 4*N*sqrt(2/(Q(pi)*x)) + 2*x*N + 4/sqrt(2*x*Q(pi))
G(z) = subs(g, x, z^2)
f(x) = 2*(N+1)*log(1/x)
D = f(x) - g(x)
D10 = subs(D, N, (1:100).');
sol=arrayfun(@(X)vpasolve(X,[0 inf]), D10, 'uniform', 0);
find(~cellfun(@isempty, sol))
So in the range N = 1 to N = 100, there are no cases where f(x) and g(x) cross-over for non-negative x.
If we can generalize to larger N, then the implication would be that either f(x) is always larger or else g(x) is always larger.
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!