This article is an author's and AI-assisted translation of russian one ( https://habr.com/ru/articles/864770/ ) into English

The Story
Once upon a time, in 2024, in one southern but near country, my help was needed to repair/preventive maintenance an approximately 12-year-old atomic absorption spectrometer(AAS) of Asian origin.
I had never seen such a device before (having previously worked with Shimadzu, Agilent/Varian, Thermo, Perkin Elmer and Analytic Jena), but I quickly figured it out. Overall, the device was functional and with interesting approaches, but I encountered a calculation error. Here's the gist of it: The device, essentially a spectrophotometer, measures optical density—absorption (ABS) at a given wavelength. (It’s a bit more complex, but that’s not crucial right now.) We introduce solutions with known concentrations (CON) of an element (e.g., manganese), correlate ABS with CON, and construct a calibration graph using either a linear or quadratic approximation (via the least squares method).

When measuring an unknown sample, the device provides an ABS value, and using the graph, we calculate CON, which is taken as the measurement result. Seems simple enough.
If the dependence is linear, everything works fine. However, when specifying a quadratic relationship, there are two possible approaches: ABS(CON) or CON(ABS):
A1⋅ABS^2+B1⋅ABS+C1=CON
A2⋅CON^2+B2⋅CON+C2=ABS
In the first case, the concentration in the unknown sample is directly computed as a second-degree polynomial of absorption.
In the second case, determining the concentration requires solving a quadratic equation.

For some reason, the special Asian programmers opted for the second approach. Moreover, they disliked negative concentration values so much (even the smallest ones) that they discarded the negative root and always selected the positive one. As a result, introducing pure water (Sample2) into the device yielded a result significantly higher than the upper calibration point (e.g., 2.7572 on a scale from 0.0 to 1.0). This corresponds to the second intersection of the parabola with the X-axis.
What to Do?
The correct approach would be to contact the manufacturer, as only their programmers could fix this error. I received an updated software version. It seemed logical that I wasn’t the only one to discover this mistake—after all, the manufacturer had produced around 100, maybe 1,000, or even 10,000 of these devices over 12 years. Surely others had encountered the same issue, and it must have been fixed, right?
Turns out, no—it wasn’t fixed. They claimed no newer software version existed.
I only communicated through a representative, but even for necessary spare parts, I haven't received any offers yet. As for software issues, I was told such inquiries are often ignored. I’ve heard similar complaints about working with manufacturers from "over there."
(Note: now I'm connected to the representative of the company itself, and everything seems better)
Now, let’s speak metaphorically, just in case. Most likely, none of this actually happened, and it’s all just someone's dream. All details are fictional, and any coincidences are purely accidental.
Somehow, the inner workings of the program became visible, and upon examining them, I pinpointed the error:
case FittngMethod.Square:
if (crCurveAbs.ParamB * crCurveAbs.ParamB - 4.0 * (crCurveAbs.ParamA * (crCurveAbs.ParamC - avgAbs)) < 0.0)
return 0.0;
double num1 = Math.Sqrt(crCurveAbs.ParamB * crCurveAbs.ParamB - 4.0 * (crCurveAbs.ParamA * (crCurveAbs.ParamC - avgAbs)));
double num2 = (0.0 - crCurveAbs.ParamB - num1) / (2.0 * crCurveAbs.ParamA);
double num3 = (0.0 - crCurveAbs.ParamB + num1) / (2.0 * crCurveAbs.ParamA);
double num4 = 0.0;
if (num2 < 0.0 && num3 < 0.0)
num4 = 0.0;
else if (num2 < 0.0)
num4 = num3;
else if (num3 < 0.0)
num4 = num2;
else if (crCurveAbs.ParamA < 0.0)
{
if (num2 < num3)
num4 = num2;
else if (num3 < num2)
num4 = num3;
}
else if (num2 < num3)
num4 = num2;
else if (num3 < num2)
num4 = num3;
return num4;
Did you recognize the quadratic equation formula from high school? Well, it shouldn’t even be here—it’s just a matter of properly choosing the axes.
The Fix
By swapping the axes on the graph and correcting the concentration calculation formula, all this unnecessary clutter (lines 8–23) with discarding negative values was removed. And suddenly, everything started working correctly!

The meaning, units, and coefficients of the polynomial changed. The calculated value became positive, but even small negative values no longer turned into absurdly large ones. All the problematic code was replaced with this:
case FittingMethod.Square: // DONE: fixed
return corCurveAbs.ParamA * avgAbs * avgAbs +
corCurveAbs.ParamB * avgAbs +
corCurveAbs.ParamC;
Other Issues
More strange bugs were discovered. For example, when selecting "median," the program wouldn't allow creating a "method," instead displaying an unclear error. Understanding the program’s structure helped debug and resolve this issue.
Additionally, I found a way into the service mode, though it was completely untranslated.

That issue was also resolved. A Python script was written to extract Chinese text, convert it into a plain-text file, translate it via Google Translate, and adjust it so that English strings fit within the space of the original characters. Some words had to be shortened, but at least things became readable.

There’s probably a better way to translate it, but this was a quick fix. It’s crude, but at least now it’s usable.
Final Thoughts
Once again, everything described above is purely fictional. The images were probably generated by "bitten intelligence" (AI), and the probability of such coincidences is incredibly low. (For instance, if the program had been written in C++ or Delphi, reversing it would have been much harder.) A service engineer's job is to replace major components, configure software and hardware according to the manufacturer's approved methods.
Component-level repairs and software fixes? That’s pure fantasy—more like science fiction.
This "dream" led to a deeper understanding of C#, a grasp of someone else’s large project, and a practical solution that allows people to fully use the device.
The Bigger Picture
Manufacturers should be interested in making their equipment as good as possible, so that users recommend it to their colleagues. I could enhance their software, adding classic analytical techniques (e.g., multiple dosing into a graphite cuvette for concentration, increased sensitivity, and lower detection limits, or other "tricks" with expired patents). But that would mean I’m helping an Asian manufacturer reach a respectable global level.
On the other hand, Shimadzu, Agilent, Thermo, Analytic Jena, (Bruker, Perkin Elmer) haven’t offered me a job, so why should I care?
What would you suggest?
Future Prospects
I’ve long outgrown being just a service engineer. I tried broadening my expertise—studying the internal structure and software of all available manufacturers. I can compare devices based on all significant parameters, recognizing the strengths and weaknesses of their designs.
If the pay were decent, I’d love to be a research engineer—developing new technologies and working with a team of designers to create devices for their implementation. I have a solid background in math for ML/DS and have already started moving in that path.