Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that? 6 12328
different wrote:
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?
This is not a question about C but about elementary arithmetic. I will
offer an explanation but it is al; offtopic in comp.lang.c and should
not be replied to.
<ot>
You are looking for a function that maps a linear variable x onto an
exponential variable y.
y = A*exp(bx)
using a for log(A), this is the same as
log(y) = a + bx
We have a form with two unknowns and we have two data points:
log(20) = a + 0*b
log(22000) = a + 10b
so we know immediately that
a = log(20)
or A = 20
and that
b = (log(22000)  log(20)) / 10
or
b = log(1100) / 10
so the mapping is
log(y) = log(20) + x * log(1100)/10
y = 20 * pow(1100, x/10);
</ot>
"different" <ci**********@g mail.comwrote in message
news:11******** **************@ l53g2000cwa.goo glegroups.com.. .
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?
sci.math and related groups have a large pool of bored mathematicians and
students who will gladly address such topics.

David T. Ashley (dt*@e3ft.com) http://www.e3ft.com (Consulting Home Page) http://www.dtashley.com (Personal Home Page) http://gpl.e3ft.com (GPL Publications and Projects)
David T. Ashley wrote:
"different" <ci**********@g mail.comwrote in message
news:11******** **************@ l53g2000cwa.goo glegroups.com.. .
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?
sci.math and related groups have a large pool of bored mathematicians and
students who will gladly address such topics.
They might even point him to this: http://www.mpipmainz.mpg.de/~desern...og_interpol.ps

David T. Ashley (dt*@e3ft.com) http://www.e3ft.com (Consulting Home Page) http://www.dtashley.com (Personal Home Page) http://gpl.e3ft.com (GPL Publications and Projects)
Sorry, I know that it was OT, but I always tried sci.math and another
forum about algorithms, but they did not give me an answer in one week.
Thank you for the reply.
On 18 Gen, 19:26, Martin Ambuhl <mamb...@earthl ink.netwrote:
different wrote:
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?This is not a question about C but about elementary arithmetic. I will
offer an explanation but it is al; offtopic in comp.lang.c and should
not be replied to.
<ot>
You are looking for a function that maps a linear variable x onto an
exponential variable y.
y = A*exp(bx)
using a for log(A), this is the same as
log(y) = a + bx
We have a form with two unknowns and we have two data points:
log(20) = a + 0*b
log(22000) = a + 10b
so we know immediately that
a = log(20)
or A = 20
and that
b = (log(22000)  log(20)) / 10
or
b = log(1100) / 10
so the mapping is
log(y) = log(20) + x * log(1100)/10
y = 20 * pow(1100, x/10);
</ot>
different napisal(a):
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?
Instead of the function log(x), rather you have
to use the following one: log(x  1), for x >= 0.
Then the interpolation formula for x in [x_1,x_2]
with ratio f = a/(a+b), looks as follows:
(log(x_2 1)  log(x  1)) / (log(x  1)  log(x_1  1)) = (1/f)  1
After a simple calculation one can get
x = (x_1  1)^{f  1} * (x_2  1)^{f} + 1 ,
what you expect.
Best Regards,
Z. Karno
Zbigniew Karno napisal(a):
different napisal(a):
Hi, I have a program which reads a file containing integers in [0,10].
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say [20,22000], obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmi c way", that is the values between old and new must
follow a logarithmic scale.
How can I do that?
Instead of the function log(x), rather you have
to use the following one: log(x  1), for x >= 0.
Then the interpolation formula for x in [x_1,x_2]
with ratio f = a/(a+b), looks as follows:
(log(x_2 1)  log(x  1)) / (log(x  1)  log(x_1  1)) = (1/f)  1
After a simple calculation one can get
x = (x_1  1)^{f  1} * (x_2  1)^{f} + 1 ,
what you expect.
Best Regards,
Z. Karno
Incorrect.
The sign  should be replaced by +.
So, the following function has to be used:
log(x + 1), for x >= 0.
In this case, the interpolation formula looks as
follows:
(log(x_2 +1)  log(x + 1)) / (log(x + 1)  log(x_1 + 1)) = (1/f) 
1.
Thus
x = (x_1 + 1)^{f 1} * (x_2 + 1)^{f}  1 .
Regards,
Z. Karno This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics 
by: dave.harper 
last post by:
I'm relativly new to C++, and have been looking for a way to
interpolate data (i.e. a table indexed by 2 arrays, or just an array
indexed by another array). I haven't been able to find an easy way to
do it, other than actually coding the math, which would be a pain
(especially since the indexes aren't equally spaced). Is there a
common library file or something for interpolation?
Thanks in advance!
Dave

by: Charles Banas 
last post by:
I'm not sure if this is the right place to ask about this, but I've
seen several posts in the past regarding Akima's Bivariate
Interpolations routines, and i'm wondering if someone can give me some
ideas or PD code I can put to use right away.
At the moment, I'm maintaining a contour calculation and plotting
program for radio wave propagation studies. This program uses a
number of routines written by and for the FCC in Fortran in 1976...

by: Jonas Ernst 
last post by:
Hi,
Can somebody give me some hints how to do a line interpolation without using
floating point arithemtics?
The function shall do a linear interpolation between 2 points (line interp?)
and it shall return the y value to any x value given.
e.g. p1: (0,0)
p2 (1000,50)
y value to calculate at x=600

by: Kun 
last post by:
I have an html form that takes dates and inserts them into a mysql file.
Currently, users have to type in dates in the yyyymmdd format. As
of now, this process works with the sql. However, I would like to make
this process easier by:
1) providing drop down menus for year, month, and date respectively.
in a failed attempt, i tried made 3 drop down lists (dateyear,
datemonth, dateday) respectively and then used string interpolation...

