FunctionCosine.cpp 485 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/**
 * DESCRIPTION OF THE FILE
 *
 * @author Michal Kravčenko
 * @date 4.7.18 -
 */

#include "FunctionCosine.h"

FunctionCosine::FunctionCosine(double period, double bias) {
    this->period = period;
    this->bias = bias;
}

double FunctionCosine::eval(double x) {
    return std::cos(x * this->period + this->bias);
}

FunctionBase* FunctionCosine::get_derivative() {

    if(!this->derivative){
        this->derivative = new FunctionSine();
    }

    return this->derivative;
}