Skip to content

Issue 3 integral class Implementation#15

Open
theEhlien wants to merge 16 commits into
masterfrom
issue-3-integral-class
Open

Issue 3 integral class Implementation#15
theEhlien wants to merge 16 commits into
masterfrom
issue-3-integral-class

Conversation

@theEhlien
Copy link
Copy Markdown
Member

Description of the changes:

  • Created an integral class
  • Implemented functions to take a string and integrate it
  • Three functions are fully functional (findIntegratedUpon, splitExpression, and evalTerm)
  • These three functions are working and have unit testing
  • Three functions are not fully functional:
    evaluateIntegral (code is written but cannot work yet because of simplify function)
    simplify (code is written but relies on an object that does not exist in the project yet - Algebra)
    stringBuilder (has not been implemented yet)
  • Fixes for bugs within the fully functional functions were implemented

theEhlien added 16 commits May 1, 2020 15:29
Updated project and project filter files to include Integral.cpp and Integral.h
- Added planning for implementation and functions
- integration of Algebra class simplifyExpression added as comments
- Add function that finds variable to integrate upon
- Start function that splits the expression into coefficients and exponents
- some functionality of splitExpression is added
- remaining functionality of splitExpression is outlined in comments
- add a check before splitting the expression that
  makes sure there is a 'dx' form at end of expression
- splitExpression removes integratedUpon symbol at end so
  it does not try to make that a term as well
- add checks for a^x form
- add checks for e^x form
- add function declaration for evalTerm and fix Doxygen comments in header
- add neccessary data structures to store evaluated data
- create basic function call to do the evaluations
- This merge is to implement Unit Testing
- Created testing for integral class
- Updated testCoverage.md and testResults.md to reflect where our team
  is putting unit testing
- Fixed bugs in Integral class as needed for testing to pass
@Jared-Gibson Jared-Gibson self-requested a review May 4, 2020 00:35
Copy link
Copy Markdown
Member

@Jared-Gibson Jared-Gibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks pretty good except for that copy-paste area.

Comment on lines +148 to +184
// check for '/' (fraction) in it - if fraction, change coefficient for this term to match
if (*it == '/') { //leading coefficient is a fraction

std::string coeffTmp = ""; //coeffTmp holds digits until next non-digit char
it += 1;
while (*it != ' ' && *it != '+' && *it != '-') {
coeffTmp.push_back(*it);
++it;
}
double coeffDouble = coeff.at(termIndex) / stod(coeffTmp);
coeff.at(termIndex) = coeffDouble; //overwrite parsed double value in coeff vector

}

if (*it == ' ' && *(it + 1) == '/' && *(it + 2) != ' ') { //leading coefficient is fraction (space before '/')
std::string coeffTmp = ""; // coeffTmp holds digits until next non-digit char
it += 2;
while (*it != ' ' && *it != '+' && *it != '-')
{
coeffTmp.push_back(*it);
++it;
}
double coeffDouble = coeff.at(termIndex) / stod(coeffTmp);
coeff.at(termIndex) = coeffDouble; // overwrite parsed double value in coeff vector
}

if (*it == ' ' && *(it + 1) == '/' && *(it + 2) == ' ') { //leading coefficient is fraction (space before and after '/')
std::string coeffTmp = ""; // coeffTmp holds digits until next non-digit char
it += 3;
while (*it != ' ' && *it != '+' && *it != '-')
{
coeffTmp.push_back(*it);
++it;
}
double coeffDouble = coeff.at(termIndex) / stod(coeffTmp);
coeff.at(termIndex) = coeffDouble; // overwrite parsed double value in coeff vector
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that you do the same thing in these three if cases; perhaps they could be condensed into a method for re-usability.

@smalls4894
Copy link
Copy Markdown

Good documentation, code follows existing format well, tests all run fine with no obvious bugs

@smalls4894 smalls4894 self-requested a review May 4, 2020 00:57
@nreiner
Copy link
Copy Markdown

nreiner commented May 4, 2020

Upon running the code no bugs or issues arrived, and the comments look well documented and concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants