What's the symbol for "the power of 2"

How to print the symbol (^2) in text for Processing 3?

Thanks for the help.

1 Like

You can just paste it directly into your code.

background(0);
textSize(40);
textAlign(CENTER,CENTER);
text("2²", width/2, height/2);
1 Like

Hit AltGr + 2 in order to get a ². :wink:

2 Likes

Thanks for the quick reply!
None of these work though :frowning:

This project I’m working on is for a blood pressure and pulse pressure continuously monitoring device. I am using a pulse sensor: (https://cdn.shopify.com/s/files/1/0100/6632/files/Pulse_Sensor_Data_Sheet.pdf?14358792549038671331)

And with the visualizer I have created seen in the photo below I am also projecting the live “PP” in mmHg. But the numbers I am getting should be reduced to their square root, but I have been trying for days and as a beginner in Java and programming in general, it’s been impossible. So I decided to just project it as it is (unless you have the answer) and use the “to the power of 2” symbol, but typing “2²” or “\u00B2” just types all of it out on the visualizer. And using the AltGr + 2 doesn’t show anything.

Let me know if anyone can help.

Here’s what I currently see if I type “2²”

For that, just use sqrt(). The reference page has a whole section on math and calculations.

https://processing.org/reference/sqrt_.html

2 Likes