At x = -6, f(f(f(x))) = 899, the minimum.
clearvars,clc
step=1;
start=-10;fin=10;
xpprev=start-2*step; pprev=f(f(f(xpprev)));
xprev=start-step; prev=f(f(f(xprev)));
while true
for x=start:step:fin
v=f(f(f(x)));
if prev<pprev && v> prev
start=x-step*2; fin=x;
step=(fin-start)/10;
end
fprintf('%13.10f %13.10f \n',x,v)
pprev=prev; xpprev=x-2*step;
prev=v;xprev=x-step;
end
end
% for x=-100:.1:100
% fprintf('%13.10f %13.10f \n',x,f(f(f(x))))
% end
function vl=f(x)
vl=x^2+12*x+35;
end
-10.0000000000 198915.0000000000
-9.0000000000 40400.0000000000
-8.0000000000 7395.0000000000
-7.0000000000 1680.0000000000
-6.0000000000 899.0000000000
-5.0000000000 1680.0000000000
-4.0000000000 7395.0000000000
-3.0000000000 40400.0000000000
-2.0000000000 198915.0000000000
-1.0000000000 819024.0000000000
0.0000000000 2842595.0000000000
1.0000000000 8532240.0000000000
2.0000000000 22714755.0000000000
3.0000000000 54774800.0000000000
4.0000000000 121660899.0000000000
5.0000000000 252206160.0000000000
6.0000000000 493106435.0000000000
7.0000000000 916938960.0000000000
8.0000000000 1632644835.0000000000
9.0000000000 2798939024.0000000000
10.0000000000 4641151875.0000000000
-7.0000000000 1680.0000000000
-6.8000000000 1353.9466521600
-6.6000000000 1136.6859161600
-6.4000000000 999.1785753600
-6.2000000000 923.2572825600
-6.0000000000 899.0000000000
-5.8000000000 923.2572825600
-5.6000000000 999.1785753600
-5.4000000000 1136.6859161600
-5.2000000000 1353.9466521600
-5.0000000000 1680.0000000000
-6.2000000000 923.2572825600
-6.1600000000 914.4651935738
-6.1200000000 907.6732373627
-6.0800000000 902.8465588446
-6.0400000000 899.9604096819
-6.0000000000 899.0000000000
-5.9600000000 899.9604096819
-5.9200000000 902.8465588446
-5.8800000000 907.6732373627
-5.8400000000 914.4651935738
-5.8000000000 923.2572825600
-6.0400000000 899.9604096819
-6.0320000000 899.6145677936
-6.0240000000 899.3456530880
-6.0160000000 899.1536104861
-6.0080000000 899.0384006554
-6.0000000000 899.0000000000
-5.9920000000 899.0384006554
-5.9840000000 899.1536104861
-5.9760000000 899.3456530880
-5.9680000000 899.6145677936
-5.9600000000 899.9604096819
-6.0080000000 899.0384006554
-6.0064000000 899.0245762684
-6.0048000000 899.0138240849
-6.0032000000 899.0061440168
-6.0016000000 899.0015360010
-6.0000000000 899.0000000000
-5.9984000000 899.0015360010
-5.9968000000 899.0061440168
-5.9952000000 899.0138240849
-5.9936000000 899.0245762684
-5.9920000000 899.0384006554
-6.0016000000 899.0015360010
-6.0012800000 899.0009830404
-6.0009600000 899.0005529601
-6.0006400000 899.0002457600
-6.0003200000 899.0000614400
-6.0000000000 899.0000000000
-5.9996800000 899.0000614400
-5.9993600000 899.0002457600
-5.9990400000 899.0005529601
-5.9987200000 899.0009830404
-5.9984000000 899.0015360010
-6.0003200000 899.0000614400
-6.0002560000 899.0000393216
-6.0001920000 899.0000221184
-6.0001280000 899.0000098304
-6.0000640000 899.0000024576
-6.0000000000 899.0000000000
-5.9999360000 899.0000024576
-5.9998720000 899.0000098304
-5.9998080000 899.0000221184
-5.9997440000 899.0000393216
-5.9996800000 899.0000614400
-6.0000640000 899.0000024576
-6.0000512000 899.0000015729
-6.0000384000 899.0000008847
-6.0000256000 899.0000003932
-6.0000128000 899.0000000983
-6.0000000000 899.0000000000
-5.9999872000 899.0000000983
-5.9999744000 899.0000003932
-5.9999616000 899.0000008847
-5.9999488000 899.0000015729
-5.9999360000 899.0000024576
-6.0000128000 899.0000000983
-6.0000102400 899.0000000629
-6.0000076800 899.0000000354
-6.0000051200 899.0000000157
-6.0000025600 899.0000000039
-6.0000000000 899.0000000000
-5.9999974400 899.0000000039
-5.9999948800 899.0000000157
-5.9999923200 899.0000000354
-5.9999897600 899.0000000629
-5.9999872000 899.0000000983
-6.0000025600 899.0000000039
-6.0000020480 899.0000000025
-6.0000015360 899.0000000014
-6.0000010240 899.0000000006
-6.0000005120 899.0000000002
-6.0000000000 899.0000000000
-5.9999994880 899.0000000002
-5.9999989760 899.0000000006
-5.9999984640 899.0000000014
-5.9999979520 899.0000000025
-5.9999974400 899.0000000039
-6.0000005120 899.0000000002
-6.0000004096 899.0000000001
-6.0000003072 899.0000000001
-6.0000002048 899.0000000000
-6.0000001024 899.0000000000
-6.0000000000 899.0000000000
-5.9999998976 899.0000000000
-5.9999997952 899.0000000000
-5.9999996928 899.0000000001
-5.9999995904 899.0000000001
-5.9999994880 899.0000000002
-6.0000001024 899.0000000000
-6.0000000819 899.0000000000
-6.0000000614 899.0000000000
-6.0000000410 899.0000000000
-6.0000000205 899.0000000000
-6.0000000000 899.0000000000
also
clearvars,clc
for x=-1000:1000
y=f(f(f(vpa(x))));
if y<900
disp([x y])
end
end
gives
[-6, 899.0]
|
Posted by Charlie
on 2025-04-11 14:35:47 |