-4

I've got these 2 Java variables:

spiEuler = spiEuler + (1 / Math.pow(2 * k + 1, 2));
piEuler = Math.sqrt(spiEuler * 8);

...and I'd like to combine them into one. Unfortunately,

piCombined = Math.sqrt((xPi + (1 / Math.pow(2 * k + 1, 2))) * 8);

doesn't do that. What did I do wrong here?

Fabian Stern
  • 85
  • 1
  • 5

1 Answers1

0

the most you can get is

spiEuler += (1 / Math.pow(2 * k + 1, 2));

and then

piEuler = Math.sqrt(spiEuler * 8);
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97