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


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