-
Notifications
You must be signed in to change notification settings - Fork 0
/
polynomial.h
69 lines (55 loc) · 1.94 KB
/
polynomial.h
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include "term.h"
class polynomial //this is pavan testing out git
{
public:
//CTORS
polynomial();
~polynomial();
polynomial(const term &other);
polynomial(const polynomial &other);
polynomial(std::string expString); //TESTED
//Public Functions
void setExp(std::string expString); //TESTED
fraction evaluate(const fraction &other); //TESTED
double evaluate(const double value);
void addterm(const term &term_arg); //TESTED
std::string polyString();
//Operators
polynomial& operator=(const polynomial &other);
polynomial& operator+=(const polynomial &other);
polynomial& operator-=(const polynomial &other);
polynomial& operator*=(const polynomial &other);
polynomial& operator/=(const polynomial &other);
fraction operator()(const fraction &other);
term operator[](unsigned int index) const;
term& operator[](unsigned int index);
friend
polynomial firstDerivative(const polynomial &other);
friend
polynomial nthDerivative(const polynomial &other, const int n);
friend
polynomial operator+(const polynomial &x, const polynomial &y);
friend
polynomial operator-(const polynomial &x, const polynomial &y);
friend
polynomial operator*(const polynomial &x, const polynomial &y);
friend
polynomial operator/(const polynomial &x, const polynomial &y);
friend
std::ostream& operator<<(std::ostream& out, const polynomial &p);
friend
std::istream& operator>>(std::istream& in, polynomial &p);
private:
std::vector<term> poly;
void copy(const polynomial &other);
void sort();
void combineTerms();
};
#endif