🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.mathematics
Article #34

Re: How to find a formula from a list of numbers

#34
From: Barb Knox
Date: Sun, 04 Oct 2009 19:57
68 lines
3710 bytes
In article <ik9hc59at0uhkd54jr78j3ba55a8j7cesm@4ax.com>,
 Pfsszxt@aol.com wrote:

> On Sun, 04 Oct 2009 23:24:12 +1000, Adam Nielsen
> <a.nielsen@remove.this.shikadi.net> wrote:
> 
> >Hi all,
> >
> >Sorry for the basic question but it's been a while!  I have a list of 
> >numbers:
> >
> >  A  | B
> >-----+-----
> > 0   | 0
> > 32  | 3.6
> > 64  | 7.6
> > 128 | 15.6
> > 255 | 31.5
> >
> >And I need a formula such that I can put in any number (between 0 and 255
> >inclusive) for A, and obtain the result B.  Unfortunately because this isn't
> >quite straightforward division I'm a bit stuck.
> >
> >Just for a bit of background I'm writing a Linux driver for a USB-connected 
> >PC
> >power supply, and the current being drawn on the various rails is reported 
> >as
> >an 8-bit number (A) and for it to be of any use it will need to be converted
> >into amps (B).  The values above are taken from the Windows driver, so there
> >could be some rounding issues in the values of B depending on how well that
> >code was written.
> >
> >Annoyingly the six current rails all have slightly different values for B, 
> >so
> >I'd be grateful for a couple of tips so I can calculate a formula for each 
> >of
> >those as well.
> >
> >Many thanks,
> >Adam.
> 
>  There infinitely many solutions to the problem and each is as correct
> mathematically as any other

Yes, but this is an *applied* mathematics problem, and the engineering 
domain to which it is being applied provides some additional 
constraints.  For example, the function should almost certainly be 
monotonic, and preferably should be linear.

Inspecting the results, the differences in the successive B values for 
the successive doublings of the A values are: 4, 8, 16 (actually 15.9 
for slightly less than a doubling).  So, a simplified formula is:
    B = A/8 - 0.4

This would produce a negative B value for A < 4, so a correct formula is:
    B =  {A/8 - 0.4 if A >=4, 0 otherwise}

There may need to be some additional tweaking for small values of A, 
which we don't yet have the measurements for.

-- 
---------------------------
|  BBB                b    \     Barbara at LivingHistory stop co stop uk
|  B  B   aa     rrr  b     |
|  BBB   a  a   r     bbb   |    Quidquid latine dictum sit,
|  B  B  a  a   r     b  b  |    altum viditur.
|  BBB    aa a  r     bbb   |   
-----------------------------
Technical Details
Message-ID: <see-3529E1.08572405102009@mail.eternal-september.org>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!not-for-mail
References: <JOqdnbc8ud5gPFXXnZ2dnUVZ_v6dnZ2d@westnet.com.au> <ik9hc59at0uhkd54jr78j3ba55a8j7cesm@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: dfcd5d83b8,ea449aa0d72efcd3
X-Google-Attributes: giddfcd5d83b8,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!feeder.news-service.com!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: Barb Knox <see@sig.below>
Newsgroups: aus.mathematics
Subject: Re: How to find a formula from a list of numbers
Date: Mon, 05 Oct 2009 08:57:25 +1300
Organization: I'm not unemployed; I'm a consultant
Lines: 68
Message-ID: <see-3529E1.08572405102009@mail.eternal-september.org>
References: <JOqdnbc8ud5gPFXXnZ2dnUVZ_v6dnZ2d@westnet.com.au> <ik9hc59at0uhkd54jr78j3ba55a8j7cesm@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX18Q2Ncy2Nwpzx+ABPRDzZzs0nt39l4CLdRB5oBpAgpSMlMIggm/FKjyl2Mvn+/HD9aE6PxCNzOt04jT2cG7+WZemY2jRDY6I3DhbKYMbH7vLPQTb5bYbyo50K/73Qs+bl+wf3pJBosVDw==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sun, 4 Oct 2009 19:57:37 +0000 (UTC)
X-Auth-Sender: U2FsdGVkX1+FsyRWcoG15QZRrgo5PcgrqpJiexxMVFs=
Cancel-Lock: sha1:ptR7LDQjcS9AskiH9V4OKSTaEqU=
User-Agent: MT-NewsWatcher/3.5.3b3 (PPC Mac OS X)