473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to Write This Function

88
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.
Mar 22 '09 #1
7 5068
JosAH
11,448 Expert 8TB
@serdar
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
Mar 22 '09 #2
serdar
88
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.
Mar 22 '09 #3
JosAH
11,448 Expert 8TB
@serdar
What would the values f(0) and f(infinity) be for your function?

kind regards,

Jos
Mar 22 '09 #4
serdar
88
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)
Mar 22 '09 #5
jkmyoung
2,057 Expert 2GB
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
Mar 23 '09 #6
serdar
88
Thanks jkmyoung, I'll look deeper into that when I'm back working on the project.
Apr 12 '09 #7
wbgxx
6
can someone give a detail??
Jan 7 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: ChrisC | last post by:
how would I put a '\n' in say outfile.write( record, sizeof(record)). Thank you in advance for your help. -- ChrisC - chrispche@nospam.yahoo.co.uk
6
by: Bore Biko | last post by:
I don't know hopw to do this, like "printf", or "sprintf", I know they use a stack but how to make my own...?? Thanks in advance !! robert.bralic@si.t-com.hr
17
by: cass27 | last post by:
I am just doing a course on Javascript and have begun to try out different ideas. The effect I wanted was fro the user to click on a graphic. Aprompt box would apprear asking their name and that...
1
by: Tony B | last post by:
Hi, I'm trying to understand a small cpp program which uses a function called write. An example of a line using this function is write (hsocket,strclose,strlen(strclose)); where strclose is a...
0
by: Erwin Moller | last post by:
Hi group, I found something strange in PHP5.2.4 (on IIS7/Vista). I am working on an app that has been running just fine under heavy load for over a year at some custumer of mine. (they have...
1
by: anupamaavadutha | last post by:
hi all, iam new to javascript. i have problem calling javascript functions.iam designing a calender page.here is my code. <%@ page...
5
by: Immortal Nephi | last post by:
I would like to design an object using class. How can this class contain 10 member functions. Put 10 member functions into member function pointer array. One member function uses switch to call...
4
by: TuRu87 | last post by:
Hello, So I'm trying to create a malloc function and want to print some addresses to check on them and be able to visualize a little what's going on but I can't use printf cause it messes around...
3
by: divyasrinivasan | last post by:
hi ...i want a code to write a function in class file n call in default page...reply by giving some general function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.