I have put my complete 'wish list' on the page here. This page contains the replies to my issue about equation solvers.
Add Ability to Write Equation Solvers for a given Domain.
FriCAS has quite good support for say, systems of polynomial equations in field or OrderedRing, see numsolve.spad.pamphlet for more details.
Would it be possible to generalise this so that someone writing code for an SPAD domain can add their own equation solvers for their domain. With variables that represent elements of that domain.
So, for example, we might want to write equations where the variables are quaternions. So we need to write a solver which can handle a non-commuting algebra.
I suppose someone could write some code in SPAD to do this now? But it really needs a proper framework to do it efficiently?
Reply From WaldekYou can write solvers just now. Existing solvers are packages which export 'solve' function. Of course, you need an algorithm for given domain. Given system of linear equations over quaternions one can convert it to a bigger linear system over base ring and call existing solver. Then convert back to quaternions. In principle similar approach may work for polynomial equations, but even simple polynomial equations over quaternions will produce complicated equations over base ring. Directly working with quaternions may produce better solver. Anyway, the main problems is to find a method of solving for given domain. |
Reply From MeOK thanks, I did not know this, it looks useful I'll have to experiment with it. Do you know of any tutorials? Perhaps the Sourceforge feature-request should be changed to the wish to have solvers for quaternions and what I would really like: solvers for Clifford algebra (and possibly better documentation/tutorials for writers of solvers?). By the way, is it helpful to put feature-requests on Sourceforge? It is certainly useful for me to find out that FriCAS has more capability that I thought. Also It can't do any harm to have more activity on the project which could also lead to more people finding FriCAS when searching on Sourceforge. |
Reply From WaldekBasically, for the interpreter 'solve' is just like another function. If you add a new one normal overloading resolution will choose appropriate one. You need some way of writing equations. If you want to have '=' sign, then you can use Equation domain. Eqation can do only a little: '=' sign on command line will create equation, you can extract left hand side and right hand side. For both sides you need some representation of terms. For polynomial Polynomial is good choice, but for noncommutative domains you need someting different. We have 'XPolynomial' domain which may work OK. I write 'may work' because 'XPolynomial' assumes that variables commute with coefficients which strictly speaking is not true if you work with equations over noncommutative ring. This is OK if you take coefficients from the base ring. And any system of algebraic equations can be written is such a way that you never multiply variable by noncommuting coefficient. The problem is that if you are not careful writing your equation, then 'XPolynomial' will change relative order of coefficients and variables which may lead to inequivalent system. So, it may be wise to create a generalization of 'XPolynomial' which preserves relative order of variables and coefficients. Anyway, if you have a finite dimensional algebra over a commutative ring (like Quaternion), then you can replace each variable from the algebra by a linear combination of basis elements with coefficients form base ring. So, instead of 'x' in quaternion you will have 'x1 + i*x2 + j*x3 + k*x4'. Practically, this can be done by using say 'Quaternion(Polyniomial(Fraction(Integer)))' and defining appropriate mapping from noncommutative polynomials (which represent your equations) to the quaternions with polynomial coefficients. For polynomials there is 'PolynomialCategoryLifting' package which helps building mappings between polynomials and a commitative ring. Something similar would be needed form noncommutative polynomials. Note that the approch above is rather naive and potentially quite inefficient. In general case, one can use Expression to represent equations. The real difficulty is to have solving algorithm. Basically any open problem in mathematics can be formulated as question about solutions of aproproate equations, so it unlikely that any general method exists. > By the way, is it helpful to put feature-requests on Sourceforge? It is > certainly useful for me to find out that FriCAS has more capability that > I thought. Also It can't do any harm to have more activity on the > project which could also lead to more people finding FriCAS when > searching on Sourceforge. Well, for discussion mailing list is better. Feature-requests are better when you have reasonably good ideas how the feature should look like. Main advantage of feature-request compared to mailing list is that thing on mailing list are mixed with all other traffic, so it is easy to forget them. Feature-request will stand out. |
I have put some information about the SPAD mechanism for equation solvers on the page here.