I am trying to perform the second derivative test of this function I came up with

2 views (last 30 days)
Trying to do the second derivative test to find the minimum W, but none of this code is working. How do I get the critical points and then the second derivative to test if those points are a minimum. Also how do I go back and plug them into the equation for R and W when I set them up as syms.
E = 9.9*10^6;
p = .098;
F = 1500;
L = 20;
g = 32.2*12;
I = (F*L^2)/(E*pi^2);
syms R1 t
x = I == (pi/4)*(((R1+t)^4)-(R1^4));
R = solve(x, R1, 'MaxDegree', 4);
W0 = 2.*pi.*p.*L.*g.*t.*R;
disp(W0);
W = inline(W0,'t');
disp(W);
dW = diff(W(t),t)==0;
disp(dW);
cp = vpasolve(dW,t);

Accepted Answer

Walter Roberson
Walter Roberson on 29 Feb 2024
Edited: Walter Roberson on 29 Feb 2024
Q = @(v) sym(v);
Pi = Q(pi);
E = Q(9.9)*10^6;
p = Q(.098);
F = Q(1500);
L = Q(20);
g = Q(32.2)*12;
I = (F*L^2)/(E*Pi^2);
syms R1 t
x = I == (Pi/4)*(((R1+t)^4)-(R1^4));
R = solve(x, R1, 'MaxDegree', 4);
W0 = 2.*Pi.*p.*L.*g.*t.*R;
disp(W0);
dW = diff(W0,t)==0;
disp(dW);
cp = arrayfun(@(F) solve(F,t), dW(1), 'uniform', 0)
cp = 1×1 cell array
{4×1 sym}
cp{1}
ans = 
vpa(cp{1})
ans = 
Hmmm... those look suspiciously similar...
Note that the general solution involves
cp = arrayfun(@(F) solve(F,t), dW, 'uniform', 0)
I had to restrict it to dW(1) to fit within the time limits here.
  2 Comments
Oliver Ries
Oliver Ries on 29 Feb 2024
So for me it is only outputting the imaginary number, but not the rest. Since the imaginary number is so similar to the real number, I might just extract the leading part of it and use it as the real number. Unless would you be willing to help me figure out how to display all of these critical points.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!