# “reversing” non-linear equation system

I'm not a mathematician and I'm facing a problem with those equations that I found in a book of history of colorscience.

The equations were created by MacAdam to transform the classical colorimetric diagram of the CIE into something better.

The CIE diagram plots chromaticity with 2 coordinates x,y MacAdams plots the transformed chromaticities D,M

While it's easy to calculate D,M with given x,y (see codes below), I find it impossible so far to do the opposite, i.e., to find the reverse formulae that will compute x,y with given D,M

Do you have any idea of how this could be done? Thanks

The transformation from $x,y$ to $D,M$ is as follows:

$$a = \frac{10x}{2.4x+34y+1}\\ b = \frac{10y}{2.4x+34y+1}\\ D = 3751a^2-10a^4-520b^2+13295b^3+32327ab-25491a^2b-41672ab^2+10a^3b-5227\sqrt a+2952a^\frac14\\ c = \frac{10x}{42y-x+1}\\ d = \frac{10y}{42y-x+1}\\ M = 404d - 185d^2+52d^3+69c(1-d^2)-3c^2d+30cd^3$$

-

Hello and welcome to the site!

The question you are asking has no simple solution. Basically, you have some mapping of pairs of real numbers into some other pair of real numbers, $(D,M)=F(x,y)$ and are asking to find an inverse of $F$. There are many problems with this, the main two being:

• In general, $F^{-1}$ may not globally exist
• Usually, if $F$ is ugly enough, there is no closed form expression of $F^{-1}$.

That said, all is not lost! There are ways of solving the nonlinear system. They will not return an exact result but only an approximation, and will not be as quick as simply evaluating one expression. As I do not know what programming language you will be using, I suggest you look into any package or library you can find for solving nonlinear systems of equations. For example, MATLAB has a range of solutions for your problem, as do many other programs.

-
thank you! I am using Python 2.7 64bits, do you think of anything? A tutorial would also be most welcomed! Best –  adrienlucca.wordpress.com Feb 15 '14 at 23:41
One approach would be to create a 2d lookup table to derive start values for an iterative search by interpolating your D;M values with existing D;M values in your table. Once you have the start values, you can use an optimizer to minimize the error of your estimated x;y: docs.scipy.org/doc/scipy/reference/tutorial/optimize.html –  Axel Kemper Feb 15 '14 at 23:57
For Python, I suggest looking at this stackexchange question: stackoverflow.com/questions/8739227/… –  5xum Feb 15 '14 at 23:58
Thank you very much, I'll try scipy.optimize –  adrienlucca.wordpress.com Feb 16 '14 at 0:33

As said in your post, comments and answers, you have two equations equations $D$ and $M$ for two unknwons $x$ and $y$. Provided a "reasonable" guess of the solution which could be obtained as suggested by Axel Kemper), you could use Newton-Raphson method (even with numerical derivatives since your equations are quite awful).

Another solution is to consider the Euclidian norm of the system and minimize ($D^2+M^2$) with respect to $x$ and $y$. This will bring you to the first local minimum; but, if, at this point, the norm is $0$, then you have a solution to the problem.

By the way, is it established that the solution is unique (that is to say that to one pair of $D,M$ corresponds only one pair of ($x,y$) ?

-
thank you for your interesting question. I think the solution is not unique, however, in the specific domain where I need a solution, it should be the case. You wrote this: "you could use Newton-Raphson method (even with numerical derivatives since your equations are quite awful)", unfortunately I have no idea what you are talking about. But if you know where I could find some info/tutorial on how to do this with Python, I would be very very happy :) –  adrienlucca.wordpress.com Feb 17 '14 at 5:22
@adrienlucca.wordpress.com. Look at math.stackexchange.com/questions/268991/… and tx.technion.ac.il/~dlewin/054374/Day_5.pdf. I shall try to build an example for your problem. –  Claude Leibovici Feb 17 '14 at 5:40