5 use pm_mathRoot,
only:
getRoot,
false,
bisection,
secant,
brent,
ridders,
toms748,
newton,
halley,
schroder
12 type(display_type) :: disp
16 call disp%show(
"root = getRoot(getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
17 root
= getRoot(getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
18 call disp%show(
"[root, getSin(root)]")
19 call disp%show( [root, getSin(root)] )
23 call disp%show(
"root = getRoot(false, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
24 root
= getRoot(
false, getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
25 call disp%show(
"[root, getSin(root)]")
26 call disp%show( [root, getSin(root)] )
30 call disp%show(
"root = getRoot(bisection, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
32 call disp%show(
"[root, getSin(root)]")
33 call disp%show( [root, getSin(root)] )
37 call disp%show(
"root = getRoot(secant, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
38 root
= getRoot(
secant, getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
39 call disp%show(
"[root, getSin(root)]")
40 call disp%show( [root, getSin(root)] )
44 call disp%show(
"root = getRoot(brent, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
45 root
= getRoot(
brent, getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
46 call disp%show(
"[root, getSin(root)]")
47 call disp%show( [root, getSin(root)] )
51 call disp%show(
"root = getRoot(ridders, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
52 root
= getRoot(
ridders, getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
53 call disp%show(
"[root, getSin(root)]")
54 call disp%show( [root, getSin(root)] )
58 call disp%show(
"root = getRoot(toms748, getSin, lb = 2._RKG, ub = 4._RKG, neval = neval)")
59 root
= getRoot(
toms748, getSin, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
60 call disp%show(
"[root, getSin(root)]")
61 call disp%show( [root, getSin(root)] )
65 call disp%show(
"root = getRoot(newton, getSinDiff, lb = 2._RKG, ub = 4._RKG, neval = neval)")
66 root
= getRoot(
newton, getSinDiff, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
67 call disp%show(
"[root, getSin(root)]")
68 call disp%show( [root, getSin(root)] )
72 call disp%show(
"root = getRoot(halley, getSinDiff, lb = 2._RKG, ub = 4._RKG, neval = neval)")
73 root
= getRoot(
halley, getSinDiff, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
74 call disp%show(
"[root, getSin(root)]")
75 call disp%show( [root, getSin(root)] )
79 call disp%show(
"root = getRoot(schroder, getSinDiff, lb = 2._RKG, ub = 4._RKG, neval = neval)")
80 root
= getRoot(
schroder, getSinDiff, lb
= 2._RKG, ub
= 4._RKG, neval
= neval)
81 call disp%show(
"[root, getSin(root)]")
82 call disp%show( [root, getSin(root)] )
90 call disp%show(
"root = getRoot(getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
91 root
= getRoot(getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
92 call disp%show(
"[root, getCos(root)]")
93 call disp%show( [root, getCos(root)] )
97 call disp%show(
"root = getRoot(false, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
98 root
= getRoot(
false, getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
99 call disp%show(
"[root, getCos(root)]")
100 call disp%show( [root, getCos(root)] )
104 call disp%show(
"root = getRoot(bisection, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
106 call disp%show(
"[root, getCos(root)]")
107 call disp%show( [root, getCos(root)] )
111 call disp%show(
"root = getRoot(secant, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
112 root
= getRoot(
secant, getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
113 call disp%show(
"[root, getCos(root)]")
114 call disp%show( [root, getCos(root)] )
118 call disp%show(
"root = getRoot(brent, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
119 root
= getRoot(
brent, getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
120 call disp%show(
"[root, getCos(root)]")
121 call disp%show( [root, getCos(root)] )
125 call disp%show(
"root = getRoot(ridders, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
126 root
= getRoot(
ridders, getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
127 call disp%show(
"[root, getCos(root)]")
128 call disp%show( [root, getCos(root)] )
132 call disp%show(
"root = getRoot(toms748, getCos, lb = 1._RKG, ub = 3._RKG, neval = neval)")
133 root
= getRoot(
toms748, getCos, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
134 call disp%show(
"[root, getCos(root)]")
135 call disp%show( [root, getCos(root)] )
139 call disp%show(
"root = getRoot(newton, getCosDiff, lb = 1._RKG, ub = 3._RKG, neval = neval)")
140 root
= getRoot(
newton, getCosDiff, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
141 call disp%show(
"[root, getCos(root)]")
142 call disp%show( [root, getCos(root)] )
146 call disp%show(
"root = getRoot(halley, getCosDiff, lb = 1._RKG, ub = 3._RKG, neval = neval)")
147 root
= getRoot(
halley, getCosDiff, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
148 call disp%show(
"[root, getCos(root)]")
149 call disp%show( [root, getCos(root)] )
153 call disp%show(
"root = getRoot(schroder, getCosDiff, lb = 1._RKG, ub = 3._RKG, neval = neval)")
154 root
= getRoot(
schroder, getCosDiff, lb
= 1._RKG, ub
= 3._RKG, neval
= neval)
155 call disp%show(
"[root, getCos(root)]")
156 call disp%show( [root, getCos(root)] )
164 call disp%show(
"root = getRoot(getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
165 root
= getRoot(getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
166 call disp%show(
"[root, getQuad(root)]")
167 call disp%show( [root, getQuad(root)] )
171 call disp%show(
"root = getRoot(false, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
172 root
= getRoot(
false, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
173 call disp%show(
"[root, getQuad(root)]")
174 call disp%show( [root, getQuad(root)] )
178 call disp%show(
"root = getRoot(bisection, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
179 root
= getRoot(
bisection, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
180 call disp%show(
"[root, getQuad(root)]")
181 call disp%show( [root, getQuad(root)] )
185 call disp%show(
"root = getRoot(secant, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
186 root
= getRoot(
secant, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
187 call disp%show(
"[root, getQuad(root)]")
188 call disp%show( [root, getQuad(root)] )
192 call disp%show(
"root = getRoot(brent, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
193 root
= getRoot(
brent, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
194 call disp%show(
"[root, getQuad(root)]")
195 call disp%show( [root, getQuad(root)] )
199 call disp%show(
"root = getRoot(ridders, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
200 root
= getRoot(
ridders, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
201 call disp%show(
"[root, getQuad(root)]")
202 call disp%show( [root, getQuad(root)] )
206 call disp%show(
"root = getRoot(toms748, getQuad, lb = -1._RKG, ub = 4._RKG, neval = neval)")
207 root
= getRoot(
toms748, getQuad, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
208 call disp%show(
"[root, getQuad(root)]")
209 call disp%show( [root, getQuad(root)] )
213 call disp%show(
"root = getRoot(newton, getQuadDiff, lb = -1._RKG, ub = 4._RKG, neval = neval)")
214 root
= getRoot(
newton, getQuadDiff, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
215 call disp%show(
"[root, getQuad(root)]")
216 call disp%show( [root, getQuad(root)] )
220 call disp%show(
"root = getRoot(halley, getQuadDiff, lb = -1._RKG, ub = 4._RKG, neval = neval)")
221 root
= getRoot(
halley, getQuadDiff, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
222 call disp%show(
"[root, getQuad(root)]")
223 call disp%show( [root, getQuad(root)] )
227 call disp%show(
"root = getRoot(schroder, getQuadDiff, lb = -1._RKG, ub = 4._RKG, neval = neval)")
228 root
= getRoot(
schroder, getQuadDiff, lb
= -1._RKG, ub
= 4._RKG, neval
= neval)
229 call disp%show(
"[root, getQuad(root)]")
230 call disp%show( [root, getQuad(root)] )
237 pure function getSin(x)
result(func)
238 real(RKG),
intent(in) :: x
243 pure function getCos(x)
result(func)
244 real(RKG),
intent(in) :: x
249 pure function getQuad(x)
result(func)
250 real(RKG),
intent(in) :: x
252 func
= x
* (x
- 1._RKG)
* (x
- 2._RKG)
255 pure function getSinDiff(x, order)
result(func)
256 integer(IK),
intent(in) :: order
257 real(RKG),
intent(in) :: x
259 if (order
== 0) func
= +getSin(x)
260 if (order
== 1) func
= +cos(x)
261 if (order
== 2) func
= -sin(x)
264 pure function getCosDiff(x, order)
result(func)
265 integer(IK),
intent(in) :: order
266 real(RKG),
intent(in) :: x
268 if (order
== 0) func
= +getCos(x)
269 if (order
== 1) func
= -sin(x)
270 if (order
== 2) func
= -cos(x)
273 pure function getQuadDiff(x, order)
result(func)
274 integer(IK),
intent(in) :: order
275 real(RKG),
intent(in) :: x
277 if (order
== 0) func
= getQuad(x)
278 if (order
== 1) func
= 3._RKG * x
**2 - 6._RKG * x
+ 2._RKG
279 if (order
== 2) func
= 6._RKG * x
- 6._RKG
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
type(brent_type), parameter brent
This is a scalar parameter object of type brent_type that is exclusively used to signify the use of B...
type(ridders_type), parameter ridders
This is a scalar parameter object of type ridders_type that is exclusively used to signify the use of...
type(toms748_type), parameter toms748
This is a scalar parameter object of type toms748_type that is exclusively used to signify the use of...
type(newton_type), parameter newton
This is a scalar parameter object of type newton_type that is exclusively used to signify the use of ...
type(bisection_type), parameter bisection
This is a scalar parameter object of type bisection_type that is exclusively used to signify the use ...
type(false_type), parameter false
This is a scalar parameter object of type false_type that is exclusively used to signify the use of F...
type(halley_type), parameter halley
This is a scalar parameter object of type halley_type that is exclusively used to signify the use of ...
type(schroder_type), parameter schroder
This is a scalar parameter object of type schroder_type that is exclusively used to signify the use o...
type(secant_type), parameter secant
This is a scalar parameter object of type secant_type that is exclusively used to signify the use of ...
Generate and return an object of type display_type.