# How to correctly render visible spectrum with uniform intensity?

I'm trying to get the correct representation of visible spectrum to render on the screen. My current progress is with using CIE 1931 standard observer color matching functions analytically approximated by the equations given in this paper. Current image is like this:

Here the background is not ideally black to make it possible to introduce the negative contributions from the color matching functions:

But the problem with it is that the image seems to have a dip in intensity somewhere around 490 nm. I guess that this is related to the sum of the three functions having a minimum there. See the sum plotted against wavelength:

So my question is now: how do I fix the intensity of the image? Is there any standard for taking spectral sensitivity into account when converting wavelength to RGB/XYZ representation?

I guess that this is related to the sum of the three functions having a minimum there. See the sum plotted against wavelength

This is actually a wrong way to sum these functions: sRGB model specifies that to get luminosity one must weigh the RGB components with appropriate weights. Then luminosity, unsurprisingly, will become equal to the Y component of the XYZ representation.

the problem with it is that the image seems to have a dip in intensity somewhere around 490 nm

I can actually see the dip not only near 490 nm, but also near 570 nm. Most likely this perception is due to a combination of:

1. Uncalibrated monitor. After I coarsely calibrated my monitor, the picture seems to have become a bit better to the eye (might be placebo effect though).
2. Being used to fully saturated cyan and yellow representable by the monitor (i.e. #00ffff and #ffff00). This explains the perception of the dip near 570 nm, where the pure yellow should be and appears instead "dirty yellow". Similarly, the dip near 490 nm corresponds to the place where pure cyan is expected and instead "dirty cyan", almost cyanish-gray is observed.
3. Individual deviation from the standard observer. After observing a real spectrum from an incandescent bulb I'm under an impression that the blue dip is also present there. This may be simply wishful thinking though.

Overall, it seems that the most important of these factors is the 2: dirtiness of cyan and yellow as compared to what I've used to with my monitor. This is corroborated by the fact that both dips I perceive are exactly at the positions where GB/RG components are equal.