ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_polynomial::setPolyDiff Interface Reference

Return the vector of coefficients of the polynomial resulting from the \(k\)th-order differentiation of a univariate polynomial of arbitrary degree. More...

Detailed Description

Return the vector of coefficients of the polynomial resulting from the \(k\)th-order differentiation of a univariate polynomial of arbitrary degree.

See the documentation of pm_polynomial for details of the implementation.

Parameters
[out]diff: The output contiguous vector of the same type and kind as the input coef, of size size(coef) - order, containing the coefficients (in the order of increasing power) of the resulting polynomial from the \(k\)th-order differentiation of the input polynomial with coefficients coef of arbitrary degree.
By definition, the degree of the diff polynomial is size(diff) - order.
[in]coef: The input contiguous vector of non-zero size of,
  • type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
  • type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the coefficients (in the order of increasing power) of the univariate polynomial whose \(k\)th-order derivative must be returned.
By definition, the degree of the coef polynomial is size(coef) - 1.
This means that the condition coef(size(coef)) /= 0. is expected to hold (although not enforced).
[in]order: The input scalar nonnegative integer of default kind IK containing the order of the derivative to compute.
(optional, default = 1)


Possible calling interfaces

call setPolyDiff(diff(1 : size(coef) - 1), coef(:))
call setPolyDiff(diff(1 : size(coef) - order), coef(:), order)
Return the vector of coefficients of the polynomial resulting from the th-order differentiation of a ...
This module contains procedures and generic interfaces for performing various mathematical operations...
Warning
The condition 0 <= order must hold for the corresponding input arguments.
The condition size(diff) == max(1, size(coef) - order) must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getPolyDiff
setPolyDiff


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_io, only: display_type
5 use pm_distUnif, only: getUnifRand
9
10 implicit none
11
12 integer(IK) :: order
13 integer(IK) :: degree
14 type(display_type) :: disp
15 integer(IK) :: itry, ntry = 20
16 disp = display_type(file = "main.out.F90")
17
18 block
19 use pm_kind, only: TKG => RKS ! all processor real and complex kinds are supported.
20 real(TKG), allocatable :: coef(:), diff(:)
21 do itry = 1, ntry
22 call disp%show("degree = getUnifRand(0, 9_IK)")
23 degree = getUnifRand(0, 9_IK)
24 call disp%show("degree")
25 call disp%show( degree )
26 call disp%show("coef = getUnifRand(-9, 9, degree)")
27 coef = getUnifRand(-9, 9, degree)
28 call disp%show("coef")
29 call disp%show( coef )
30 call disp%show("getPolyStr(coef)")
31 call disp%show( getPolyStr(coef) )
32 call disp%show("order = getUnifRand(0, size(coef) + 1)")
33 order = getUnifRand(0, size(coef) + 1)
34 call disp%show("order")
35 call disp%show( order )
36 call disp%skip()
37 call disp%show("call setResized(diff, max(0_IK, size(coef, 1, IK) - order))")
38 call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
39 call disp%show("call setPolyDiff(diff, coef, order)")
40 call setPolyDiff(diff, coef, order)
41 call disp%show("diff ! derivative coefficients.")
42 call disp%show( diff )
43 call disp%show("getPolyStr(diff)")
44 call disp%show( getPolyStr(diff) )
45 call disp%skip()
46 end do
47 end block
48
49 block
50 use pm_kind, only: TKG => RKS ! all processor real and complex kinds are supported.
51 complex(TKG), allocatable :: coef(:), diff(:)
52 do itry = 1, ntry
53 call disp%show("degree = getUnifRand(0, 9_IK)")
54 degree = getUnifRand(0, 9_IK)
55 call disp%show("degree")
56 call disp%show( degree )
57 call disp%show("coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)")
58 coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
59 call disp%show("coef")
60 call disp%show( coef )
61 call disp%show("getPolyStr(coef)")
62 call disp%show( getPolyStr(coef) )
63 call disp%show("order = getUnifRand(0, size(coef) + 1)")
64 order = getUnifRand(0, size(coef) + 1)
65 call disp%show("order")
66 call disp%show( order )
67 call disp%skip()
68 call disp%show("call setResized(diff, max(0_IK, size(coef, 1, IK) - order))")
69 call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
70 call disp%show("call setPolyDiff(diff, coef, order)")
71 call setPolyDiff(diff, coef, order)
72 call disp%show("diff ! derivative coefficients.")
73 call disp%show( diff )
74 call disp%show("getPolyStr(diff)")
75 call disp%show( getPolyStr(diff) )
76 call disp%skip()
77 end do
78 end block
79
80end program example
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return a string containing the polynomial expression corresponding to the input polynomi...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1degree = getUnifRand(0, 9_IK)
2degree
3+7
4coef = getUnifRand(-9, 9, degree)
5coef
6+3.00000000, +2.00000000, -9.00000000, +3.00000000, +1.00000000, +9.00000000, -3.00000000
7getPolyStr(coef)
83.x^0 + 2.x^1 - 9.x^2 + 3.x^3 + 1.x^4 + 9.x^5 - 3.x^6
9order = getUnifRand(0, size(coef) + 1)
10order
11+8
12
13call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
14call setPolyDiff(diff, coef, order)
15diff ! derivative coefficients.
16
17getPolyStr(diff)
18
19
20degree = getUnifRand(0, 9_IK)
21degree
22+7
23coef = getUnifRand(-9, 9, degree)
24coef
25-9.00000000, -5.00000000, +8.00000000, -6.00000000, -5.00000000, -8.00000000, -2.00000000
26getPolyStr(coef)
27-9.x^0 - 5.x^1 + 8.x^2 - 6.x^3 - 5.x^4 - 8.x^5 - 2.x^6
28order = getUnifRand(0, size(coef) + 1)
29order
30+7
31
32call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
33call setPolyDiff(diff, coef, order)
34diff ! derivative coefficients.
35
36getPolyStr(diff)
37
38
39degree = getUnifRand(0, 9_IK)
40degree
41+2
42coef = getUnifRand(-9, 9, degree)
43coef
44+9.00000000, +6.00000000
45getPolyStr(coef)
469.x^0 + 6.x^1
47order = getUnifRand(0, size(coef) + 1)
48order
49+3
50
51call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
52call setPolyDiff(diff, coef, order)
53diff ! derivative coefficients.
54
55getPolyStr(diff)
56
57
58degree = getUnifRand(0, 9_IK)
59degree
60+9
61coef = getUnifRand(-9, 9, degree)
62coef
63-9.00000000, -5.00000000, +1.00000000, +8.00000000, -6.00000000, -1.00000000, +7.00000000, -2.00000000, +5.00000000
64getPolyStr(coef)
65-9.x^0 - 5.x^1 + 1.x^2 + 8.x^3 - 6.x^4 - 1.x^5 + 7.x^6 - 2.x^7 + 5.x^8
66order = getUnifRand(0, size(coef) + 1)
67order
68+2
69
70call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
71call setPolyDiff(diff, coef, order)
72diff ! derivative coefficients.
73+2.00000000, +24.0000000, -24.0000000, -5.00000000, +42.0000000, -14.0000000, +40.0000000
74getPolyStr(diff)
752.x^0 + 24.x^1 - 24.x^2 - 5.x^3 + 42.x^4 - 14.x^5 + 40.x^6
76
77degree = getUnifRand(0, 9_IK)
78degree
79+4
80coef = getUnifRand(-9, 9, degree)
81coef
82-1.00000000, +2.00000000, +1.00000000, +7.00000000
83getPolyStr(coef)
84-1.x^0 + 2.x^1 + 1.x^2 + 7.x^3
85order = getUnifRand(0, size(coef) + 1)
86order
87+3
88
89call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
90call setPolyDiff(diff, coef, order)
91diff ! derivative coefficients.
92+21.0000000
93getPolyStr(diff)
9421.x^0
95
96degree = getUnifRand(0, 9_IK)
97degree
98+2
99coef = getUnifRand(-9, 9, degree)
100coef
101-8.00000000, +6.00000000
102getPolyStr(coef)
103-8.x^0 + 6.x^1
104order = getUnifRand(0, size(coef) + 1)
105order
106+3
107
108call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
109call setPolyDiff(diff, coef, order)
110diff ! derivative coefficients.
111
112getPolyStr(diff)
113
114
115degree = getUnifRand(0, 9_IK)
116degree
117+0
118coef = getUnifRand(-9, 9, degree)
119coef
120
121getPolyStr(coef)
122
123order = getUnifRand(0, size(coef) + 1)
124order
125+1
126
127call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
128call setPolyDiff(diff, coef, order)
129diff ! derivative coefficients.
130
131getPolyStr(diff)
132
133
134degree = getUnifRand(0, 9_IK)
135degree
136+0
137coef = getUnifRand(-9, 9, degree)
138coef
139
140getPolyStr(coef)
141
142order = getUnifRand(0, size(coef) + 1)
143order
144+1
145
146call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
147call setPolyDiff(diff, coef, order)
148diff ! derivative coefficients.
149
150getPolyStr(diff)
151
152
153degree = getUnifRand(0, 9_IK)
154degree
155+0
156coef = getUnifRand(-9, 9, degree)
157coef
158
159getPolyStr(coef)
160
161order = getUnifRand(0, size(coef) + 1)
162order
163+1
164
165call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
166call setPolyDiff(diff, coef, order)
167diff ! derivative coefficients.
168
169getPolyStr(diff)
170
171
172degree = getUnifRand(0, 9_IK)
173degree
174+3
175coef = getUnifRand(-9, 9, degree)
176coef
177-2.00000000, +0.00000000, +7.00000000
178getPolyStr(coef)
179-2.x^0 + 0.x^1 + 7.x^2
180order = getUnifRand(0, size(coef) + 1)
181order
182+0
183
184call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
185call setPolyDiff(diff, coef, order)
186diff ! derivative coefficients.
187-2.00000000, +0.00000000, +7.00000000
188getPolyStr(diff)
189-2.x^0 + 0.x^1 + 7.x^2
190
191degree = getUnifRand(0, 9_IK)
192degree
193+4
194coef = getUnifRand(-9, 9, degree)
195coef
196+1.00000000, -3.00000000, -1.00000000, -5.00000000
197getPolyStr(coef)
1981.x^0 - 3.x^1 - 1.x^2 - 5.x^3
199order = getUnifRand(0, size(coef) + 1)
200order
201+2
202
203call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
204call setPolyDiff(diff, coef, order)
205diff ! derivative coefficients.
206-2.00000000, -15.0000000
207getPolyStr(diff)
208-2.x^0 - 15.x^1
209
210degree = getUnifRand(0, 9_IK)
211degree
212+5
213coef = getUnifRand(-9, 9, degree)
214coef
215+1.00000000, +5.00000000, -4.00000000, +9.00000000, -3.00000000
216getPolyStr(coef)
2171.x^0 + 5.x^1 - 4.x^2 + 9.x^3 - 3.x^4
218order = getUnifRand(0, size(coef) + 1)
219order
220+0
221
222call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
223call setPolyDiff(diff, coef, order)
224diff ! derivative coefficients.
225+1.00000000, +5.00000000, -4.00000000, +9.00000000, -3.00000000
226getPolyStr(diff)
2271.x^0 + 5.x^1 - 4.x^2 + 9.x^3 - 3.x^4
228
229degree = getUnifRand(0, 9_IK)
230degree
231+8
232coef = getUnifRand(-9, 9, degree)
233coef
234-8.00000000, +6.00000000, -3.00000000, +2.00000000, +7.00000000, +4.00000000, +7.00000000, +3.00000000
235getPolyStr(coef)
236-8.x^0 + 6.x^1 - 3.x^2 + 2.x^3 + 7.x^4 + 4.x^5 + 7.x^6 + 3.x^7
237order = getUnifRand(0, size(coef) + 1)
238order
239+7
240
241call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
242call setPolyDiff(diff, coef, order)
243diff ! derivative coefficients.
244+21.0000000
245getPolyStr(diff)
24621.x^0
247
248degree = getUnifRand(0, 9_IK)
249degree
250+6
251coef = getUnifRand(-9, 9, degree)
252coef
253-8.00000000, +8.00000000, -2.00000000, +8.00000000, +5.00000000, -4.00000000
254getPolyStr(coef)
255-8.x^0 + 8.x^1 - 2.x^2 + 8.x^3 + 5.x^4 - 4.x^5
256order = getUnifRand(0, size(coef) + 1)
257order
258+2
259
260call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
261call setPolyDiff(diff, coef, order)
262diff ! derivative coefficients.
263-4.00000000, +24.0000000, +20.0000000, -20.0000000
264getPolyStr(diff)
265-4.x^0 + 24.x^1 + 20.x^2 - 20.x^3
266
267degree = getUnifRand(0, 9_IK)
268degree
269+6
270coef = getUnifRand(-9, 9, degree)
271coef
272+6.00000000, -6.00000000, -2.00000000, +9.00000000, +1.00000000, +1.00000000
273getPolyStr(coef)
2746.x^0 - 6.x^1 - 2.x^2 + 9.x^3 + 1.x^4 + 1.x^5
275order = getUnifRand(0, size(coef) + 1)
276order
277+6
278
279call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
280call setPolyDiff(diff, coef, order)
281diff ! derivative coefficients.
282
283getPolyStr(diff)
284
285
286degree = getUnifRand(0, 9_IK)
287degree
288+0
289coef = getUnifRand(-9, 9, degree)
290coef
291
292getPolyStr(coef)
293
294order = getUnifRand(0, size(coef) + 1)
295order
296+0
297
298call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
299call setPolyDiff(diff, coef, order)
300diff ! derivative coefficients.
301
302getPolyStr(diff)
303
304
305degree = getUnifRand(0, 9_IK)
306degree
307+8
308coef = getUnifRand(-9, 9, degree)
309coef
310+3.00000000, +6.00000000, +8.00000000, +6.00000000, -1.00000000, +2.00000000, -4.00000000, -6.00000000
311getPolyStr(coef)
3123.x^0 + 6.x^1 + 8.x^2 + 6.x^3 - 1.x^4 + 2.x^5 - 4.x^6 - 6.x^7
313order = getUnifRand(0, size(coef) + 1)
314order
315+2
316
317call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
318call setPolyDiff(diff, coef, order)
319diff ! derivative coefficients.
320+16.0000000, +18.0000000, -4.00000000, +10.0000000, -24.0000000, -42.0000000
321getPolyStr(diff)
32216.x^0 + 18.x^1 - 4.x^2 + 10.x^3 - 24.x^4 - 42.x^5
323
324degree = getUnifRand(0, 9_IK)
325degree
326+9
327coef = getUnifRand(-9, 9, degree)
328coef
329+4.00000000, -9.00000000, +7.00000000, +7.00000000, -7.00000000, +2.00000000, -5.00000000, -8.00000000, +1.00000000
330getPolyStr(coef)
3314.x^0 - 9.x^1 + 7.x^2 + 7.x^3 - 7.x^4 + 2.x^5 - 5.x^6 - 8.x^7 + 1.x^8
332order = getUnifRand(0, size(coef) + 1)
333order
334+3
335
336call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
337call setPolyDiff(diff, coef, order)
338diff ! derivative coefficients.
339+21.0000000, -28.0000000, +10.0000000, -30.0000000, -56.0000000, +8.00000000
340getPolyStr(diff)
34121.x^0 - 28.x^1 + 10.x^2 - 30.x^3 - 56.x^4 + 8.x^5
342
343degree = getUnifRand(0, 9_IK)
344degree
345+5
346coef = getUnifRand(-9, 9, degree)
347coef
348+7.00000000, +9.00000000, +2.00000000, +5.00000000, +0.00000000
349getPolyStr(coef)
3507.x^0 + 9.x^1 + 2.x^2 + 5.x^3 + 0.x^4
351order = getUnifRand(0, size(coef) + 1)
352order
353+1
354
355call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
356call setPolyDiff(diff, coef, order)
357diff ! derivative coefficients.
358+9.00000000, +4.00000000, +15.0000000, +0.00000000
359getPolyStr(diff)
3609.x^0 + 4.x^1 + 15.x^2 + 0.x^3
361
362degree = getUnifRand(0, 9_IK)
363degree
364+4
365coef = getUnifRand(-9, 9, degree)
366coef
367-8.00000000, -5.00000000, +6.00000000, +5.00000000
368getPolyStr(coef)
369-8.x^0 - 5.x^1 + 6.x^2 + 5.x^3
370order = getUnifRand(0, size(coef) + 1)
371order
372+2
373
374call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
375call setPolyDiff(diff, coef, order)
376diff ! derivative coefficients.
377+12.0000000, +15.0000000
378getPolyStr(diff)
37912.x^0 + 15.x^1
380
381degree = getUnifRand(0, 9_IK)
382degree
383+5
384coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
385coef
386(+1.00000000, -3.00000000), (-3.00000000, -7.00000000), (+2.00000000, +5.00000000), (+3.00000000, +6.00000000), (+5.00000000, +8.00000000)
387getPolyStr(coef)
388(1.,-3.)x^0 + (-3.,-7.)x^1 + (2.,5.)x^2 + (3.,6.)x^3 + (5.,8.)x^4
389order = getUnifRand(0, size(coef) + 1)
390order
391+2
392
393call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
394call setPolyDiff(diff, coef, order)
395diff ! derivative coefficients.
396(+4.00000000, +10.0000000), (+9.00000000, +18.0000000), (+20.0000000, +32.0000000)
397getPolyStr(diff)
398(4.,10.)x^0 + (9.,18.)x^1 + (20.,32.)x^2
399
400degree = getUnifRand(0, 9_IK)
401degree
402+2
403coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
404coef
405(+4.00000000, -5.00000000), (-5.00000000, +4.00000000)
406getPolyStr(coef)
407(4.,-5.)x^0 + (-5.,4.)x^1
408order = getUnifRand(0, size(coef) + 1)
409order
410+2
411
412call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
413call setPolyDiff(diff, coef, order)
414diff ! derivative coefficients.
415
416getPolyStr(diff)
417
418
419degree = getUnifRand(0, 9_IK)
420degree
421+4
422coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
423coef
424(+9.00000000, +9.00000000), (-9.00000000, +5.00000000), (-4.00000000, -7.00000000), (+6.00000000, +1.00000000)
425getPolyStr(coef)
426(9.,9.)x^0 + (-9.,5.)x^1 + (-4.,-7.)x^2 + (6.,1.)x^3
427order = getUnifRand(0, size(coef) + 1)
428order
429+0
430
431call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
432call setPolyDiff(diff, coef, order)
433diff ! derivative coefficients.
434(+9.00000000, +9.00000000), (-9.00000000, +5.00000000), (-4.00000000, -7.00000000), (+6.00000000, +1.00000000)
435getPolyStr(diff)
436(9.,9.)x^0 + (-9.,5.)x^1 + (-4.,-7.)x^2 + (6.,1.)x^3
437
438degree = getUnifRand(0, 9_IK)
439degree
440+1
441coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
442coef
443(-1.00000000, +9.00000000)
444getPolyStr(coef)
445(-1.,9.)x^0
446order = getUnifRand(0, size(coef) + 1)
447order
448+1
449
450call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
451call setPolyDiff(diff, coef, order)
452diff ! derivative coefficients.
453
454getPolyStr(diff)
455
456
457degree = getUnifRand(0, 9_IK)
458degree
459+7
460coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
461coef
462(+5.00000000, -7.00000000), (+3.00000000, +0.00000000), (-2.00000000, +5.00000000), (-1.00000000, +2.00000000), (-7.00000000, +8.00000000), (-9.00000000, -9.00000000), (-8.00000000, -6.00000000)
463getPolyStr(coef)
464(5.,-7.)x^0 + (3.,0.)x^1 + (-2.,5.)x^2 + (-1.,2.)x^3 + (-7.,8.)x^4 + (-9.,-9.)x^5 + (-8.,-6.)x^6
465order = getUnifRand(0, size(coef) + 1)
466order
467+1
468
469call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
470call setPolyDiff(diff, coef, order)
471diff ! derivative coefficients.
472(+3.00000000, +0.00000000), (-4.00000000, +10.0000000), (-3.00000000, +6.00000000), (-28.0000000, +32.0000000), (-45.0000000, -45.0000000), (-48.0000000, -36.0000000)
473getPolyStr(diff)
474(3.,0.)x^0 + (-4.,10.)x^1 + (-3.,6.)x^2 + (-28.,32.)x^3 + (-45.,-45.)x^4 + (-48.,-36.)x^5
475
476degree = getUnifRand(0, 9_IK)
477degree
478+6
479coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
480coef
481(-9.00000000, +3.00000000), (-1.00000000, +3.00000000), (+4.00000000, -3.00000000), (+1.00000000, +6.00000000), (+3.00000000, +4.00000000), (+1.00000000, +9.00000000)
482getPolyStr(coef)
483(-9.,3.)x^0 + (-1.,3.)x^1 + (4.,-3.)x^2 + (1.,6.)x^3 + (3.,4.)x^4 + (1.,9.)x^5
484order = getUnifRand(0, size(coef) + 1)
485order
486+7
487
488call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
489call setPolyDiff(diff, coef, order)
490diff ! derivative coefficients.
491
492getPolyStr(diff)
493
494
495degree = getUnifRand(0, 9_IK)
496degree
497+5
498coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
499coef
500(+0.00000000, -8.00000000), (-9.00000000, -7.00000000), (+5.00000000, -7.00000000), (+7.00000000, -1.00000000), (+8.00000000, +3.00000000)
501getPolyStr(coef)
502(0.,-8.)x^0 + (-9.,-7.)x^1 + (5.,-7.)x^2 + (7.,-1.)x^3 + (8.,3.)x^4
503order = getUnifRand(0, size(coef) + 1)
504order
505+2
506
507call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
508call setPolyDiff(diff, coef, order)
509diff ! derivative coefficients.
510(+10.0000000, -14.0000000), (+21.0000000, -3.00000000), (+32.0000000, +12.0000000)
511getPolyStr(diff)
512(10.,-14.)x^0 + (21.,-3.)x^1 + (32.,12.)x^2
513
514degree = getUnifRand(0, 9_IK)
515degree
516+5
517coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
518coef
519(-8.00000000, -2.00000000), (+0.00000000, +5.00000000), (+4.00000000, +6.00000000), (-9.00000000, -5.00000000), (+3.00000000, -5.00000000)
520getPolyStr(coef)
521(-8.,-2.)x^0 + (0.,5.)x^1 + (4.,6.)x^2 + (-9.,-5.)x^3 + (3.,-5.)x^4
522order = getUnifRand(0, size(coef) + 1)
523order
524+5
525
526call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
527call setPolyDiff(diff, coef, order)
528diff ! derivative coefficients.
529
530getPolyStr(diff)
531
532
533degree = getUnifRand(0, 9_IK)
534degree
535+0
536coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
537coef
538
539getPolyStr(coef)
540
541order = getUnifRand(0, size(coef) + 1)
542order
543+1
544
545call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
546call setPolyDiff(diff, coef, order)
547diff ! derivative coefficients.
548
549getPolyStr(diff)
550
551
552degree = getUnifRand(0, 9_IK)
553degree
554+3
555coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
556coef
557(-5.00000000, -4.00000000), (-1.00000000, -1.00000000), (+8.00000000, +6.00000000)
558getPolyStr(coef)
559(-5.,-4.)x^0 + (-1.,-1.)x^1 + (8.,6.)x^2
560order = getUnifRand(0, size(coef) + 1)
561order
562+1
563
564call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
565call setPolyDiff(diff, coef, order)
566diff ! derivative coefficients.
567(-1.00000000, -1.00000000), (+16.0000000, +12.0000000)
568getPolyStr(diff)
569(-1.,-1.)x^0 + (16.,12.)x^1
570
571degree = getUnifRand(0, 9_IK)
572degree
573+7
574coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
575coef
576(-1.00000000, -5.00000000), (-2.00000000, +4.00000000), (-5.00000000, -8.00000000), (+7.00000000, -5.00000000), (-3.00000000, +5.00000000), (-3.00000000, +4.00000000), (+2.00000000, -3.00000000)
577getPolyStr(coef)
578(-1.,-5.)x^0 + (-2.,4.)x^1 + (-5.,-8.)x^2 + (7.,-5.)x^3 + (-3.,5.)x^4 + (-3.,4.)x^5 + (2.,-3.)x^6
579order = getUnifRand(0, size(coef) + 1)
580order
581+7
582
583call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
584call setPolyDiff(diff, coef, order)
585diff ! derivative coefficients.
586
587getPolyStr(diff)
588
589
590degree = getUnifRand(0, 9_IK)
591degree
592+4
593coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
594coef
595(-6.00000000, -1.00000000), (-9.00000000, +6.00000000), (-3.00000000, +8.00000000), (+5.00000000, -1.00000000)
596getPolyStr(coef)
597(-6.,-1.)x^0 + (-9.,6.)x^1 + (-3.,8.)x^2 + (5.,-1.)x^3
598order = getUnifRand(0, size(coef) + 1)
599order
600+5
601
602call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
603call setPolyDiff(diff, coef, order)
604diff ! derivative coefficients.
605
606getPolyStr(diff)
607
608
609degree = getUnifRand(0, 9_IK)
610degree
611+2
612coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
613coef
614(+7.00000000, -7.00000000), (+7.00000000, -8.00000000)
615getPolyStr(coef)
616(7.,-7.)x^0 + (7.,-8.)x^1
617order = getUnifRand(0, size(coef) + 1)
618order
619+3
620
621call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
622call setPolyDiff(diff, coef, order)
623diff ! derivative coefficients.
624
625getPolyStr(diff)
626
627
628degree = getUnifRand(0, 9_IK)
629degree
630+9
631coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
632coef
633(-5.00000000, -5.00000000), (-4.00000000, +7.00000000), (+7.00000000, -1.00000000), (-1.00000000, -4.00000000), (+2.00000000, +9.00000000), (-9.00000000, +1.00000000), (+9.00000000, +4.00000000), (+9.00000000, -7.00000000), (+0.00000000, -7.00000000)
634getPolyStr(coef)
635(-5.,-5.)x^0 + (-4.,7.)x^1 + (7.,-1.)x^2 + (-1.,-4.)x^3 + (2.,9.)x^4 + (-9.,1.)x^5 + (9.,4.)x^6 + (9.,-7.)x^7 + (0.,-7.)x^8
636order = getUnifRand(0, size(coef) + 1)
637order
638+10
639
640call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
641call setPolyDiff(diff, coef, order)
642diff ! derivative coefficients.
643
644getPolyStr(diff)
645
646
647degree = getUnifRand(0, 9_IK)
648degree
649+2
650coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
651coef
652(-9.00000000, +1.00000000), (-8.00000000, -7.00000000)
653getPolyStr(coef)
654(-9.,1.)x^0 + (-8.,-7.)x^1
655order = getUnifRand(0, size(coef) + 1)
656order
657+0
658
659call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
660call setPolyDiff(diff, coef, order)
661diff ! derivative coefficients.
662(-9.00000000, +1.00000000), (-8.00000000, -7.00000000)
663getPolyStr(diff)
664(-9.,1.)x^0 + (-8.,-7.)x^1
665
666degree = getUnifRand(0, 9_IK)
667degree
668+8
669coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
670coef
671(+5.00000000, -7.00000000), (+9.00000000, +1.00000000), (+9.00000000, +8.00000000), (-9.00000000, +9.00000000), (+6.00000000, -1.00000000), (-2.00000000, -1.00000000), (-6.00000000, -9.00000000), (+7.00000000, +3.00000000)
672getPolyStr(coef)
673(5.,-7.)x^0 + (9.,1.)x^1 + (9.,8.)x^2 + (-9.,9.)x^3 + (6.,-1.)x^4 + (-2.,-1.)x^5 + (-6.,-9.)x^6 + (7.,3.)x^7
674order = getUnifRand(0, size(coef) + 1)
675order
676+5
677
678call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
679call setPolyDiff(diff, coef, order)
680diff ! derivative coefficients.
681(-10.0000000, -5.00000000), (-36.0000000, -54.0000000), (+49.0000000, +21.0000000)
682getPolyStr(diff)
683(-10.,-5.)x^0 + (-36.,-54.)x^1 + (49.,21.)x^2
684
685degree = getUnifRand(0, 9_IK)
686degree
687+5
688coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
689coef
690(+7.00000000, +1.00000000), (-1.00000000, +1.00000000), (-8.00000000, +5.00000000), (+3.00000000, +0.00000000), (+6.00000000, +7.00000000)
691getPolyStr(coef)
692(7.,1.)x^0 + (-1.,1.)x^1 + (-8.,5.)x^2 + (3.,0.)x^3 + (6.,7.)x^4
693order = getUnifRand(0, size(coef) + 1)
694order
695+0
696
697call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
698call setPolyDiff(diff, coef, order)
699diff ! derivative coefficients.
700(+7.00000000, +1.00000000), (-1.00000000, +1.00000000), (-8.00000000, +5.00000000), (+3.00000000, +0.00000000), (+6.00000000, +7.00000000)
701getPolyStr(diff)
702(7.,1.)x^0 + (-1.,1.)x^1 + (-8.,5.)x^2 + (3.,0.)x^3 + (6.,7.)x^4
703
704degree = getUnifRand(0, 9_IK)
705degree
706+1
707coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
708coef
709(-3.00000000, +5.00000000)
710getPolyStr(coef)
711(-3.,5.)x^0
712order = getUnifRand(0, size(coef) + 1)
713order
714+0
715
716call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
717call setPolyDiff(diff, coef, order)
718diff ! derivative coefficients.
719(-3.00000000, +5.00000000)
720getPolyStr(diff)
721(-3.,5.)x^0
722
723degree = getUnifRand(0, 9_IK)
724degree
725+4
726coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
727coef
728(+1.00000000, +9.00000000), (-4.00000000, +9.00000000), (+2.00000000, +5.00000000), (+9.00000000, +1.00000000)
729getPolyStr(coef)
730(1.,9.)x^0 + (-4.,9.)x^1 + (2.,5.)x^2 + (9.,1.)x^3
731order = getUnifRand(0, size(coef) + 1)
732order
733+0
734
735call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
736call setPolyDiff(diff, coef, order)
737diff ! derivative coefficients.
738(+1.00000000, +9.00000000), (-4.00000000, +9.00000000), (+2.00000000, +5.00000000), (+9.00000000, +1.00000000)
739getPolyStr(diff)
740(1.,9.)x^0 + (-4.,9.)x^1 + (2.,5.)x^2 + (9.,1.)x^3
741
742degree = getUnifRand(0, 9_IK)
743degree
744+5
745coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
746coef
747(-9.00000000, -3.00000000), (-5.00000000, -1.00000000), (-3.00000000, -8.00000000), (+7.00000000, +9.00000000), (+4.00000000, -3.00000000)
748getPolyStr(coef)
749(-9.,-3.)x^0 + (-5.,-1.)x^1 + (-3.,-8.)x^2 + (7.,9.)x^3 + (4.,-3.)x^4
750order = getUnifRand(0, size(coef) + 1)
751order
752+5
753
754call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
755call setPolyDiff(diff, coef, order)
756diff ! derivative coefficients.
757
758getPolyStr(diff)
759
760
761
Test:
test_pm_polynomial


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, Tuesday 11:34 PM, August 10, 2021, Dallas, TX

Definition at line 2731 of file pm_polynomial.F90.


The documentation for this interface was generated from the following file: