Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$$

share|cite|improve this question
up vote 3 down vote accepted

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.

share|cite|improve this answer
thank you! I am using Python 2.7 64bits, do you think of anything? A tutorial would also be most welcomed! Best – 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: – Axel Kemper Feb 15 '14 at 23:57
For Python, I suggest looking at this stackexchange question:… – 5xum Feb 15 '14 at 23:58
Thank you very much, I'll try scipy.optimize – 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$) ?

share|cite|improve this answer
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 :) – Feb 17 '14 at 5:22 Look at… and I shall try to build an example for your problem. – Claude Leibovici Feb 17 '14 at 5:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.