K
K
kr_ilya2020-09-25 16:30:12
JavaScript
kr_ilya, 2020-09-25 16:30:12

How to write a dependency formula?

There is a form in which the user himself chooses the parameters
5f6def85ac2f5699742863.png

"Percentage" can take the maximum and minimum values, that is, it is in a certain range. (not +-infinite)

You need to calculate this percentage value depending on the amount and term values. If the term increases, the percentage decreases; if the amount increases, the percentage also increases and vice versa.

In this case, it is necessary to take into account when one of the parameters is unchanged. I've been scratching my head for several days, nothing good comes out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-09-25
@ProgrammerForever

If the term increases, the percentage decreases

p ~ 1/t
Percentage is inversely proportional to time
if the amount increases, the percentage also increases

p ~ m
The percentage is proportional to money
If we combine both thoughts, we get
p=k*m/t;
m - money
t - time
k - a certain coefficient of proportionality, selected experimentally or from considerations of boundary conditions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question