# Can simpleFunction use predefined variables

**URL:** <https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335>\
**Category:** Questions\
**Tags:** simplefunction\
**Created:** [October 27, 2025, 12:04pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335 "2025-10-27T12:04:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 27, 2025, 12:04pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/1 "2025-10-27T12:04:29Z")

</div>

Say I have this code:

```auto
A = 1
B = 2
C = 3
e = simpleFunction("A+B+C+x", "x")
# Would 'e' equal 6+x or nothing?
# Also I was wondering if I should do:
# e = simpleFunction("${A}+${B}+${C}+x", "x")

```

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 27, 2025, 1:29pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/2 "2025-10-27T13:29:44Z")

</div>

Yes to your second version of `e`. The first would not evaluate.

In general, the `“x”` argument is unnecessary because `simpleFunction()` defaults in terms of x. The variable arguments are only required if it is a variable other than x or there are more than one independent variable.

---

<div class="post-metadata">

**Author:** ![SteinSchreiber](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/steinschreiber/32/2267_2.png) [@SteinSchreiber](https://cl.desmos.com/u/SteinSchreiber)\
**Post date:** [October 27, 2025, 3:04pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/3 "2025-10-27T15:04:50Z")

</div>

Seems like “e” works in CL, but if you move it to a graph as a function. It will make “e” the constant 2.71828182846… instead of the function.

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 27, 2025, 6:50pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/4 "2025-10-27T18:50:40Z")

</div>

Thanks! Also I did forget that `simpleFunction` is default to variables `x` and `y`.

For @SteinSchreiber’s response, yes you are correct, but I was just making a quick example variable to ask the question

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 27, 2025, 7:51pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/5 "2025-10-27T19:51:05Z")

</div>

> [@NTMDev](#):
>
> I did forget that `simpleFunction` is default to variables `x` and `y`.

Actually, don’t think of it in terms of x _ **and y** _. It’s any function or isolated variable defined in terms of x.

So, all of these as input entries…

```auto
3x+5
y=3x+5
f(x)=3x+5
d=3x+5
m=3x+5
h(x)=3x+5

```

… would be valid and evaluable for this:

```auto
myFunction = simpleFunction(this.latex)

```

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 27, 2025, 7:53pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/6 "2025-10-27T19:53:30Z")

</div>

I think “e” just happened to be the name chosen for the function and the question was about how to write the expression for the `simpleFunction()`, not about how the character `e` is evaluated.

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 27, 2025, 8:22pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/7 "2025-10-27T20:22:26Z")

</div>

But how would CL “find” the `h` in:

`h(x)=3x+5`?

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 27, 2025, 9:23pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/8 "2025-10-27T21:23:52Z")

</div>

What do you mean by “find”? It’s just function notation. It doesn’t work if it’s on the right hand side. For example, the following is invalid and can’t be evaluated with the same `simpleFunction(this.latex)`:

```auto
3x+5=h(x)

```

Basically, if you could write the function in the calculator (in terms of x) then it’ll work for `simpleFunction()`. Your function names can even have subscripts:

```auto
m_{yFunction}(x)=3x+5

```

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 28, 2025, 12:49am UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/9 "2025-10-28T00:49:55Z")

</div>

Ah yes. Your second part answered my question. What I meant by “find” was how CL would know that `h` is a user-defined function, not just another variable that is being multiplied by `x` (Since some people write multiplication as `a(b)`).

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 28, 2025, 1:37pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/10 "2025-10-28T13:37:36Z")

</div>

Function notation takes precedence over multiplication… on the left hand side of an equation.

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 28, 2025, 4:18pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/11 "2025-10-28T16:18:57Z")

</div>

Okay I didn’t know that. Pretty cool! Again.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/f/f5bd144684474e9a2f333002cde9840e52c5dbd3.png) [@system](https://cl.desmos.com/u/system)\
**Post date:** [October 30, 2025, 4:19pm UTC](https://cl.desmos.com/t/can-simplefunction-use-predefined-variables/8335/12 "2025-10-30T16:19:48Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
