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+4
4coef = getUnifRand(-9, 9, degree)
5coef
6-7.00000000, -5.00000000, +1.00000000, +3.00000000
7getPolyStr(coef)
8-7.x^0 - 5.x^1 + 1.x^2 + 3.x^3
9order = getUnifRand(0, size(coef) + 1)
10order
11+5
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+6
23coef = getUnifRand(-9, 9, degree)
24coef
25+9.00000000, -7.00000000, -1.00000000, -4.00000000, -5.00000000, +3.00000000
26getPolyStr(coef)
279.x^0 - 7.x^1 - 1.x^2 - 4.x^3 - 5.x^4 + 3.x^5
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-2.00000000, -12.0000000, -20.0000000, +15.0000000
36getPolyStr(diff)
37-2.x^0 - 12.x^1 - 20.x^2 + 15.x^3
38
39degree = getUnifRand(0, 9_IK)
40degree
41+4
42coef = getUnifRand(-9, 9, degree)
43coef
44-3.00000000, -4.00000000, +3.00000000, -7.00000000
45getPolyStr(coef)
46-3.x^0 - 4.x^1 + 3.x^2 - 7.x^3
47order = getUnifRand(0, size(coef) + 1)
48order
49+2
50
51call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
52call setPolyDiff(diff, coef, order)
53diff ! derivative coefficients.
54+6.00000000, -21.0000000
55getPolyStr(diff)
566.x^0 - 21.x^1
57
58degree = getUnifRand(0, 9_IK)
59degree
60+0
61coef = getUnifRand(-9, 9, degree)
62coef
63
64getPolyStr(coef)
65
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
74getPolyStr(diff)
75
76
77degree = getUnifRand(0, 9_IK)
78degree
79+0
80coef = getUnifRand(-9, 9, degree)
81coef
82
83getPolyStr(coef)
84
85order = getUnifRand(0, size(coef) + 1)
86order
87+1
88
89call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
90call setPolyDiff(diff, coef, order)
91diff ! derivative coefficients.
92
93getPolyStr(diff)
94
95
96degree = getUnifRand(0, 9_IK)
97degree
98+5
99coef = getUnifRand(-9, 9, degree)
100coef
101-6.00000000, -5.00000000, +2.00000000, +9.00000000, +2.00000000
102getPolyStr(coef)
103-6.x^0 - 5.x^1 + 2.x^2 + 9.x^3 + 2.x^4
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+4.00000000, +27.0000000, +8.00000000
112getPolyStr(diff)
1134.x^0 + 27.x^1 + 8.x^2
114
115degree = getUnifRand(0, 9_IK)
116degree
117+9
118coef = getUnifRand(-9, 9, degree)
119coef
120+0.00000000, +2.00000000, -8.00000000, +6.00000000, +5.00000000, +0.00000000, +0.00000000, +8.00000000, +1.00000000
121getPolyStr(coef)
1220.x^0 + 2.x^1 - 8.x^2 + 6.x^3 + 5.x^4 + 0.x^5 + 0.x^6 + 8.x^7 + 1.x^8
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+2.00000000, -16.0000000, +18.0000000, +20.0000000, +0.00000000, +0.00000000, +56.0000000, +8.00000000
131getPolyStr(diff)
1322.x^0 - 16.x^1 + 18.x^2 + 20.x^3 + 0.x^4 + 0.x^5 + 56.x^6 + 8.x^7
133
134degree = getUnifRand(0, 9_IK)
135degree
136+7
137coef = getUnifRand(-9, 9, degree)
138coef
139-2.00000000, -4.00000000, -9.00000000, -9.00000000, -1.00000000, -9.00000000, +0.00000000
140getPolyStr(coef)
141-2.x^0 - 4.x^1 - 9.x^2 - 9.x^3 - 1.x^4 - 9.x^5 + 0.x^6
142order = getUnifRand(0, size(coef) + 1)
143order
144+3
145
146call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
147call setPolyDiff(diff, coef, order)
148diff ! derivative coefficients.
149-27.0000000, -4.00000000, -45.0000000, +0.00000000
150getPolyStr(diff)
151-27.x^0 - 4.x^1 - 45.x^2 + 0.x^3
152
153degree = getUnifRand(0, 9_IK)
154degree
155+5
156coef = getUnifRand(-9, 9, degree)
157coef
158+1.00000000, -6.00000000, -6.00000000, -9.00000000, -1.00000000
159getPolyStr(coef)
1601.x^0 - 6.x^1 - 6.x^2 - 9.x^3 - 1.x^4
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-27.0000000, -4.00000000
169getPolyStr(diff)
170-27.x^0 - 4.x^1
171
172degree = getUnifRand(0, 9_IK)
173degree
174+3
175coef = getUnifRand(-9, 9, degree)
176coef
177-4.00000000, -4.00000000, -7.00000000
178getPolyStr(coef)
179-4.x^0 - 4.x^1 - 7.x^2
180order = getUnifRand(0, size(coef) + 1)
181order
182+2
183
184call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
185call setPolyDiff(diff, coef, order)
186diff ! derivative coefficients.
187-14.0000000
188getPolyStr(diff)
189-14.x^0
190
191degree = getUnifRand(0, 9_IK)
192degree
193+1
194coef = getUnifRand(-9, 9, degree)
195coef
196+5.00000000
197getPolyStr(coef)
1985.x^0
199order = getUnifRand(0, size(coef) + 1)
200order
201+1
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+8
213coef = getUnifRand(-9, 9, degree)
214coef
215-9.00000000, -2.00000000, +4.00000000, -1.00000000, +7.00000000, +9.00000000, +9.00000000, +9.00000000
216getPolyStr(coef)
217-9.x^0 - 2.x^1 + 4.x^2 - 1.x^3 + 7.x^4 + 9.x^5 + 9.x^6 + 9.x^7
218order = getUnifRand(0, size(coef) + 1)
219order
220+8
221
222call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
223call setPolyDiff(diff, coef, order)
224diff ! derivative coefficients.
225
226getPolyStr(diff)
227
228
229degree = getUnifRand(0, 9_IK)
230degree
231+3
232coef = getUnifRand(-9, 9, degree)
233coef
234+0.00000000, +1.00000000, -8.00000000
235getPolyStr(coef)
2360.x^0 + 1.x^1 - 8.x^2
237order = getUnifRand(0, size(coef) + 1)
238order
239+2
240
241call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
242call setPolyDiff(diff, coef, order)
243diff ! derivative coefficients.
244-16.0000000
245getPolyStr(diff)
246-16.x^0
247
248degree = getUnifRand(0, 9_IK)
249degree
250+8
251coef = getUnifRand(-9, 9, degree)
252coef
253-7.00000000, -7.00000000, -2.00000000, -7.00000000, -2.00000000, +4.00000000, -4.00000000, -3.00000000
254getPolyStr(coef)
255-7.x^0 - 7.x^1 - 2.x^2 - 7.x^3 - 2.x^4 + 4.x^5 - 4.x^6 - 3.x^7
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, -21.0000000, -8.00000000, +20.0000000, -24.0000000, -21.0000000
264getPolyStr(diff)
265-4.x^0 - 21.x^1 - 8.x^2 + 20.x^3 - 24.x^4 - 21.x^5
266
267degree = getUnifRand(0, 9_IK)
268degree
269+7
270coef = getUnifRand(-9, 9, degree)
271coef
272-5.00000000, -6.00000000, +9.00000000, -7.00000000, -2.00000000, -1.00000000, -1.00000000
273getPolyStr(coef)
274-5.x^0 - 6.x^1 + 9.x^2 - 7.x^3 - 2.x^4 - 1.x^5 - 1.x^6
275order = getUnifRand(0, size(coef) + 1)
276order
277+8
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-7.00000000, -7.00000000, +3.00000000, +8.00000000
292getPolyStr(coef)
293-7.x^0 - 7.x^1 + 3.x^2 + 8.x^3
294order = getUnifRand(0, size(coef) + 1)
295order
296+3
297
298call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
299call setPolyDiff(diff, coef, order)
300diff ! derivative coefficients.
301+24.0000000
302getPolyStr(diff)
30324.x^0
304
305degree = getUnifRand(0, 9_IK)
306degree
307+1
308coef = getUnifRand(-9, 9, degree)
309coef
310+1.00000000
311getPolyStr(coef)
3121.x^0
313order = getUnifRand(0, size(coef) + 1)
314order
315+0
316
317call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
318call setPolyDiff(diff, coef, order)
319diff ! derivative coefficients.
320+1.00000000
321getPolyStr(diff)
3221.x^0
323
324degree = getUnifRand(0, 9_IK)
325degree
326+7
327coef = getUnifRand(-9, 9, degree)
328coef
329+9.00000000, +7.00000000, +4.00000000, +1.00000000, -6.00000000, -2.00000000, +7.00000000
330getPolyStr(coef)
3319.x^0 + 7.x^1 + 4.x^2 + 1.x^3 - 6.x^4 - 2.x^5 + 7.x^6
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+7.00000000, +8.00000000, +3.00000000, -24.0000000, -10.0000000, +42.0000000
340getPolyStr(diff)
3417.x^0 + 8.x^1 + 3.x^2 - 24.x^3 - 10.x^4 + 42.x^5
342
343degree = getUnifRand(0, 9_IK)
344degree
345+6
346coef = getUnifRand(-9, 9, degree)
347coef
348-5.00000000, +3.00000000, +8.00000000, +6.00000000, +7.00000000, +0.00000000
349getPolyStr(coef)
350-5.x^0 + 3.x^1 + 8.x^2 + 6.x^3 + 7.x^4 + 0.x^5
351order = getUnifRand(0, size(coef) + 1)
352order
353+4
354
355call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
356call setPolyDiff(diff, coef, order)
357diff ! derivative coefficients.
358+28.0000000, +0.00000000
359getPolyStr(diff)
36028.x^0 + 0.x^1
361
362degree = getUnifRand(0, 9_IK)
363degree
364+9
365coef = getUnifRand(-9, 9, degree)
366coef
367-4.00000000, +3.00000000, -3.00000000, -4.00000000, -6.00000000, -7.00000000, -2.00000000, -7.00000000, +2.00000000
368getPolyStr(coef)
369-4.x^0 + 3.x^1 - 3.x^2 - 4.x^3 - 6.x^4 - 7.x^5 - 2.x^6 - 7.x^7 + 2.x^8
370order = getUnifRand(0, size(coef) + 1)
371order
372+5
373
374call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
375call setPolyDiff(diff, coef, order)
376diff ! derivative coefficients.
377-35.0000000, -12.0000000, -49.0000000, +16.0000000
378getPolyStr(diff)
379-35.x^0 - 12.x^1 - 49.x^2 + 16.x^3
380
381degree = getUnifRand(0, 9_IK)
382degree
383+8
384coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
385coef
386(+1.00000000, +7.00000000), (-9.00000000, +9.00000000), (+9.00000000, -9.00000000), (+2.00000000, +3.00000000), (+8.00000000, +7.00000000), (+7.00000000, +8.00000000), (-1.00000000, -7.00000000), (+2.00000000, -1.00000000)
387getPolyStr(coef)
388(1.,7.)x^0 + (-9.,9.)x^1 + (9.,-9.)x^2 + (2.,3.)x^3 + (8.,7.)x^4 + (7.,8.)x^5 + (-1.,-7.)x^6 + (2.,-1.)x^7
389order = getUnifRand(0, size(coef) + 1)
390order
391+5
392
393call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
394call setPolyDiff(diff, coef, order)
395diff ! derivative coefficients.
396(+35.0000000, +40.0000000), (-6.00000000, -42.0000000), (+14.0000000, -7.00000000)
397getPolyStr(diff)
398(35.,40.)x^0 + (-6.,-42.)x^1 + (14.,-7.)x^2
399
400degree = getUnifRand(0, 9_IK)
401degree
402+1
403coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
404coef
405(+1.00000000, +8.00000000)
406getPolyStr(coef)
407(1.,8.)x^0
408order = getUnifRand(0, size(coef) + 1)
409order
410+0
411
412call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
413call setPolyDiff(diff, coef, order)
414diff ! derivative coefficients.
415(+1.00000000, +8.00000000)
416getPolyStr(diff)
417(1.,8.)x^0
418
419degree = getUnifRand(0, 9_IK)
420degree
421+3
422coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
423coef
424(+3.00000000, +6.00000000), (+9.00000000, -6.00000000), (+2.00000000, -3.00000000)
425getPolyStr(coef)
426(3.,6.)x^0 + (9.,-6.)x^1 + (2.,-3.)x^2
427order = getUnifRand(0, size(coef) + 1)
428order
429+3
430
431call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
432call setPolyDiff(diff, coef, order)
433diff ! derivative coefficients.
434
435getPolyStr(diff)
436
437
438degree = getUnifRand(0, 9_IK)
439degree
440+3
441coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
442coef
443(-4.00000000, +5.00000000), (+3.00000000, +7.00000000), (-4.00000000, +1.00000000)
444getPolyStr(coef)
445(-4.,5.)x^0 + (3.,7.)x^1 + (-4.,1.)x^2
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(-4.00000000, +5.00000000), (+3.00000000, +7.00000000), (-4.00000000, +1.00000000)
454getPolyStr(diff)
455(-4.,5.)x^0 + (3.,7.)x^1 + (-4.,1.)x^2
456
457degree = getUnifRand(0, 9_IK)
458degree
459+3
460coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
461coef
462(-1.00000000, -4.00000000), (-6.00000000, -7.00000000), (+1.00000000, -2.00000000)
463getPolyStr(coef)
464(-1.,-4.)x^0 + (-6.,-7.)x^1 + (1.,-2.)x^2
465order = getUnifRand(0, size(coef) + 1)
466order
467+3
468
469call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
470call setPolyDiff(diff, coef, order)
471diff ! derivative coefficients.
472
473getPolyStr(diff)
474
475
476degree = getUnifRand(0, 9_IK)
477degree
478+4
479coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
480coef
481(-4.00000000, +7.00000000), (-3.00000000, +6.00000000), (+1.00000000, -5.00000000), (-4.00000000, +9.00000000)
482getPolyStr(coef)
483(-4.,7.)x^0 + (-3.,6.)x^1 + (1.,-5.)x^2 + (-4.,9.)x^3
484order = getUnifRand(0, size(coef) + 1)
485order
486+2
487
488call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
489call setPolyDiff(diff, coef, order)
490diff ! derivative coefficients.
491(+2.00000000, -10.0000000), (-12.0000000, +27.0000000)
492getPolyStr(diff)
493(2.,-10.)x^0 + (-12.,27.)x^1
494
495degree = getUnifRand(0, 9_IK)
496degree
497+3
498coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
499coef
500(-1.00000000, -2.00000000), (+4.00000000, -1.00000000), (+6.00000000, +0.00000000)
501getPolyStr(coef)
502(-1.,-2.)x^0 + (4.,-1.)x^1 + (6.,0.)x^2
503order = getUnifRand(0, size(coef) + 1)
504order
505+0
506
507call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
508call setPolyDiff(diff, coef, order)
509diff ! derivative coefficients.
510(-1.00000000, -2.00000000), (+4.00000000, -1.00000000), (+6.00000000, +0.00000000)
511getPolyStr(diff)
512(-1.,-2.)x^0 + (4.,-1.)x^1 + (6.,0.)x^2
513
514degree = getUnifRand(0, 9_IK)
515degree
516+1
517coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
518coef
519(+5.00000000, +6.00000000)
520getPolyStr(coef)
521(5.,6.)x^0
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
530getPolyStr(diff)
531
532
533degree = getUnifRand(0, 9_IK)
534degree
535+3
536coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
537coef
538(-4.00000000, +9.00000000), (-2.00000000, +2.00000000), (-4.00000000, +5.00000000)
539getPolyStr(coef)
540(-4.,9.)x^0 + (-2.,2.)x^1 + (-4.,5.)x^2
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(-2.00000000, +2.00000000), (-8.00000000, +10.0000000)
549getPolyStr(diff)
550(-2.,2.)x^0 + (-8.,10.)x^1
551
552degree = getUnifRand(0, 9_IK)
553degree
554+3
555coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
556coef
557(+2.00000000, +0.00000000), (+8.00000000, -7.00000000), (-6.00000000, -9.00000000)
558getPolyStr(coef)
559(2.,0.)x^0 + (8.,-7.)x^1 + (-6.,-9.)x^2
560order = getUnifRand(0, size(coef) + 1)
561order
562+0
563
564call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
565call setPolyDiff(diff, coef, order)
566diff ! derivative coefficients.
567(+2.00000000, +0.00000000), (+8.00000000, -7.00000000), (-6.00000000, -9.00000000)
568getPolyStr(diff)
569(2.,0.)x^0 + (8.,-7.)x^1 + (-6.,-9.)x^2
570
571degree = getUnifRand(0, 9_IK)
572degree
573+4
574coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
575coef
576(+2.00000000, -1.00000000), (+5.00000000, -1.00000000), (+4.00000000, -1.00000000), (-7.00000000, +9.00000000)
577getPolyStr(coef)
578(2.,-1.)x^0 + (5.,-1.)x^1 + (4.,-1.)x^2 + (-7.,9.)x^3
579order = getUnifRand(0, size(coef) + 1)
580order
581+4
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+5
593coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
594coef
595(-2.00000000, +8.00000000), (+7.00000000, +7.00000000), (+4.00000000, -1.00000000), (-7.00000000, -5.00000000), (+3.00000000, +6.00000000)
596getPolyStr(coef)
597(-2.,8.)x^0 + (7.,7.)x^1 + (4.,-1.)x^2 + (-7.,-5.)x^3 + (3.,6.)x^4
598order = getUnifRand(0, size(coef) + 1)
599order
600+0
601
602call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
603call setPolyDiff(diff, coef, order)
604diff ! derivative coefficients.
605(-2.00000000, +8.00000000), (+7.00000000, +7.00000000), (+4.00000000, -1.00000000), (-7.00000000, -5.00000000), (+3.00000000, +6.00000000)
606getPolyStr(diff)
607(-2.,8.)x^0 + (7.,7.)x^1 + (4.,-1.)x^2 + (-7.,-5.)x^3 + (3.,6.)x^4
608
609degree = getUnifRand(0, 9_IK)
610degree
611+5
612coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
613coef
614(-1.00000000, +3.00000000), (+4.00000000, -8.00000000), (-3.00000000, -8.00000000), (-8.00000000, -3.00000000), (-7.00000000, +5.00000000)
615getPolyStr(coef)
616(-1.,3.)x^0 + (4.,-8.)x^1 + (-3.,-8.)x^2 + (-8.,-3.)x^3 + (-7.,5.)x^4
617order = getUnifRand(0, size(coef) + 1)
618order
619+6
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+6
631coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
632coef
633(+9.00000000, -6.00000000), (-3.00000000, +6.00000000), (+0.00000000, -3.00000000), (+3.00000000, +9.00000000), (+3.00000000, -3.00000000), (-9.00000000, -1.00000000)
634getPolyStr(coef)
635(9.,-6.)x^0 + (-3.,6.)x^1 + (0.,-3.)x^2 + (3.,9.)x^3 + (3.,-3.)x^4 + (-9.,-1.)x^5
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(-45.0000000, -5.00000000)
644getPolyStr(diff)
645(-45.,-5.)x^0
646
647degree = getUnifRand(0, 9_IK)
648degree
649+9
650coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
651coef
652(+5.00000000, +2.00000000), (+7.00000000, +0.00000000), (-6.00000000, +0.00000000), (-5.00000000, -3.00000000), (-6.00000000, -3.00000000), (-6.00000000, +5.00000000), (+5.00000000, -1.00000000), (+4.00000000, +8.00000000), (+8.00000000, +1.00000000)
653getPolyStr(coef)
654(5.,2.)x^0 + (7.,0.)x^1 + (-6.,0.)x^2 + (-5.,-3.)x^3 + (-6.,-3.)x^4 + (-6.,5.)x^5 + (5.,-1.)x^6 + (4.,8.)x^7 + (8.,1.)x^8
655order = getUnifRand(0, size(coef) + 1)
656order
657+6
658
659call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
660call setPolyDiff(diff, coef, order)
661diff ! derivative coefficients.
662(+30.0000000, -6.00000000), (+28.0000000, +56.0000000), (+64.0000000, +8.00000000)
663getPolyStr(diff)
664(30.,-6.)x^0 + (28.,56.)x^1 + (64.,8.)x^2
665
666degree = getUnifRand(0, 9_IK)
667degree
668+7
669coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
670coef
671(-9.00000000, +7.00000000), (+2.00000000, +5.00000000), (-6.00000000, +1.00000000), (+1.00000000, -8.00000000), (+9.00000000, +1.00000000), (+2.00000000, +9.00000000), (+1.00000000, -3.00000000)
672getPolyStr(coef)
673(-9.,7.)x^0 + (2.,5.)x^1 + (-6.,1.)x^2 + (1.,-8.)x^3 + (9.,1.)x^4 + (2.,9.)x^5 + (1.,-3.)x^6
674order = getUnifRand(0, size(coef) + 1)
675order
676+0
677
678call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
679call setPolyDiff(diff, coef, order)
680diff ! derivative coefficients.
681(-9.00000000, +7.00000000), (+2.00000000, +5.00000000), (-6.00000000, +1.00000000), (+1.00000000, -8.00000000), (+9.00000000, +1.00000000), (+2.00000000, +9.00000000), (+1.00000000, -3.00000000)
682getPolyStr(diff)
683(-9.,7.)x^0 + (2.,5.)x^1 + (-6.,1.)x^2 + (1.,-8.)x^3 + (9.,1.)x^4 + (2.,9.)x^5 + (1.,-3.)x^6
684
685degree = getUnifRand(0, 9_IK)
686degree
687+7
688coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
689coef
690(-2.00000000, -2.00000000), (-6.00000000, +3.00000000), (+3.00000000, +2.00000000), (-1.00000000, +9.00000000), (-2.00000000, -1.00000000), (-6.00000000, +3.00000000), (-7.00000000, +0.00000000)
691getPolyStr(coef)
692(-2.,-2.)x^0 + (-6.,3.)x^1 + (3.,2.)x^2 + (-1.,9.)x^3 + (-2.,-1.)x^4 + (-6.,3.)x^5 + (-7.,0.)x^6
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(-6.00000000, +3.00000000), (+6.00000000, +4.00000000), (-3.00000000, +27.0000000), (-8.00000000, -4.00000000), (-30.0000000, +15.0000000), (-42.0000000, +0.00000000)
701getPolyStr(diff)
702(-6.,3.)x^0 + (6.,4.)x^1 + (-3.,27.)x^2 + (-8.,-4.)x^3 + (-30.,15.)x^4 + (-42.,0.)x^5
703
704degree = getUnifRand(0, 9_IK)
705degree
706+2
707coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
708coef
709(-3.00000000, +8.00000000), (+2.00000000, -2.00000000)
710getPolyStr(coef)
711(-3.,8.)x^0 + (2.,-2.)x^1
712order = getUnifRand(0, size(coef) + 1)
713order
714+1
715
716call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
717call setPolyDiff(diff, coef, order)
718diff ! derivative coefficients.
719(+2.00000000, -2.00000000)
720getPolyStr(diff)
721(2.,-2.)x^0
722
723degree = getUnifRand(0, 9_IK)
724degree
725+7
726coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
727coef
728(-7.00000000, +5.00000000), (+2.00000000, -2.00000000), (+8.00000000, -1.00000000), (+1.00000000, +4.00000000), (+7.00000000, +8.00000000), (-5.00000000, +0.00000000), (+3.00000000, +6.00000000)
729getPolyStr(coef)
730(-7.,5.)x^0 + (2.,-2.)x^1 + (8.,-1.)x^2 + (1.,4.)x^3 + (7.,8.)x^4 + (-5.,0.)x^5 + (3.,6.)x^6
731order = getUnifRand(0, size(coef) + 1)
732order
733+6
734
735call setResized(diff, max(0_IK, size(coef, 1, IK) - order))
736call setPolyDiff(diff, coef, order)
737diff ! derivative coefficients.
738(+18.0000000, +36.0000000)
739getPolyStr(diff)
740(18.,36.)x^0
741
742degree = getUnifRand(0, 9_IK)
743degree
744+6
745coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)
746coef
747(-2.00000000, +5.00000000), (+3.00000000, -2.00000000), (-4.00000000, +7.00000000), (-6.00000000, -5.00000000), (-6.00000000, -9.00000000), (+8.00000000, -8.00000000)
748getPolyStr(coef)
749(-2.,5.)x^0 + (3.,-2.)x^1 + (-4.,7.)x^2 + (-6.,-5.)x^3 + (-6.,-9.)x^4 + (8.,-8.)x^5
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, +5.00000000), (+3.00000000, -2.00000000), (-4.00000000, +7.00000000), (-6.00000000, -5.00000000), (-6.00000000, -9.00000000), (+8.00000000, -8.00000000)
758getPolyStr(diff)
759(-2.,5.)x^0 + (3.,-2.)x^1 + (-4.,7.)x^2 + (-6.,-5.)x^3 + (-6.,-9.)x^4 + (8.,-8.)x^5
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: