Numbers: How to find all relevant formula's variables

Hello, dear community and beautiful minds))

Im very suspicious and want to find all possible answers for single given formula.

Here are attached examples below.


Here is "B" column for the given variables, "C" column for the calculated results only.

If I do have numbers for "A" but do not for "N", how shall I convert the formula for C5 cell?

This example is only for illustration the dilemma of the converting methods.

I would like to find an optimal way to solve formulas like this.

If you have ANY suggestion like a website for conversion or your personal experience methods of the "Numbers" features, please, let me know.

Mac mini, macOS 12.5

Posted on Aug 28, 2022 2:52 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 28, 2022 3:58 PM

10 replies

Aug 29, 2022 4:34 AM in response to Vovchanok

Numbers does not have a "solver" capability. I think Excel can do it with with its Solver add-in. I tried it on this particular equation and it worked fine, getting an answer in a second or so. Excel might be your best solution unless someone has written a solver capability in AppleScript for Numbers. This same type of problem has come up occasionally but I don't recall anyone tackling it.

Aug 29, 2022 2:01 PM in response to Vovchanok

One other solution is to use Desmos.

https://www.desmos.com/calculator


Here is an example (not your function):



"y" is your "A"

"x" is your "n"

The first equation is the formula you are evaluating. The second is a straight line equal to the answer (y) for which you want to find x.

If you click on the intersection of the two on the graph, it gives you the coordinates. The answer in this case is -16.201.


Aug 29, 2022 1:38 PM in response to Vovchanok

With the caveat that I am not a mathematician and this method I am about to present may not actually work, below is a possible solution. It requires wisely choosing two starting points for "n". For the function you posted you don't have to be all that wise to choose the starting points but you do if the function has local minimums and maximums. If one point is on one side of a minimum/maximum and the other is on the other side, you might find a different answer or no answer. It will find only one answer for a given set of starting points, even if there are multiple answers.



A2 has an "n" value so we can calculate a value in B2. You could just type a number into cell B2 but I wanted to see if the method got the same "n" as I started with.


C2 and D2 are the other constants, typed in.


B2 =C2×(D2×(1+D2)^A2)÷((1+D2)^A2−1)

fill down to complete the column.


C3 = C2

D3 = D2

Fill down with both to complete the columns


A3 and A4 are two starting points you have to choose wisely.

A5 =IF($A3=$A4,$A4,FORECAST($B$2,$A3:$A4,B3:B4))

fill down from A5


For choosing the initial points, it might be helpful to make a chart of the function over a range of input values so you can see where the minimums and maximums are.





Aug 29, 2022 6:55 PM in response to Vovchanok

It appears you want to be able to choose which variable is missing and have the table calculate that missing variable. Then you want to be able to easily choose a different one and have it calculate that one instead. You can do that pretty easily with Excel's Solver.


The method I am using is pretty simple and blows up easily with discontinuous functions and those that go to infinity (like some of your examples when solving for n) unless you choose the initial points well. I suppose with a smarter algorithm that will take smaller jumps it might be more stable but it is still pretty simple. I have an idea that would make it easy to change which variable to solve for, just a couple of clicks on checkboxes, but it doesn't solve your discontinuous functions all that well so probably it isn't worth the effort.


Aug 29, 2022 4:42 PM in response to Badunit

Wow. You are such a pro. Thank you a lot for your time and passion.

Im very impressed))

Your first method is VERY clever, but cannot be quite corresponded to my case.

The second solution is sure discovery for me. It helps to find any variable of any given formula, but it cannot represent the formula (move "x" behind the equal sing) to make it possible to fill formula in the cell.

I want to attach a very simple example of how it should look like below.

This is an example of what I succesfully converted by myself. BUT I do have other more complex formulas that I cannot convert.


Few examples of my brainstorm)

Although, I know that Numbers provide relevant formulas for me, but they also have only one way solution and cannot be interpreted as I would like to.


Again, thank you for your excellent job, wish you the best! 🙏🏻

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Numbers: How to find all relevant formula's variables

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.