scarlet06 / multivariate-polynomial Goto Github PK
View Code? Open in Web Editor NEWthis project emulates multivariate polynomial
this project emulates multivariate polynomial
When working with only one polynomial type everything work just as expected (until when other bugs will be found)
But when combing more types everything works
Every Polynomial type is in a different file
The Base class is MultyPolynomial
m that handles multiple variative polynomial
SinglePolynomial
s handles polynomial with only one variable and inherits from the Base class
ComplexMultyPolynomial
cm handles multiple variative polynomial with complex coefficients and inherits from the Base class too
ComplexSinglePolynomial
sm handles single variable polynomial with complex coefficients and inherits from both SinglePolynomial
and ComplexMultyPolynomial
graph TD;
A[MultyPolynomial]-->B[ComplexMultyPolynomial];
A-->C[SinglePolynomial];
C-->D[ComplexSinglePolynomial];
B-->D;
Every type has a method that let itself convert into a "farther" type and has single variable can handle operation with multiple but not the other way arounf
For math operations, where I could, I inherited the methods, for standard examples everything looked good. E.g. by doing cm+m
what I got was still a cm
as wanted, but I didn't noticed that for obvious reasons, doing m+cm
what is returned is a m
instead of cm
Having all the class in different files is not possible to do a simple conversione, 'couse I would need to a circular import.
Furthermore I'm trying to avoid not necessaries conversions.
there are many think I'd like to got it right in this project:
cm + s = s + cm -> cm
cs + cm = cm + cs -> cm
cs + s = s + cs -> cs
cs + m = m + cs -> cm
s + m = m + s -> m
cm + m = m + cm -> cm
First I think It would be important to handle the operations like (3) and (6)
So it would be easier to handle (2) and (5)
In the end, the harder problem would be (1) and (4) 'couse right not there are missing direct transformation between these types
Adding a little table for the actual results for all the operations trying to find a working pattern. I hope it would help anyway
LEFT | RIGHT | RESULT | NO ERROR | EXPECTED | RIGHT | WORKS |
---|---|---|---|---|---|---|
m | m | m | ✓ | m | ✓ | Y |
m | cm | m | ✓ | cm | ✗ | N |
m | s | m | ✗ | m | ✓ | N |
m | cs | m | ✗ | cm | ✗ | N |
cm | m | cm | ✓ | cm | ✓ | Y |
cm | cm | cm | ✓ | cm | ✓ | Y |
cm | s | cm | ✗ | cm | ✓ | N |
cm | cs | cm | ✗ | cm | ✓ | N |
s | m | m | ✓ | m | ✓ | Y |
s | cm | m | ✓ | cm | ✗ | N |
s | s | s | ✓ | s | ✓ | Y |
s | cs | s | ✗ | cs | ✗ | N |
cs | m | m | ✓ | cm | ✗ | N |
cs | cm | m | ✓ | cm | ✗ | N |
cs | s | cs | ✓ | cs | ✓ | Y |
cs | cs | cs | ✓ | cs | ✓ | Y |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.