by: xandra 
last post by:
i understood the concept of interpolation search.
but i couldn't understand what would be the steps for that search.
for example, if i'm searching for J in this file
A A B E F H J M N N N N O P P P P P R R R R T T T Z Z Z Z Z Z Z
i know that i have to look in the begining of this file. but what is the
steps to find j/
thank you for your help
 
by: different 
last post by:
Hi, I have a program which reads a file containing integers in .
The program reads the value of a variable every 2 seconds, then maps it
to another interval, say , obtaining a new value.
I already have a function which updates the variable, gradually
changing from the old one to the new one during the 2 seconds, which
uses a linear function.
Know I need to make the value of the variable change between old and
new in a "logarithmic way",...

by: MonkeeSage 
last post by:
There are several string interpolation functions, as well as
string.Template. But here's yet another. This one emulates ruby's
inline interpolation syntax (using #{}), which interpolates strings as
well as expressions. NB. It uses eval(), so only use it in trusted
contexts!
import sys, re
def interp(string):
locals = sys._getframe(1).f_locals
globals = sys._getframe(1).f_globals

by: ncochran 
last post by:
I need to create a windows application that will allow me to enter values for a triple linear interpolation. The program should output the answer to the center label when the user presses the "Go" button. Can someone please help me figure this out? I know the basic code to solve for the linear interpolation but I do not know how to send it to the output. I would like as many responses as I can get. Thank you.

by: John Passaniti 
last post by:
(Note: This is not the same message I posted a week or so ago. The
problem that prevented my previous attempt to work was a silly error in
the template system I was using. This is a problem involving variable
scope in JavaScript.)
I have a lot of code that generates HTML on the fly. This code has tags
with id attributes derived from variables. A small example:
blah('<span id="' + dev + '_' + mod + '">...</span>');

by: Sunny 
last post by:
Hi Is there a way to find a proper distance between large numbers.
For example, if i have a set of numbers like:
10, 40, 80, 100, 500, 10000
Now if I have to create a break points between these no.
I have to take an average & add that average to the starting number
like.
(10000 10)/6 = 1665.
Now if I create a break point using this no. the break points will be:
10  1675, 1675  3340, 3340  5005, 5005  6670 ....

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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
 
by: Oralloy 
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bitfields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++12 std=c++20 Wnarrowing bit_field.cpp
Here is the code in...

by: isladogs 
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...

by: conductexam 
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...

by: TSSRALBI 
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LANtoLAN VPNs.
The last exercise I practiced was to create a LANtoLAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

by: adsilva 
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

by: 6302768590 
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
 
by: muto222 
last post by:
How can i add a mobile payment intergratation into php mysql website.

by: bsmnconsultancy 
last post by:
In today's digital era, a welldesigned website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
 