Return the vector of coefficients of the polynomial resulting from the \(k\)th-order differentiation of a univariate polynomial of arbitrary degree.
More...
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)
- 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 ⛓
14 type(display_type) :: disp
15 integer(IK) :: itry, ntry
= 20
20 real(TKG),
allocatable :: coef(:), diff(:)
22 call disp%show(
"degree = getUnifRand(0, 9_IK)")
26 call disp%show(
"coef = getUnifRand(-9, 9, degree)")
32 call disp%show(
"order = getUnifRand(0, size(coef) + 1)")
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)")
41 call disp%show(
"diff ! derivative coefficients.")
51 complex(TKG),
allocatable :: coef(:), diff(:)
53 call disp%show(
"degree = getUnifRand(0, 9_IK)")
57 call disp%show(
"coef = cmplx(getUnifRand(-9, 9, degree), getUnifRand(-9, 9, degree), TKG)")
63 call disp%show(
"order = getUnifRand(0, size(coef) + 1)")
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)")
72 call disp%show(
"diff ! derivative coefficients.")
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.
This is a generic method of the derived type display_type with pass attribute.
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...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
6+3.00000000,
+2.00000000,
-9.00000000,
+3.00000000,
+1.00000000,
+9.00000000,
-3.00000000
83.x^
0 + 2.x^
1 - 9.x^
2 + 3.x^
3 + 1.x^
4 + 9.x^
5 - 3.x^
6
13call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
25-9.00000000,
-5.00000000,
+8.00000000,
-6.00000000,
-5.00000000,
-8.00000000,
-2.00000000
27-9.x^
0 - 5.x^
1 + 8.x^
2 - 6.x^
3 - 5.x^
4 - 8.x^
5 - 2.x^
6
32call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
44+9.00000000,
+6.00000000
51call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
63-9.00000000,
-5.00000000,
+1.00000000,
+8.00000000,
-6.00000000,
-1.00000000,
+7.00000000,
-2.00000000,
+5.00000000
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
70call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
73+2.00000000,
+24.0000000,
-24.0000000,
-5.00000000,
+42.0000000,
-14.0000000,
+40.0000000
752.x^
0 + 24.x^
1 - 24.x^
2 - 5.x^
3 + 42.x^
4 - 14.x^
5 + 40.x^
6
82-1.00000000,
+2.00000000,
+1.00000000,
+7.00000000
84-1.x^
0 + 2.x^
1 + 1.x^
2 + 7.x^
3
89call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
101-8.00000000,
+6.00000000
108call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
127call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
146call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
165call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
177-2.00000000,
+0.00000000,
+7.00000000
179-2.x^
0 + 0.x^
1 + 7.x^
2
184call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
187-2.00000000,
+0.00000000,
+7.00000000
189-2.x^
0 + 0.x^
1 + 7.x^
2
196+1.00000000,
-3.00000000,
-1.00000000,
-5.00000000
1981.x^
0 - 3.x^
1 - 1.x^
2 - 5.x^
3
203call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
206-2.00000000,
-15.0000000
215+1.00000000,
+5.00000000,
-4.00000000,
+9.00000000,
-3.00000000
2171.x^
0 + 5.x^
1 - 4.x^
2 + 9.x^
3 - 3.x^
4
222call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
225+1.00000000,
+5.00000000,
-4.00000000,
+9.00000000,
-3.00000000
2271.x^
0 + 5.x^
1 - 4.x^
2 + 9.x^
3 - 3.x^
4
234-8.00000000,
+6.00000000,
-3.00000000,
+2.00000000,
+7.00000000,
+4.00000000,
+7.00000000,
+3.00000000
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
241call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
253-8.00000000,
+8.00000000,
-2.00000000,
+8.00000000,
+5.00000000,
-4.00000000
255-8.x^
0 + 8.x^
1 - 2.x^
2 + 8.x^
3 + 5.x^
4 - 4.x^
5
260call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
263-4.00000000,
+24.0000000,
+20.0000000,
-20.0000000
265-4.x^
0 + 24.x^
1 + 20.x^
2 - 20.x^
3
272+6.00000000,
-6.00000000,
-2.00000000,
+9.00000000,
+1.00000000,
+1.00000000
2746.x^
0 - 6.x^
1 - 2.x^
2 + 9.x^
3 + 1.x^
4 + 1.x^
5
279call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
298call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
310+3.00000000,
+6.00000000,
+8.00000000,
+6.00000000,
-1.00000000,
+2.00000000,
-4.00000000,
-6.00000000
3123.x^
0 + 6.x^
1 + 8.x^
2 + 6.x^
3 - 1.x^
4 + 2.x^
5 - 4.x^
6 - 6.x^
7
317call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
320+16.0000000,
+18.0000000,
-4.00000000,
+10.0000000,
-24.0000000,
-42.0000000
32216.x^
0 + 18.x^
1 - 4.x^
2 + 10.x^
3 - 24.x^
4 - 42.x^
5
329+4.00000000,
-9.00000000,
+7.00000000,
+7.00000000,
-7.00000000,
+2.00000000,
-5.00000000,
-8.00000000,
+1.00000000
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
336call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
339+21.0000000,
-28.0000000,
+10.0000000,
-30.0000000,
-56.0000000,
+8.00000000
34121.x^
0 - 28.x^
1 + 10.x^
2 - 30.x^
3 - 56.x^
4 + 8.x^
5
348+7.00000000,
+9.00000000,
+2.00000000,
+5.00000000,
+0.00000000
3507.x^
0 + 9.x^
1 + 2.x^
2 + 5.x^
3 + 0.x^
4
355call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
358+9.00000000,
+4.00000000,
+15.0000000,
+0.00000000
3609.x^
0 + 4.x^
1 + 15.x^
2 + 0.x^
3
367-8.00000000,
-5.00000000,
+6.00000000,
+5.00000000
369-8.x^
0 - 5.x^
1 + 6.x^
2 + 5.x^
3
374call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
377+12.0000000,
+15.0000000
386(
+1.00000000,
-3.00000000), (
-3.00000000,
-7.00000000), (
+2.00000000,
+5.00000000), (
+3.00000000,
+6.00000000), (
+5.00000000,
+8.00000000)
388(
1.,
-3.)x^
0 + (
-3.,
-7.)x^
1 + (
2.,
5.)x^
2 + (
3.,
6.)x^
3 + (
5.,
8.)x^
4
393call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
396(
+4.00000000,
+10.0000000), (
+9.00000000,
+18.0000000), (
+20.0000000,
+32.0000000)
398(
4.,
10.)x^
0 + (
9.,
18.)x^
1 + (
20.,
32.)x^
2
405(
+4.00000000,
-5.00000000), (
-5.00000000,
+4.00000000)
407(
4.,
-5.)x^
0 + (
-5.,
4.)x^
1
412call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
424(
+9.00000000,
+9.00000000), (
-9.00000000,
+5.00000000), (
-4.00000000,
-7.00000000), (
+6.00000000,
+1.00000000)
426(
9.,
9.)x^
0 + (
-9.,
5.)x^
1 + (
-4.,
-7.)x^
2 + (
6.,
1.)x^
3
431call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
434(
+9.00000000,
+9.00000000), (
-9.00000000,
+5.00000000), (
-4.00000000,
-7.00000000), (
+6.00000000,
+1.00000000)
436(
9.,
9.)x^
0 + (
-9.,
5.)x^
1 + (
-4.,
-7.)x^
2 + (
6.,
1.)x^
3
443(
-1.00000000,
+9.00000000)
450call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
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)
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
469call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
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)
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
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)
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
488call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
500(
+0.00000000,
-8.00000000), (
-9.00000000,
-7.00000000), (
+5.00000000,
-7.00000000), (
+7.00000000,
-1.00000000), (
+8.00000000,
+3.00000000)
502(
0.,
-8.)x^
0 + (
-9.,
-7.)x^
1 + (
5.,
-7.)x^
2 + (
7.,
-1.)x^
3 + (
8.,
3.)x^
4
507call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
510(
+10.0000000,
-14.0000000), (
+21.0000000,
-3.00000000), (
+32.0000000,
+12.0000000)
512(
10.,
-14.)x^
0 + (
21.,
-3.)x^
1 + (
32.,
12.)x^
2
519(
-8.00000000,
-2.00000000), (
+0.00000000,
+5.00000000), (
+4.00000000,
+6.00000000), (
-9.00000000,
-5.00000000), (
+3.00000000,
-5.00000000)
521(
-8.,
-2.)x^
0 + (
0.,
5.)x^
1 + (
4.,
6.)x^
2 + (
-9.,
-5.)x^
3 + (
3.,
-5.)x^
4
526call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
545call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
557(
-5.00000000,
-4.00000000), (
-1.00000000,
-1.00000000), (
+8.00000000,
+6.00000000)
559(
-5.,
-4.)x^
0 + (
-1.,
-1.)x^
1 + (
8.,
6.)x^
2
564call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
567(
-1.00000000,
-1.00000000), (
+16.0000000,
+12.0000000)
569(
-1.,
-1.)x^
0 + (
16.,
12.)x^
1
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)
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
583call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
595(
-6.00000000,
-1.00000000), (
-9.00000000,
+6.00000000), (
-3.00000000,
+8.00000000), (
+5.00000000,
-1.00000000)
597(
-6.,
-1.)x^
0 + (
-9.,
6.)x^
1 + (
-3.,
8.)x^
2 + (
5.,
-1.)x^
3
602call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
614(
+7.00000000,
-7.00000000), (
+7.00000000,
-8.00000000)
616(
7.,
-7.)x^
0 + (
7.,
-8.)x^
1
621call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
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)
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
640call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
652(
-9.00000000,
+1.00000000), (
-8.00000000,
-7.00000000)
654(
-9.,
1.)x^
0 + (
-8.,
-7.)x^
1
659call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
662(
-9.00000000,
+1.00000000), (
-8.00000000,
-7.00000000)
664(
-9.,
1.)x^
0 + (
-8.,
-7.)x^
1
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)
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
678call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
681(
-10.0000000,
-5.00000000), (
-36.0000000,
-54.0000000), (
+49.0000000,
+21.0000000)
683(
-10.,
-5.)x^
0 + (
-36.,
-54.)x^
1 + (
49.,
21.)x^
2
690(
+7.00000000,
+1.00000000), (
-1.00000000,
+1.00000000), (
-8.00000000,
+5.00000000), (
+3.00000000,
+0.00000000), (
+6.00000000,
+7.00000000)
692(
7.,
1.)x^
0 + (
-1.,
1.)x^
1 + (
-8.,
5.)x^
2 + (
3.,
0.)x^
3 + (
6.,
7.)x^
4
697call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
700(
+7.00000000,
+1.00000000), (
-1.00000000,
+1.00000000), (
-8.00000000,
+5.00000000), (
+3.00000000,
+0.00000000), (
+6.00000000,
+7.00000000)
702(
7.,
1.)x^
0 + (
-1.,
1.)x^
1 + (
-8.,
5.)x^
2 + (
3.,
0.)x^
3 + (
6.,
7.)x^
4
709(
-3.00000000,
+5.00000000)
716call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
719(
-3.00000000,
+5.00000000)
728(
+1.00000000,
+9.00000000), (
-4.00000000,
+9.00000000), (
+2.00000000,
+5.00000000), (
+9.00000000,
+1.00000000)
730(
1.,
9.)x^
0 + (
-4.,
9.)x^
1 + (
2.,
5.)x^
2 + (
9.,
1.)x^
3
735call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
738(
+1.00000000,
+9.00000000), (
-4.00000000,
+9.00000000), (
+2.00000000,
+5.00000000), (
+9.00000000,
+1.00000000)
740(
1.,
9.)x^
0 + (
-4.,
9.)x^
1 + (
2.,
5.)x^
2 + (
9.,
1.)x^
3
747(
-9.00000000,
-3.00000000), (
-5.00000000,
-1.00000000), (
-3.00000000,
-8.00000000), (
+7.00000000,
+9.00000000), (
+4.00000000,
-3.00000000)
749(
-9.,
-3.)x^
0 + (
-5.,
-1.)x^
1 + (
-3.,
-8.)x^
2 + (
7.,
9.)x^
3 + (
4.,
-3.)x^
4
754call setResized(diff,
max(
0_IK,
size(coef,
1,
IK)
- order))
- 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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Fatemeh Bagheri, Tuesday 11:34 PM, August 10, 2021, Dallas, TX
Definition at line 2731 of file pm_polynomial.F90.