This is my first F# project, in which I learn F# by implementing the most basic data types to be used in a CAS.
I intend to gradually learn F# as I add more and more stuff here.
Currently, I've implemented the following algebraic structures:
- AbstractAlgebra -- semigroups, rings, domains, fields
- Fractions -- quotient field construction
- Polynomials -- polynomial rings (with arbitrary coefficients) and domains (with coefficients from a field)
- FieldExtensions -- this currently only contains algebraics, because transcendentals are isomorphic to fields of fractions of polys
- DifferentialAlgebra -- derivatives for polynomials, quotients, and algebraic and transcendental extensions of differential fields
First of all, now we can construct
Of course, with this construction, derivation of rational functions of exponents, for example, comes for free since we can just write
let qDiffField = DifferentialField(rationals, fun _ -> rationals.Zero)
let ratFuncs = DifferentialTranscendentExtensionField(qDiffField, "x", [| rationals.One |])
let ratOfExps = DifferentialTranscendentalExtensionField(ratFuncs, "exp(x)", [| ratFuncs.Zero; ratFuncs.One |])because
[| ratFuncs.Zero; ratFuncs.One |], which is basically
Check out Program.fs for examples of how the system works.
Don't hesitate to post an issue if you have anything to say.
Don't hesitate to make a pull request if you have something to add.
- Matrices. This will be of utmost importance, as we will soon need stuff like resultants.
- Squarefree decomposition for polys. This sounds like somewhat trivial over fields, but I still consider it a step worth mentioning
- Basics needed for Risch integration. Think of Hermite reduction
- Eventually, rational function integration
- Eventually, hopefully, transcendental function integration
- ...I wonder if I do have what it takes to approach algebraics... Davenport's book is a difficult read.
(*) CommutativeMonoid is supposed to be both Monoid and CommutativeSemigroup, but due to F# not supporting multiple inheritance, I had to choose one, and chose to inherit Monoid. The constructor, however, does take a commutative operation as a parameter.
(**) IntegralDomain is supposed to be both Domain and CommutativeRing, but again, due to F# not supporting multiple inheritance, I chose to inherit Domain.
This is not an optimal solution, as IntegralDomain technically fails to be a CommutativeRing, which theoretically it always shall be. To overcome this, IntegralDomain is provided with a member AsCommutativeRing, which provides the CommutativeRing compatibility.
I am open to suggestions as to how this should be fixed to develop these types in best possible generality.
I am currently considering rewriting this in F*. The problem is, the language is vastly different from F#, and I'm currently only starting to grasp its basics. Can't even implement inheritance so far.
If anyone can and is willing help me with that, feel free to contact me... leave an issue here, or something :)
F* would theoretically offer formal verification for quite a lot of things, such that we won't have to double-check stuff like operation commutativity or associativity when defining basic abstract algebra types, or the axioms for derivation
(
I hereby express my heartfelt gratitude to akater, Ayrat Hudaygulov, Vladislav Khapin, and Friedrich fon Never, for their comments and helpful tips, and patience when I didn't understand them fast enough. You guys are the best.