Help with a Math formula i can´t figure out..

zyndro

New member
Joined
Nov 19, 2019
Messages
6
Hello there !


I'm new here and i'm looking for guidance.

I'm honest.. i'm not good at Math ( i wish ! ) and i need help trying to figure out a formula for a simple calculation ( i hope is simple.. )

The case is this:


I have an initial increasing constant number which is 85 and the final number which is 95.

The produc result of the formula should be.. 0.5 for 85 and 0.3 for 95.

as the 85 increases the result decreases Being as:

85 ( unknown formula ) = 0.5
85.1 ( unknown formula ) = 0.49
85.2 ( unknown formula ) = 0.48
85.3 ( unknown formula ) = 0.47
..
..
..
..
95 ( unknown formula ) = 0.3


I've been trying so hard guys, seriously but i can't figure out.

If you can throw any light i'll really appreciate it !!


Best Regards !!
 

Jomo

Elite Member
Joined
Dec 30, 2014
Messages
4,797
I am not understanding this at all. Is this the exact problem as given to you? I get confused when I hear that an increasing constant is changing from 85 to 95. Constants do not change, that is why they are called constants.
 

firemath

Junior Member
Joined
Oct 29, 2019
Messages
197
Is this a series?
 

Romsek

Full Member
Joined
Nov 16, 2013
Messages
510
The problem here is that the first values of this relation suggest a function for the first 4 values shown that does not match that of the last one.

Given the first four values it looks pretty obvious that

\(\displaystyle f(x) =0.5 - \dfrac{85-x}{10}\)

but then \(\displaystyle f(95) = -0.5 \neq 0.3\)

If OP wants a delta of 10 to correspond to a delta of -0.2 then the correct formula is

\(\displaystyle f(x) = 0.5 - \dfrac{x-85}{50}\)

\(\displaystyle f(85) = 0.5,~f(95) = 0.3\) but the intermediate values don't match what you wrote.

See if this formula does it for you.
 

zyndro

New member
Joined
Nov 19, 2019
Messages
6
hello again !

OMG you guys are awesome, thanks for taking time to read and comment.

@Jomo: you are right, my bad ! is not constant, it's increasing, think in 85 like a counter increasing every second.

@firemath: Series ? don't understand what you mean, can you elaborate little more please ?

@Romsek: Thanks correct ! the results in intermediate are not exact, were just examples of the "process" so you guys could get and idea how the process was.

I think the correct way to express should be:

as the 85 increases the result decreases Being as:

85 ( unknown formula ) = 0.5
85.1 ( unknown formula ) = x
85.2 ( unknown formula ) = x
85.3 ( unknown formula ) = x
..
..
..
..
95 ( unknown formula ) = 0.3


Thank you so much guys again for the help !!
 

HallsofIvy

Elite Member
Joined
Jan 27, 2012
Messages
5,434
Given 5 values (f(85)= 0.5, f(85.1)= 0.49, f(85.2)= 0.48, f(85.3)= 0.47, and f(95)= 0.3) there exist a unique fourth degree polynomial giving those five values. It can be calculated from "Newton's divided difference formula: \(\displaystyle f(x)= 0.5\frac{(x- 85.1)(x- 85.2)(x- 85.3)(x- 95)}{(85- 85.1)(85- 85.2)(85- 85.3)(81- 95)}+
0.49\frac{(x- 85)(x- 85.2)(x- 85.3)(x- 95)}{(85.1- 85)(85.1- 85.2)(85.1- 85.3)(85.1- 95)}+
0.48\frac{(x- 85)(x- 85.1)(x- 85.3)(x- 95)}{(85.2- 85)(85.2- 85.1)(85.2- 85.3)(85.2- 95)}+
0.47\frac{(x- 85)(x- 85.1)(x- 85.2)(x- 95)}{(85.3- 85)(85.3- 85.1)(85.3- 85.2)(85.3- 95)}+
0.3\frac{(x- 85)(x- 85.1)(x- 85.2)(x- 85.3)}{(95- 85)(95- 85.1)(95- 85.2)(95- 85.3)}\).

As others have pointed out, the first 4 values are given by a simple linear function but the last value does not fit that.
 

zyndro

New member
Joined
Nov 19, 2019
Messages
6
@Hallsoflvy Thanks!

I think i haven't expressed myself in a right way

the only values that i know by fact are

85 ( unknown formula ) = 0.5

and

95 ( unknown formula ) = 0.3


the 85 is an increasing variable, as the variable increases, the result decreases, at the end variable will be 95 and the result 0.3


it's like i know the starting value 85 and the starting result 0.5


and i know the final value 95 and the final result 0.3


what i can't figure out is a formula to calculate that


sorry if i can't explain myself, i'm terrible for this 😰

but i do appreciate your answers !!

Thanks !
 

Dr.Peterson

Elite Member
Joined
Nov 12, 2017
Messages
5,556
@Jomo: you are right, my bad ! is not constant, it's increasing, think in 85 like a counter increasing every second.
@Romsek: Thanks correct ! the results in intermediate are not exact, were just examples of the "process" so you guys could get and idea how the process was.

I think the correct way to express should be:

as the 85 increases the result decreases Being as:

