1
$\begingroup$

I used the $NMinimize$ instruction to calculate, but what I got was the dt value of the red circle. If I want to obtain the dt value of the green circle, how do I obtain it?

enter image description here

The code for generating the curve is as follows:

vc = Function[t, 
   23.999999999999996` + 
    55.082039324993595` E^(-267.92850868181444` t) - 
    79.08203932499359` E^(-186.61694586364015` t)];
condunequal = Abs[-1/2 dt (vc'[t + dt] - vc'[t])] <= 1/50000;
condequal = Abs[-1/2 dt (vc'[t + dt] - vc'[t])] == 1/50000;
RegionPlot[condunequal, {t, 0, 2/25}, {dt, 0, 0.0001}, 
 FrameLabel -> {t, dt}]
maxvc = NMinimize[{dt , condequal, 0 <= t <= 2/25, 
   0 <= dt <= 0.0001}, {t, dt}, MaxIterations -> 1000]
$\endgroup$
4
  • $\begingroup$ Remove MaxIterations option and your will get the desired point $\endgroup$
    – Acus
    May 12 at 8:36
  • $\begingroup$ @Acus I removed $MaxIterations$ and obtained a result of 5.64137*10^-9. However, from the graph, it can be seen that the value of the green circle is approximately 5.3*10^-6, and the difference is still significant. $\endgroup$
    – chen chen
    May 12 at 8:50
  • $\begingroup$ It might be a precision issue, since you use very small numbers (10^(-117)) and do computation with machine arithmetic. $\endgroup$
    – Acus
    May 12 at 9:13
  • $\begingroup$ @Acus Sir, I tried using higher accuracy, but it didn't achieve the desired effect. $\endgroup$
    – chen chen
    May 12 at 11:09

1 Answer 1

4
$\begingroup$

We modified the condition. 10^-10 <= dt <= 0.0001.

sol = NMinimize[{dt, condequal, 0 <= t <= 2/25, 
   10^-10 <= dt <= 0.0001}, {t, dt}, Method -> "DifferentialEvolution"]
Show[RegionPlot[condunequal, {t, 0, 2/25}, {dt, 0, 0.0001}, 
  FrameLabel -> {t, dt}], Graphics[{Red, Point[{t, dt}]}] /. sol[[2]],
  PlotRange -> All]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you very much! Using your method, the desired results were obtained. $\endgroup$
    – chen chen
    May 12 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.