0
|
2185 Views
|
7 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Finding extreme points: cannot solve the equation

Posted 10 months ago
 First, attach the code, and I will raise my questions after the code. {r = 22, l = 2 10^-1, c = 1 10^-4, vi = 24, initvalueil = 0, initvaluevc = 0, tstart = 0, tend = 0.08, limitdt = 0.0001, error = 0.0019152}; \[CapitalDelta]vi = 0; A = {{0, -1/l}, {1/c, -1/(r c)}}; G = Inverse[A]; B = {1/l, 0}; S1 = Inverse[DiagonalMatrix[{1, 1}] - dt*A + 1/2*dt*dt*A . A]; S2 = Inverse[DiagonalMatrix[{1, 1}] - dt*A]; STAR1 = S1 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); STAR2 = S2 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); X0 = {0, 0}; X[t_] := Simplify[(MatrixPower[S1, i] - MatrixPower[S2, i]) . X0 + (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S1, i]) . Inverse[DiagonalMatrix[{1, 1}] - S1]) . STAR1 - (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S2, i]) . Inverse[DiagonalMatrix[{1, 1}] - S2]) . STAR2] /. {i -> t/dt}; ilerror = X[t][[1]]; ContourPlot[ Abs[ilerror] == error, {t, tstart, tend}, {dt, 0, limitdt}, ContourShading -> None, PlotPoints -> 50, FrameLabel -> Automatic, Epilog -> {PointSize[Large], Red, Point[{t, dt} /. {t -> 0.00899448, dt -> 0.00006}]}] condequal = Abs[ilerror] == error; dilt = D[condequal, t]; Solve[dilt == 0, t]  Since error has been assigned a value of 0.0019152, condequal can be considered as the relationship between dt and t. Therefore, I want to take the derivative of t through condequal to obtain the value of the corresponding extreme point t when dt obtains its extreme value. But Solve instruction cannot solve correctly in the code, how can I modify the code?
7 Replies
Sort By:
Posted 10 months ago
 This works fine for me: {r = 22, l = 2 10^-1, c = 1 10^-4, vi = 24, initvalueil = 0, initvaluevc = 0, tstart = 0, tend = 0.08, limitdt = 0.0001, error = 0.0019152}; \[CapitalDelta]vi = 0; A = {{0, -1/l}, {1/c, -1/(r c)}}; G = Inverse[A]; B = {1/l, 0}; S1 = Inverse[DiagonalMatrix[{1, 1}] - dt*A + 1/2*dt*dt*A . A]; S2 = Inverse[DiagonalMatrix[{1, 1}] - dt*A]; STAR1 = S1 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); STAR2 = S2 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); X0 = {0, 0}; X[t_] := Simplify[(MatrixPower[S1, i] - MatrixPower[S2, i]) . X0 + (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S1, i]) . Inverse[DiagonalMatrix[{1, 1}] - S1]) . STAR1 - (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S2, i]) . Inverse[DiagonalMatrix[{1, 1}] - S2]) . STAR2] /. {i -> t/dt}; ilerror = X[t][[1]]; ContourPlot[ Abs[ilerror] == error, {t, tstart, tend}, {dt, 0, limitdt}, ContourShading -> None, PlotPoints -> 50, FrameLabel -> Automatic, Epilog -> {PointSize[Large], Red, Point[{t, dt} /. {t -> 0.00899448, dt -> 0.00006}]}] condequal = ilerror == error; dilt = D[condequal, t]; FindRoot[{condequal, dilt}, {{t, 0.01}, {dt, 0.00005}}] 
Posted 10 months ago
 Not yet. I tried using FindRoot, but it seems that the program was unable to output the results. So I try to simplify the formula in the subsequent problems to make it easier to solve.
Posted 10 months ago
 First, attach the code, and I will raise my questions after the code. {r = 22, l = 2 10^-1, c = 1 10^-4, vi = 24, initvalueil = 0, initvaluevc = 0, tstart = 0, tend = 0.08, limitdt = 0.0001, error = 0.0019152}; \[CapitalDelta]vi = 0; A = {{0, -1/l}, {1/c, -1/(r c)}}; G = Inverse[A]; B = {1/l, 0}; S1 = Inverse[DiagonalMatrix[{1, 1}] - dt*A + 1/2*dt*dt*A . A]; S2 = Inverse[DiagonalMatrix[{1, 1}] - dt*A]; STAR1 = S1 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); STAR2 = S2 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt); X0 = {0, 0}; X[t_] := Simplify[(MatrixPower[S1, i] - MatrixPower[S2, i]) . X0 + (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S1, i]) . Inverse[DiagonalMatrix[{1, 1}] - S1]) . STAR1 - (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - MatrixPower[S2, i]) . Inverse[DiagonalMatrix[{1, 1}] - S2]) . STAR2] /. {i -> t/dt}; ilerror = X[t][[1]]; ContourPlot[ Abs[ilerror] == error, {t, tstart, tend}, {dt, 0, limitdt}, ContourShading -> None, PlotPoints -> 50, FrameLabel -> Automatic, Epilog -> {PointSize[Large], Red, Point[{t, dt} /. {t -> 0.00899448, dt -> 0.00006}]}] condequal = Abs[ilerror] == error; dilt = D[condequal, t]; Solve[dilt == 0, t] Since error has been assigned a value of 0.0019152, condequal can be considered as the relationship between dt and t. Therefore, I want to take the derivative of t through condequal to obtain the value of the corresponding extreme point t when dt obtains its extreme value. But Solve instruction cannot solve correctly in the code, how can I modify the code?
Posted 10 months ago
 Your function ilerror is positive in your domain. You can remove the Abs, which gives trouble when you take the derivative. Instead of Solve you can use FindRoot: condequal = ilerror == error; dilt = D[condequal, t]; FindRoot[{condequal, dilt}, {{t, 0.01}, {dt, 0.00006}}] which uses numerical methods to solve the system.
Posted 10 months ago
 condequal = Abs[ilerror] == error; dilt = D[condequal, t]; Solve[{condequal, dilt}, {t, dt}] Yes, it seems that after modifying to the above code, Solve cannot solve either. What if I want to obtain the minimum value (red dot) of the curve in the graph by taking a derivative equal to 0 to obtain the pole? Because the previous issue used FindMinimum, but I don't want to rely entirely on MMA instructions...
Posted 10 months ago
 Correction: dilt alone is already a relation. Writing dilt == 0 will make Solve complain.
Posted 10 months ago
 The way you set it up, dilt == 0 is also a relationship between t and dt, and if you Solve it, it will give a function, not a single point. You can try condequal = Abs[ilerror] == error; dilt = D[condequal, t]; Solve[{condequal, dilt}, {t, dt}] but I doubt that Solve will manage such a complicated system.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.