85 ( unknown formula ) = 0.5
85.1 ( unknown formula ) = x
85.2 ( unknown formula ) = x
85.3 ( unknown formula ) = x
..
..
..
..
95 ( unknown formula ) = 0.3
There's a lesson here: When you ask math people for help, never give us fake data. We will assume it is truth, and run with it. Just tell us what you really know, and what you really need. You don't have to use math terms (and shouldn't, if you don't know what they mean!), but say it accurately.

It appears that all you want is a function f such that f(85) = 0.5, and f(95) = 0.3. You may or may not really need a linear function (that is, one that decreases at a constant rate), but that is the easiest to make for you (the second attempt in post #4). If we knew something of the context, we might have a better suggestion.
 

zyndro

New member
Joined
Nov 19, 2019
Messages
6
There's a lesson here: When you ask math people for help, never give us fake data. We will assume it is truth, and run with it. Just tell us what you really know, and what you really need. You don't have to use math terms (and shouldn't, if you don't know what they mean!), but say it accurately.

It appears that all you want is a function f such that f(85) = 0.5, and f(95) = 0.3. You may or may not really need a linear function (that is, one that decreases at a constant rate), but that is the easiest to make for you (the second attempt in post #4). If we knew something of the context, we might have a better suggestion.

Sorry about that, i was trying to explain myself !

How about this:



The only values that i know by fact are

85 ( unknown formula ) = 0.5

and

95 ( unknown formula ) = 0.3


the 85 is an increasing variable, as the variable increases, the result decreases, at the end variable will be 95 and the result 0.3


it's like i know the starting value 85 and the starting result 0.5


and i know the final value 95 and the final result 0.3


what i can't figure out is a formula to calculate that



Best Regards !
 

HallsofIvy

Elite Member
Joined
Jan 27, 2012
Messages
5,434
As I said before, if you have n data points there exist a unique n-1 degree polynomial that gives all n. If there really are only two data points then there exist a unique first degree polynomial (linear function) that gives those points (or- a line is determined by two points). Any linear function can be written as y= ax+ b. If y= 0.5 when x= 85 then 0.5= a(85)+ b. If y= 0.3 when x= 95 then 0.3= a(95)+ b. Subtracting the second equation from first eliminates b and gives 0.2= a(-10) so a= 0.2/(-10)= -0.02. Putting a= -0.02 into 0.5= a(85)+ b gives 0.5= (-0.02)(85)+ b or 0.5= -1.7+ b so b= 0.5+ 1.7= 2.2. y= -0.02x+ 2.2.

Checking, y(85)= -0.02(85)+ 2.2= -1.7+ 2.2= 0.5 and y(95)= -0.02(95)+ 2.2= -1.9+ 2.2= 0.3.

I don't know where you got those other numbers but, using y= -0.02x+ 2.2, y(85.1)= -0.02(85.1)+ 2.2= -1.702+ 2.2= 0.498, y(85.2)= -0.02(85.2)+ 2.2= -1.704+ 2.2= 0.496, etc.

y= -0.02x+ 2.2 is the simplest function that gives those points. Of course, there are an infinite number of more complicated functions that will fit those two points.
 

zyndro

New member
Joined
Nov 19, 2019
Messages
6
@HallsofIvy Thanks a Lot !!!

That's the function i was looking for !!

y= -0.02x+ 2.2

Totally fits what i was looking for, you guys are amazing and have my biggest Respect. Seriously.

I wish my brain could figure out those answers, may i ask how you guys find out the formula ?

is this the answer ?
if you have n data points there exist a unique n-1 degree polynomial that gives all n. If there really are only two data points then there exist a unique first degree polynomial (linear function) that gives those points (or- a line is determined by two points). Any linear function can be written as y= ax+ b. If y= 0.5 when x= 85 then 0.5= a(85)+ b. If y= 0.3 when x= 95 then 0.3= a(95)+ b. Subtracting the second equation from first eliminates b and gives 0.2= a(-10) so a= 0.2/(-10)= -0.02. Putting a= -0.02 into 0.5= a(85)+ b gives 0.5= (-0.02)(85)+ b or 0.5= -1.7+ b so b= 0.5+ 1.7= 2.2. y= -0.02x+ 2.2.

Because i've read that like 10 times slowly and totally focused and still can't understand it.

Awesome. Thanks a million !
 

zyndro

New member
Joined
Nov 19, 2019
Messages
6
So the reason why i needed that calculation is because i'm working on a videogame on my freetime, a personal solo project and i'm doing the day/night cycle, so when the day's time gets to 85% the ambient light must decrease from intensity 0.5 ( day / clear ) to intensity 0.3 ( night / dark )

and i'm doing it through the pass of time, so i need calculate those values between 85% and 95% in order to get a progressive ambient darkening.

now Thanks to all of you, i have the formula to code and calculate those numbers.


Best Regards !
 

Dr.Peterson

Elite Member
Joined
Nov 12, 2017
Messages
5,556
This is the same formula you were given in post #4 (the second one). There are several ways to derive it, but if you recall any algebra, it's the straight line between (85, 0.5) and (95, 0.3), obtainable by the point-slope form or the slope-intercept form.

The real-life light intensity curve would not be linear, but it's probably good enough for your purposes.
 
Top