Generate and return the value of the polynomial of arbitrary degree whose coefficients are specified by the user in the order of increasing power.
More...
Generate and return the value of the polynomial of arbitrary degree whose coefficients are specified by the user in the order of increasing power.
See the documentation of pm_polynomial for details of the implementation.
- Parameters
-
[in] | coef | : The input array of,
-
type
complex of the same kind as the kind of the input x of type complex , or
-
type
real of the same kind as the kind of the input x of type complex , or
-
type
real of the same kind as the kind of the input x of type real ,
containing the coefficients of the polynomial in the order of increasing power.
By definition, the degree of the polynomial is size(coef) - 1 .
|
[in] | x | : The input scalar of,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
representing the point at which the polynomial must be computed. |
- Returns
poly
: The output scalar of the same type and kind as the input x
containing the polynomial value at the specified point.
Possible calling interfaces ⛓
Generate and return the value of the polynomial of arbitrary degree whose coefficients are specified ...
This module contains procedures and generic interfaces for performing various mathematical operations...
- Warning
- The condition
0 < size(coef)
must hold for the corresponding input arguments.
This condition is 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.
- Note
- The current interface requirements of either,
-
(complex :: coef, complex :: x)
, or
-
(real :: coef, complex :: x)
, or
-
(real :: coef, real :: x)
are in line with the fact that polynomial coefficients of type real
frequently have complex
roots.
In particular, the interface (real :: coef, complex :: x)
allows seamless integration of the polynomial evaluations of this module with various polynomial root-finding algorithm of the ParaMonte library.
- See also
- getPolyRoot
setPolyRoot
Example usage ⛓
9 type(display_type) :: disp
15 call disp%show(
"getPolyVal([real(TKG) :: 1, 3, 0, 2], x = 2._TKG) ! 23.")
18 call disp%show(
"getPolyVal([real(TKG) :: -19.0, 7.0, -4.0, 6.0], x = 3._TKG) ! 128.")
21 call disp%show(
"getPolyVal([real(TKG) :: -19.0, 7.0, -4.0, 6.0], x = (3._TKG, 0._TKG)) ! (128., 0.)")
22 call disp%show(
getPolyVal([
real(TKG) ::
-19.0,
7.0,
-4.0,
6.0], x
= (
3._TKG,
0._TKG)) )
29 call disp%show(
"getPolyVal([complex(TKG) :: (+2., +4.), (+24., +12.), (-28., +36.), (-15., +0.), (+24., -42.), (-7., +0.)], x = (2._TKG, -2._TKG))")
30 call disp%show(
getPolyVal([
complex(TKG) :: (
+2.,
+4.), (
+24.,
+12.), (
-28.,
+36.), (
-15.,
+0.), (
+24.,
-42.), (
-7.,
+0.)], x
= (
2._TKG,
-2._TKG)) )
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
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 ⛓
2getPolyVal([
real(TKG) ::
1,
3,
0,
2], x
= 2._TKG)
3+23.0000000000000000000000000000000000
5getPolyVal([
real(TKG) ::
-19.0,
7.0,
-4.0,
6.0], x
= 3._TKG)
6+128.000000000000000000000000000000000
8getPolyVal([
real(TKG) ::
-19.0,
7.0,
-4.0,
6.0], x
= (
3._TKG,
0._TKG))
9(
+128.000000000000000000000000000000000,
+0.00000000000000000000000000000000000)
12getPolyVal([
complex(TKG) :: (
+2.,
+4.), (
+24.,
+12.), (
-28.,
+36.), (
-15.,
+0.), (
+24.,
-42.), (
-7.,
+0.)], x
= (
2._TKG,
-2._TKG))
13(
-38.0000000,
+2236.00000)
- 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 517 of file pm_polynomial.F90.