# Mathematic Function

**URL:** <https://discourse.nodered.org/t/mathematic-function/10178>\
**Category:** General\
**Created:** [15 April 2019 14:59 UTC](https://discourse.nodered.org/t/mathematic-function/10178 "2019-04-15T14:59:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aabbas](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@aabbas](https://discourse.nodered.org/u/aabbas)\
**Post date:** [15 April 2019 14:59 UTC](https://discourse.nodered.org/t/mathematic-function/10178/1 "2019-04-15T14:59:10Z")

</div>

Hi,  
I have 2 msg.payload A and B and I want to insert after a function like (A+B)/(A-B), but I don't know how to define each msg.payload.

Thank you for your help.

![A](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2a883bf400969114924444f25ca2cb7eb200e9d0.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [15 April 2019 15:04 UTC](https://discourse.nodered.org/t/mathematic-function/10178/2 "2019-04-15T15:04:12Z")

</div>

Each function is independent, so function A knows nothing of function B and v.v.

So you can either loom at joining the two flows together (look at the join node) or use a context variable.

Where a flow can read a special variable from another flow. Take a look at the context variable part of the documentation and take a look at the cookbook which contains some examples ([cookbook.nodered.org](http://cookbook.nodered.org))
