How can i represent ((a^2)+(b^2))^0.5?
How can i without a*a
How can i represent a^0.5 in java
OK, represent this in java language: a^n
What is the subtopic i put?
@camperextraordinaire Is it the same as
(Edit of an edit as was accepted solution:)
The exponentation operator is **
in JS – n ** pow
where n is the number and pow the power to raise it by.
ok, thank u @DanCouper , about the other he didnt go on point.
I get your point. Just want to know if I’m understanding it since it’s been long time let alone to see it written that way. Thanks
You ignored the point though!
im in mathematics curse, i k that, i am here to k how to represent in javascript
Like u said there are different forms of languages i can represent here and in another language i need another way-im am here to k the most simple solution of a problem (i did only have one class od programm so i dont k anything.
a. The **
and similar are syntactic sugar, a programming convenience. You should actually understand how to write it out without using that, or by using other similar constructs if you’re trying to understand how to write programs
b. Raising to the power of 0.5 is not the most common way this equation is normally described, and as such is not normally the way you would see this written down in a programming lang.
@DanCouper but if u give the exmple with 0.5 i will k how to do with 0.6
This is true, but this suggests you don’t know what the common form of this equation is? As in why you’re raising it to the power of 0.5?
i dont k how to do root of 2 in the language so i came here give this example to k that and to k how i do exponencials
Edit: you meant 2, ignore
i had already correct that
@camperextraordinaire when u said he didn’t go on point because of a^2 = a * a, if you look to his responses he did say “How can i without a * a”, and you know that different languages have differents ways of write things. He just wants to k how he can represent in javascript.
Yep, sorry, saw as you were correcting it!
If you need it, Javascript’s built-in global Math
object is the namespace under which most other maths stuff you’d want lives, just for reference. Everything under it is either a constant, which you use like Math.PI
, Math.E
(which are going to give you approximate values for Pi and E respectively), or a function you use like Math.pow(2, 2)
(same as 2 ** 2
), Math.sqrt(2)
(there’s your 2 ** 0.5
), and so on