| 1 | #ifndef _FunctionSeries_h_ |
| 2 | #define _FunctionSeries_h_ |
| 3 | /* FunctionSeries.h |
| 4 | * |
| 5 | * Copyright (C) 1993-2021 David Weenink |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | djmw 20020813 GPL header |
| 23 | djmw 20110306 Latest modification. |
| 24 | */ |
| 25 | |
| 26 | #include "Function.h" |
| 27 | #include "Graphics.h" |
| 28 | |
| 29 | #include "FunctionSeries_def.h" |
| 30 | |
| 31 | void FunctionSeries_init (FunctionSeries me, double xmin, double xmax, integer numberOfCoefficients); |
| 32 | |
| 33 | void FunctionSeries_initWithCoefficients (FunctionSeries me, double xmin, double xmax, constVECVU const& coefficients, bool allowTrailingZeros); |
| 34 | |
| 35 | autoFunctionSeries FunctionSeries_create (double xmin, double xmax, integer numberOfCoefficients); |
| 36 | |
| 37 | void FunctionSeries_setDomain (FunctionSeries me, double xmin, double xmax); |
| 38 | |
| 39 | void FunctionSeries_setCoefficient (FunctionSeries me, integer index, double value); |
| 40 | |
| 41 | double FunctionSeries_evaluate (FunctionSeries me, double x); |
| 42 | |
| 43 | void FunctionSeries_evaluateTerms (FunctionSeries me, double x, VEC terms); |
| 44 | |
| 45 | void FunctionSeries_getExtrema (FunctionSeries me, double x1, double x2, double *xmin, double *ymin, double *xmax, double *ymax); |
| 46 | |
| 47 | integer FunctionSeries_getDegree (FunctionSeries me); |
| 48 | |
| 49 | double FunctionSeries_getMinimum (FunctionSeries me, double x1, double x2); |
| 50 | |
| 51 | double FunctionSeries_getXOfMinimum (FunctionSeries me, double x1, double x2); |
| 52 | |
| 53 | double FunctionSeries_getMaximum (FunctionSeries me, double x1, double x2); |
| 54 | |
| 55 | double FunctionSeries_getXOfMaximum (FunctionSeries me, double x1, double x2); |
| 56 | /* |
| 57 | Returns minimum and maximum function values (ymin, ymax) in |
| 58 | interval [x1, x2] and their x-values (xmin, xmax). |
| 59 | Precondition: [x1, x2] is a (sub)domain |
| 60 | my xmin <= x1 < x2 <= my xmax |
| 61 | */ |
| 62 | |
| 63 | void FunctionSeries_draw (FunctionSeries me, Graphics g, double xmin, double xmax, double ymin, double ymax, |
| 64 | int extrapolate, bool garnish); |
| 65 | /* |
| 66 | Extrapolate only for functions whose domain is extendable and that can be extrapolated. |
| 67 | Polynomials can be extrapolated. |
| 68 | LegendreSeries and ChebyshevSeries cannot be extrapolated. |
| 69 | */ |
| 70 | void FunctionSeries_drawBasisFunction (FunctionSeries me, Graphics g, integer index, double xmin, double xmax, |
| 71 | double ymin, double ymax, int extrapolate, bool garnish); |
| 72 | |
| 73 | #endif /* _FunctionSeries_h_ */ |