Three years after the president of Harvard, Lawrence H. Summers, got into trouble for questioning women’s “intrinsic aptitude” for science and engineering  and 16 years after the talking Barbie doll proclaimed that “math class is tough”  a study paid for by the National Science Foundation has found that girls perform as well as boys on standardized math tests.

Although boys in high school performed better than girls in math 20 years ago, the researchers found, that is no longer the case. The reason, they said, is simple: Girls used to take fewer advanced math courses than boys, but now they are taking just as many.

“Now that enrollment in advanced math courses is equalized, we don’t see gender differences in test performance,” said Marcia C. Linn of the University of California, Berkeley, a co-author of the study. “But people are surprised by these findings, which suggests to me that the stereotypes are still there.”

The findings, reported in the July 25 issue of Science magazine, are based on math scores from seven million students in 10 states, tested in accordance with the federal No Child Left Behind Act.