from Hacker News

Ask HN: Is there a way to solve this using Maths?

by m33k44 on 8/1/22, 9:16 AM with 8 comments

Say, I have this following relation:

output_value = (V0, V1, ..., Vn)

The output_value depends on the input values V0...Vn such that some values when reduced may increase the output_value, and some values when increased may decrease the output_value. On the otherhand, increasing some values may increase the output_value, and decreasing some values may decrease the output_value.

Each Vk value depends on two values Vk_X and Vk_Y. The change in these various Vk_X and Vk_Y values determine the value of Vk and hence affect the final output_value.

A very crude hypothetical example, where there is only one input value V0, could be:

pay_per_employee(V0) = profit(V0_X) / number_of_employees(V0_Y)

productivity = pay_per_employee

(There could be many values Vk that might affect the final productivity value, but I have shown just one value)

Other real-world example could be calculating credit score.

Is it possible to mathematically represent this type of relationship of multiple input values on the final output value? If yes, then what field of mathematics does this fall under?

Also, is there a way in mathematics to avoid divide-by-zero errors in equations?

  • by gxmw on 8/1/22, 4:57 PM

    This is what a mathematician would call a function. In particular a multivariate function. This comes up throughout mathematics, but particularly in algebra, calculus and analysis.

    If you want to look at how small changes in inputs affect the output ("sensitivity analysis"), multivariate calculus can help with that.

    If you want to find particular values of the V0, V1, etc which give the highest or lowest output value, that is called mathematical optimization. What kind of optimization (linear, quadratic, local, global etc) depends exactly on what your function looks like.

  • by ChrisLomont on 8/1/22, 1:01 PM

    Yes, this can be modeled mathematically, but you need a lot more details/conditions to get to an answer you'd like.

    If you know exactly the relations, you can simply write down the functions. If you're trying to guess or build a function from lots of data points, then you need to select a class of functions and optimize/minimize to get the best fitting one.

    There is not in general a way to avoid divide by 0. If your function is f(x) = 1/x, then at x=0 you will divide by zero.

    In some cases you can take limits (calculus) to "remove" divide by zero if there is a simple removable singularity. For example, if your functions looks like f(x) = x^2/x, then it has a 0/0 at x=0, which may trigger code crashes, but if you simplify that function to f(x)=x then the divide by zero is gone. Other issues may arise from floating point representations of real numbers. Note this problem is a huge, deep field with lots of nuance.

  • by signa11 on 8/1/22, 9:43 AM

    ''' Is it possible to mathematically represent this type of relationship of multiple input values on the final output value? If yes, then what field of mathematics does this fall under? '''

    most likely what you are looking for, falls broadly under the topic of linear algebra. if you are trying to optimize f.e. production of n-quantities each of which has a cost c[i] and profit p[i] and a bunch of other linear constraints, you probably are looking at simplex optimization (which falls under the topic operations-research).

  • by hyperhello on 8/1/22, 3:34 PM

    If you have the functions this is one kind of problem, but if you don’t it’s another.

    In EE we learned something called up-down analysis. Basically you turn a knob and see what happens to the result! Write down all the changes. Then you can at least get a sense of the change at a certain time.

    This is good for adjusting the angle of a platform with several screws, for example.

  • by rawgabbit on 8/2/22, 3:04 AM

    Multi variate statistics. https://en.wikipedia.org/wiki/Multivariate_statistics

    Typically performed by marketing research companies. What factor has the most impact on sales?

  • by jstx1 on 8/1/22, 9:25 AM

    Linear regression? - https://en.wikipedia.org/wiki/Linear_regression (look at the extensions for how to represent more complex relationships)
  • by hollowpython on 8/1/22, 2:14 PM

    If you have sufficiently many examples of this relationship (that is, input/output pairs) you can train a machine learning model with this data, and you will get (if successful) an explicit mathematical function which captures the relationship
  • by nonrandomstring on 8/1/22, 9:27 AM

    Sounds like you should start reading on Linear Algebra [1]

    [1] https://en.wikipedia.org/wiki/Linear_algebra