Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Function that fits a1,a2...,a5' topicStudent Support Forum > General > "Function that fits a1,a2...,a5"

Next Comment >Help | Reply To Topic
Author Comment/Response
Søren
08/24/11 08:25am

Hi there.

b is a number and 0 < b < 1
a1, a2...,a5 are either 0 or 1.

Here is the thing:
Total[Table[Subscript[a,n]/(2^n),{n,1,5}]]]

This sum above must be as close to b as possible.

How do I make Mathematica choose a1, a2...,a5?


I want it to be like:

f[b_]:= ?????

f[1/2] = {1,0,0,0,0} ; best fit of
f[0.344] = {0,1,0,1,1} ; {a1,a2,a3,a4,a5}

URL: ,

Subject (listing for 'Function that fits a1,a2...,a5')
Author Date Posted
Function that fits a1,a2...,a5 Søren 08/24/11 08:25am
Re: Function that fits a1,a2...,a5 Peter Pein 08/24/11 2:58pm
Re: Function that fits a1,a2...,a5 S. Saralamba 08/25/11 03:24am
Next Comment >Help | Reply To Topic