How to Write This Function 
March 22nd, 2009, 05:52 PM
| | Member | | Join Date: Nov 2008
Posts: 80
| | |
Hi,
I have a function y=1/x but I need it to return values like:
y=1.0 --> x=1.0
y=0.5 --> x=1.5
I guess I need a logarithmic function but how?
Thanks.
| 
March 22nd, 2009, 06:15 PM
|  | Expert | | Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2 | | | re: How to Write This Function Quote:
Originally Posted by serdar Hi,
I have a function y=1/x but I need it to return values like:
y=1.0 --> x=1.0
y=0.5 --> x=1.5
I guess I need a logarithmic function but how? | Any function that goes through those two points (1.0,1.1.0) and (1.5, 0.5) will do, even a simple linear function f(x) == 2-x would do fine. What exactly do you want?
kind regards,
Jos
| 
March 22nd, 2009, 06:27 PM
| | Member | | Join Date: Nov 2008
Posts: 80
| | | re: How to Write This Function
I have a multiplier variable that changes based on a percentage value. With my current function (y=1/x) when we have 50% the multiplier is 2, which is too high for me.
| 
March 22nd, 2009, 06:33 PM
|  | Expert | | Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2 | | | re: How to Write This Function Quote:
Originally Posted by serdar I have a multiplier variable that changes based on a percentage value. With my current function (y=1/x) when we have 50% the multiplier is 2, which is too high for me. | What would the values f(0) and f(infinity) be for your function?
kind regards,
Jos
| 
March 22nd, 2009, 06:52 PM
| | Member | | Join Date: Nov 2008
Posts: 80
| | | re: How to Write This Function
Well the multiplier is actually a 'gain' value depends on the volume. So if the volume is 0 there is no need to calculate the gain.
gain=1/volume; (where volume>0 and volume<=1)
| 
March 23rd, 2009, 04:09 PM
| | Moderator | | Join Date: Mar 2006
Posts: 1,103
| | | re: How to Write This Function
x = - log(y) + 1 ??
y = 1 -> x = 1
y = .5 -> x = 1.30
y = .2 -> x = 1.70
or
x = -ln(y) + 1 ??
y = 1 -> x = 1
y = .5 -> x = 1.69
y = .2 -> x = 2.61
| 
April 12th, 2009, 03:04 AM
| | Member | | Join Date: Nov 2008
Posts: 80
| | | re: How to Write This Function
Thanks jkmyoung, I'll look deeper into that when I'm back working on the project.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|