Skip to main content
Question

weird merit function bug (and 2 workarounds)

  • April 17, 2026
  • 0 replies
  • 7 views

Forum|alt.badge.img
  • Fully Spectral

I stumbled today on this and thought I would share the bug and workarounds as it may hit someone else one day (OpticStudio 2026 R1.00 on Windows 11).
I wanted to multiply the beam X and Y widths from POP by a constant (to have the FWHM) and thought I could use PROB for that. Here is what the merit function returned:

No issue with the POPD computation. However, as you may notice on rows 14 and 20, Zemax thinks that 0.0328921 and 0.0369547 multiplied by 0.849 is 0.
I decided to move the multiplications as the bottom all together (tried with and without a CONF 1 without change) and found that Zemax is still confused (at row 23)

Here are the 2 workarounds I have found:

1- instead of multiplying by 0.849, divide by its inverse (1.177). DIVB seems to be fine with it


2- introduce a constant with the value and use PROD to multiply the operands by the constant operand

 

Not being a programmer, I would assume that there is some threading issue and that PROB does not wait for the result of POPD (which is not an instant algorithm). The workarounds may be just luck or DIVIB and PROD implementation is better.