Connecting Tech Pros Worldwide Help | Site Map

How to Write This Function

  #1  
Old 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.
  #2  
Old March 22nd, 2009, 06:15 PM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2

re: How to Write This Function


Quote:
Originally Posted by serdar View Post
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
  #3  
Old 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.
  #4  
Old March 22nd, 2009, 06:33 PM
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,634
Provided Answers: 2

re: How to Write This Function


Quote:
Originally Posted by serdar View Post
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
  #5  
Old 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)
  #6  
Old 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
  #7  
Old 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.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
better way to write this function Kelie answers 14 November 27th, 2007 07:45 AM
Any simple way to write this function poison.summer@gmail.com answers 6 March 10th, 2007 12:55 AM