-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.h
More file actions
24 lines (19 loc) · 701 Bytes
/
Copy pathutils.h
File metadata and controls
24 lines (19 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include <vector>
#include <functional>
#include <string>
using namespace std;
typedef vector<vector<double>> Matrix;
typedef vector<double> Vector;
class Utils {
public:
static Matrix inputMatrix(int n);
static Vector inputVector(int n);
static function<double(double)> parseEquation(const string &equation);
static function<double(double)> parseDerivative(const string &equation);
private:
static double evaluateTerm(const string& pTerm, double val);
static double derivativeTerm(const string& pTerm, double val);
static double evaluatePolynomial(const string& poly, double val);
static double evaluateDerivative(const string& poly, double val);
};