# Math app, need help with calculations

**URL:** <https://forum.bubble.io/t/math-app-need-help-with-calculations/37414>\
**Category:** Questions\
**Created:** [September 6, 2018, 1:09pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414 "2018-09-06T13:09:46Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgq](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jgq/32/28488_2.png) [@jgq](https://forum.bubble.io/u/jgq)\
**Post date:** [September 6, 2018, 1:09pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/1 "2018-09-06T13:09:46Z")

</div>

Hello

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?

---

<div class="post-metadata">

**Author:** ![vini\_brito](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vini_brito/32/22187_2.png) [@vini\_brito](https://forum.bubble.io/u/vini_brito)\
**Post date:** [September 6, 2018, 4:15pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/2 "2018-09-06T16:15:29Z")

</div>

Hi!

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?

---

<div class="post-metadata">

**Author:** ![RonyjM](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@RonyjM](https://forum.bubble.io/u/RonyjM)\
**Post date:** [September 6, 2018, 7:23pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/3 "2018-09-06T19:23:06Z")

</div>

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!  
regards

---

<div class="post-metadata">

**Author:** ![jgq](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jgq/32/28488_2.png) [@jgq](https://forum.bubble.io/u/jgq)\
**Post date:** [September 7, 2018, 5:52am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/4 "2018-09-07T05:52:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jgq](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jgq/32/28488_2.png) [@jgq](https://forum.bubble.io/u/jgq)\
**Post date:** [September 7, 2018, 5:53am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/5 "2018-09-07T05:53:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gilles](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gilles/32/40660_2.png) [@gilles](https://forum.bubble.io/u/gilles)\
**Post date:** [September 7, 2018, 11:22am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/6 "2018-09-07T11:22:33Z")

</div>

Hi

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

---

<div class="post-metadata">

**Author:** ![jgq](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jgq/32/28488_2.png) [@jgq](https://forum.bubble.io/u/jgq)\
**Post date:** [September 7, 2018, 11:43am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/7 "2018-09-07T11:43:35Z")

</div>

where do I find that?

---

<div class="post-metadata">

**Author:** ![gilles](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gilles/32/40660_2.png) [@gilles](https://forum.bubble.io/u/gilles)\
**Post date:** [September 7, 2018, 12:56pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/8 "2018-09-07T12:56:08Z")

</div>

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

![image](https://us1.discourse-cdn.com/bubble/original/3X/0/9/097b832b359e77b4a867a29981bf010de8919f74.png)

---

<div class="post-metadata">

**Author:** ![RonyjM](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@RonyjM](https://forum.bubble.io/u/RonyjM)\
**Post date:** [September 7, 2018, 3:58pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/9 "2018-09-07T15:58:51Z")

</div>

1 and 2. ![25](https://us1.discourse-cdn.com/bubble/original/3X/a/8/a81273c3313b876a14bba5be4e2a18b63b25ff83.png)

3  
a. install de plugin  
b. drag math.js element to your page  
c. insert expression  
 ![27](https://us1.discourse-cdn.com/bubble/original/3X/4/7/47cd898fb4e9c6092e4ac3997599be3b099edd88.png)

1. Print your result  
 ![46](https://us1.discourse-cdn.com/bubble/original/3X/6/1/619994dfb0fbb0831bd02b87b9bb2c32482c0e35.png)

Best regards

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [September 7, 2018, 4:05pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/10 "2018-09-07T16:05:04Z")

</div>

^ 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:

[http://mathjs.org/](http://mathjs.org/)  
[http://mathjs.org/docs/index.html](http://mathjs.org/docs/index.html)  
[http://mathjs.org/examples/index.html](http://mathjs.org/examples/index.html)

---

<div class="post-metadata">

**Author:** ![rachel.camp900](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rachel.camp900](https://forum.bubble.io/u/rachel.camp900)\
**Post date:** [October 31, 2018, 2:29pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/11 "2018-10-31T14:29:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [October 31, 2018, 2:40pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/12 "2018-10-31T14:40:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rachel.camp900](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rachel.camp900](https://forum.bubble.io/u/rachel.camp900)\
**Post date:** [October 31, 2018, 2:46pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/13 "2018-10-31T14:46:37Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/4/b456318431530bec091e5bf4798f1c966b7dbc38.png)

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [October 31, 2018, 8:05pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/14 "2018-10-31T20:05:23Z")

</div>

:sum is a list operator documented here:

> **[Bubble Reference](https://bubble.io/reference#Data.Messages.list.sum)**
>
> Full reference for each Bubble element, feature, plugin. Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

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.

---

<div class="post-metadata">

**Author:** ![rachel.camp900](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rachel.camp900](https://forum.bubble.io/u/rachel.camp900)\
**Post date:** [November 7, 2018, 9:55am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/15 "2018-11-07T09:55:24Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/1/714e2ae3d6fd85206b2d95efd0d2ffbd3f8582ce.jpeg)

**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.

![image](https://us1.discourse-cdn.com/bubble/original/3X/f/d/fde045abdfd52dbe983c2d70da8bf087f84fbb62.jpeg)

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.

![image](https://us1.discourse-cdn.com/bubble/original/3X/7/f/7ff3ab85255ce8a825b153b54411a29c9c8f0f0d.jpeg)

---

<div class="post-metadata">

**Author:** ![rachel.camp900](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rachel.camp900](https://forum.bubble.io/u/rachel.camp900)\
**Post date:** [November 7, 2018, 10:27am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/16 "2018-11-07T10:27:32Z")

</div>

Hi,

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

Best,

Rachel

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [November 7, 2018, 4:21pm UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/17 "2018-11-07T16:21:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rachel.camp900](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rachel.camp900](https://forum.bubble.io/u/rachel.camp900)\
**Post date:** [November 8, 2018, 10:08am UTC](https://forum.bubble.io/t/math-app-need-help-with-calculations/37414/18 "2018-11-08T10:08:30Z")

</div>

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.

![image](https://us1.discourse-cdn.com/bubble/original/3X/e/a/eab352a246da7c57a701c856e9d82e34b12703b9.jpeg)
