Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Add Rational Expressions #95

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

IsaMorphic
Copy link

@IsaMorphic IsaMorphic commented Apr 22, 2019

For a long time many people have reported the lack of functionality regarding the division of expressions.
See these issues:
#92
#90
#82
#76
At first I tried to make rational expressions more recursive in nature, (i.e rational expression inside of rational expression), but decided against it as those types of expressions can be easily simplified. The new feature does break some tests regarding dividing expressions, and new tests have yet to be created as well. I apologize if there are any formatting issues, I tried to clean up the diff to make it as consistient as possible. In fact, this is my first time contributing to a project. I'm open to any suggestions or comments (so long that they are constructive in nature 😁).

@IsaMorphic IsaMorphic marked this pull request as ready for review April 22, 2019 19:25
@coveralls
Copy link

coveralls commented Apr 23, 2019

Coverage Status

Coverage decreased (-2.9%) to 95.174% when pulling 63919da on yodadude2003:master into 8c74b87 on nicolewhite:master.

@IsaMorphic
Copy link
Author

Just removed some unnecessary commits and squashed some smaller ones together

@IsaMorphic
Copy link
Author

IsaMorphic commented Apr 25, 2019

Status update: The responsibilities and role of the Rational class has changed. Instead of being implemented at the term level (inside of expressions), Rationals now sit above Expressions in the library's hierarchy. They are still used to represent division of two expressions, its just that now Rationals contain expressions v.s expressions contain terms/rationals. I made this change to avoid having expressions inside of expressions, as it not only makes a mess of object types to deal with but it also makes expressions recursive and therefore more difficult to solve when put inside equations. Expressions now function exactly the same as they did before I made any changes to the base library, so long as they do not undergo any operations with Rationals (with the exception of division*). Any time a Rational gets involved in adding, subtracting, multiplying, or dividing Expressions, the Expression mutates into a Rational. Also, Rationals can now be initialized in any way that an expression can. Variable names, Terms, Variable objects, constants, and all. A rational can be initialized with one or two expression/expression-compatible objects. If only one object is given, the rational's numerator is initialized to that object, and the denominator is initialized to one. Otherwise, the first argument is assigned to the numerator and the second is assigned to the denominator. Didn't expect to be writing a book, but I guess I've made a lot of changes 😆. Thats all for now.
*Edit: forgot to mention that Expressions will also mutate into Rationals if they are divided by multinomial Expressions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants