Math app, need help with calculations


I found Bubble and I am very impressed. I am a math teacher and I have a hard time making calculations beyond fixed numbers.

For example I would like to make a simple pythagoras triangle calculator.
The student gives the two sides a and b via input fields.
The page should now calculate c via squareroot of a squared plus b squared and display it in a text.

I tried using the math.js too, but also did not succeed.

Can you please help me?


What exactly have you tried and where in the process are you stuck? I mean, what is already done? Can you share a link to the app?

Hi @jgq
the process basically its simple and always the same, the important part is the expression:

  1. create inpus ( A and B)
  2. create a Text for your result
  3. in math.js plugin insert the expression : inputA value^2 + inputB value^2 (or whatever u need)
  4. back to your text result and add expression: math.js a´s result (numbers)

hope this help, Let me know!

It does help, I just cant find out how to make your point 3. Can you elaborate?

Vini_brito: I tried to do exactly as Rony explained. I just cant make the calculation work in either text-field calculated or with math.js.


Try CoBubble ‘s instant calculator. It’s free and very easy to use. It works very similar to excel functions.

1 Like

where do I find that?

Just search the the third party “plugins” for “Components”.


1 and 2. 25

a. install de plugin
b. drag math.js element to your page
c. insert expression

  1. Print your result

Best regards


^ This. There’s nothing else to know, really… Except for complete documentation on the functions, features, and syntax of math.js, refer to its documentation:

1 Like

None of the examples are in bubble. Do i just duplicate in bubble?

Right, you write expressions in the syntax described in that documentation. Just have a mess about with it!

This is a lot harder than i anticipated.

Have you had any luck with the :sum function in bubble? The definition is not in the reference material.

I am trying to create a billing system. I have learnt how to count the number of dates within a range. Now i would like to sum up the total cost to the customer withing that range.

There is a print screen below of what I was attempting. I can get the median function to work but I do not know why :sum will not work.

:sum is a list operator documented here:

It works on lists of numbers. Here’s the thing to check: Is the result of your search a list of numbers? Maybe it isn’t. (Can you really do :median on the same list?)

As I’ve suggested to you before, just plop down a repeating group as a way of visualizing the results of your search. Make that RG’s source the Search you’re trying to get a handle on.

In this case, make an RG with source Search for Calendar Eventss’s Full price ticket

The issue checker will tell you immediately what data type that resolves to. (It’ll throw the pop-up that says, "hey, you made your source ‘X’, do you want to set the data type for this RG to X’s data type?) Further, you can just plop down a text element inside the cell of that RG to show you what the individual values are.

(Like, if it is a list of numbers, you can plop down a text element and use it to display Current Cell’s value. This is how you can visualize your lists while you’re developing.

You’ll also see, instantaneously, if perhaps you forgot what the “Full price ticket” field really is. Maybe the cost of the ticket is a subfield or something.)

Then, you can play around with how you might get to the result you’re looking for. Put a text element somewhere outside of the repeating group. Make its contents a dynamic expression like Repeating Group’s list of whatevers:sum)

This is how you can go about troubleshooting complex searches – build it up interactively until you get comfortable. Basically, stop thrashing and imagining what’s going on and just visualize it.

Hi Keith,

I have been copying your example of visualizing my work. What I am getting stuck on is creating the logic that will enable the repeating group to show data that sits within a range.

I cannot seem to get the overlaps function or any function that will allow some constraints of this nature. I have a drop down that the user can select the date range - this can be used to refine the RG - but I will still need the logic that allows for that analysis.

Attempt two - why will it not let me select the result of my drop down menu that allows me to select the range I am interested in. It is called term selector and it is blocked in the print screen below.


I am also getting confused on knowing when the reference material refers to a list - or a list of individual things. Should the :sum function work on both? When I could not get the :sum function to work I assumed that it is didn’t so I ended up creating all these duplicate list fields.



Do you know what <> does? I have not been able to wrap my head around this or get it to work.



That means “not equal to” it returns true (yes) if the things on left and right are not identical. It returns false (no) if the compared things are identical.

Thank you.

For anyone else reads this thread in the future I found a solution.

  1. The drop down I was using to filer was using the name of the date range and not the date range itself. It is not ideal but at least i can get…
  2. the repeating table to filter correctly. Please see print screen below.