Forum Documentation Showcase Pricing Learn more

How to use trigonometry like in Excel? (cosine, sine, etc.)


#1

How do I do trig calculations in Bubble?

Can I accomplish this with a plugin? Do I need to learn Javascript?

I’m converting an existing Google Sheet into a web app. The app will import data from an uploaded file, complete various calculations, and display the data in a chart. I could share the entire sheet here if that would help, but here’s an example of one of the functions I would need to replicate in Bubble:
IF((ABS(B10-D10)<20),20*LOG10(SQRT((((10^(B10/20))*COS(RADIANS(C10))+(10^(D10/20))*COS(RADIANS(E10)))^2)+(((10^(B10/20)*SIN(RADIANS(C10)))+(10^(D10/20)*SIN(RADIANS(E10))))^2))),""))


#2

Yeah, fundamental JS would be useful for you in this case, HOWEVER that’s not really necessary, it’s very likely that such can be achieved through the math.js (local) plugin.


#3

Oh, really? My understanding was that MATH.js had no trigonometry, but now I’m looking at the documentation more closely and I see that I include example like
math.eval('cos(45 deg)') // 0.7071067811865476

I wonder why there is no complete list of mathematical functions it support. I guess I’ll need to look into it further. Thank you @vini_brito !