mersenneforum.org  

Go Back   mersenneforum.org > New To GIMPS? Start Here! > Homework Help

Reply
 
Thread Tools
Old 2006-04-30, 23:33   #1
tinhnho
 
Jan 2005

13 Posts
Default 16bits problem ?

hello everyone,

I have a problem with 16bits , would anyone help me please!?.

Quote:
Give a method and/or formula for representing as many of the real
numbers in the interval [-2.0,2.0] as possible using 16-bits to represent
each number.
I'd like to know how to solve this, not just the answer, Thanks alot.
tinhnho is offline   Reply With Quote
Old 2006-04-30, 23:54   #2
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
Repรบblica de California

11,743 Posts
Default

Since the problem only asks you to maximize the *number* of (presumably) distinct representable reals in the given interval, the precise interval doesn't matter - the answer is the same as "how many distinct integers can one represent using a 16-bit field?" The only difference is that to map some given 16-bit variable to a real interval, one needs some implied knowledge about the mapping (e.g. is it uniform or not).
ewmayer is offline   Reply With Quote
Old 2006-05-01, 01:27   #3
dsouza123
 
dsouza123's Avatar
 
Sep 2002

12268 Posts
Default

Single precision floating point numbers fit in 32 bits.

If you google floating point single
the first link shows the 32 bit format,
some off the other links wiki are also informative.

The principals used by 32 bit singles could apply to a 16 bit version
with a reduced range.
There is also a 64 bit double precision version.

Also there are fixed point numbers with values past the binary point of
1/2, 1/4, 1/8 etc.

You could encode the -2,-1,0,1,2 and then the fractional part.
dsouza123 is offline   Reply With Quote
Old 2006-05-01, 02:12   #4
amcfarlane
 
amcfarlane's Avatar
 
Nov 2004
UK

2×19 Posts
Default

2^16 is 65536, so your range could be:

-32768 = -2 to 32 32767 = 2 (assuming signed short integers)

Try http://en.wikipedia.org/wiki/Fixed-point_arithmetic for more information.
amcfarlane is offline   Reply With Quote
Old 2006-05-01, 02:15   #5
tinhnho
 
Jan 2005

D16 Posts
Default

I wanna say thanks for your all comments.

To ewmayer,
how many distinct integers can one represent using a 16-bit field?


To dsouza123,
-2,-1,0,1,2 and 1/2, 1/4, 1/8 etc ==>Is this the answer ?

humm, sorry, i am alittle bit confuse here..
tinhnho is offline   Reply With Quote
Old 2006-05-01, 12:41   #6
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2·331 Posts
Default

My suggestion of integer part and fractional part using
fixed point is correct in principal, encoding it to maximize
the 16 bits worth of possible encoded values is the tricky part.

PS
16 bits = 2^16 = 65536 maximum possible encoded values.
How efficiently your range is mapped will determine your count.

Google for fixed point encoding.

Your other option is a 16 bit floating point format,
with the maximizing the encoding still the tricky part.
dsouza123 is offline   Reply With Quote
Old 2006-05-02, 17:37   #7
dsouza123
 
dsouza123's Avatar
 
Sep 2002

10100101102 Posts
Default

The best I could come up with was a twos complement
mapping but the range isn't what you specified [2 -> 0 -> -2]

If 2 of the 16 bits hold the integer and 14 for the fraction.
The integer values are 1,0,-1,-2

So the range is 1.xx (just smaller than 2) down to
-2.xx (just bigger than -3).
[1.xx -> 0 -> -2.xx]

Maybe some forum members that excel in math have
better ideas that they are willing to reveal and discuss.
dsouza123 is offline   Reply With Quote
Old 2006-05-02, 18:30   #8
xilman
Bamboozled!
 
xilman's Avatar
 
"๐’‰บ๐’ŒŒ๐’‡ท๐’†ท๐’€ญ"
May 2003
Down not across

1149310 Posts
Default

Quote:
Originally Posted by tinhnho
hello everyone,

I have a problem with 16bits , would anyone help me please!?.



I'd like to know how to solve this, not just the answer, Thanks alot.
OK, here is an answer to your homework. It correctly answers the question as phrased but is otherwise completely useless. That is what you should come to expect if you ask others to do your homework for you.

Place 65536 points anywhere on the real number line between those two boundaries. The only condition is that no two points are coincident. Label the points, in any order you feel like, with the numbers
0000 0000 0000 0000,
0000 0000 0000 0001,
0000 0000 0000 0010,
...
1111 1111 1111 1110,
1111 1111 1111 1111

where the numbers are written in binary to show that they are indeed 16-bits long.

You have now solved your problem.

Paul
xilman is offline   Reply With Quote
Old 2006-05-02, 20:33   #9
xilman
Bamboozled!
 
xilman's Avatar
 
"๐’‰บ๐’ŒŒ๐’‡ท๐’†ท๐’€ญ"
May 2003
Down not across

101100111001012 Posts
Default

Quote:
Originally Posted by davar55
And this just shows you in a drawn out way that
2^16 == 65536.
As I said, correct but useless.

People who expect other people to do their homework for them deserve all they get.

Paul
xilman is offline   Reply With Quote
Old 2006-05-03, 16:57   #10
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

769210 Posts
Default

Quote:
Originally Posted by xilman
OK, here is an answer to your homework. It correctly answers the question as phrased
No, it doesn't.

The original statement was "Give a method and/or formula for representing as many of the real numbers in the interval [-2.0,2.0] as possible using 16-bits to represent each number."

Your scheme of labeling 65536 points with 16-bit numbers requires having an associated 1-to-1 mapping table, which seems too complex to qualify as the sort of "formula" requested, and also violates the "using 16-bits to represent each number" clause. In your scheme, each number is represented by a 16-bit number plus a mapping table entry representing or containing the associated real number, thus only serving to push back the required 16-bit representation into the mapping table or beyond.

One method and/or formula satisfying the constraints is ... whoops, almost did the homework there.

Hint: Knuth

Quote:
That is what you should come to expect if you ask others to do your homework for you.
I agree with that!

Last fiddled with by cheesehead on 2006-05-03 at 17:04
cheesehead is offline   Reply With Quote
Old 2006-05-03, 17:59   #11
R.D. Silverman
 
R.D. Silverman's Avatar
 
"Bob Silverman"
Nov 2003
North of Boston

164638 Posts
Default

Quote:
Originally Posted by tinhnho
hello everyone,

I have a problem with 16bits , would anyone help me please!?.



I'd like to know how to solve this, not just the answer, Thanks alot.
The question is very poorly posed.

Trivially, one can represent at most 2^16 numbers in the interval. Any
convenient map from [0, 2^16-1] to [-2, 2] will suffice.

I presume that you do know how to find the coefficients of a straight line?
So Just consider the line segment with endpoints [-2, 0], [2, 2^16-1].

Another trivial solution is the map x : -> 1/x if x > 0
0 if x = 0

Of course, this skips mapping the negative numbers, but we can only
map 2^16 numbers in total anyway. Nothing in the problem says
that the map must be uniformly distributed.

This clearly maps each element in the set [0, 2^16-1] to a distinct element of the set [-2, 2].

This is a trivial problem in first year middle school algebra. Has education
gotten so bad, that people can't fit a straight line and don't know
what a function is?
R.D. Silverman is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the problem here? didgogns Msieve 1 2016-11-15 03:31
problem 2.4 MattcAnderson Puzzles 4 2014-08-21 04:40
PSU problem? ian209 Hardware 4 2006-02-18 19:52
51 problem Neves Miscellaneous Math 5 2004-02-10 22:59
51 problem Neves Puzzles 15 2004-02-05 23:11

All times are UTC. The time now is 20:21.


Wed Sep 28 20:21:18 UTC 2022 up 41 days, 17:49, 0 users, load averages: 1.10, 1.05, 1.11

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

โ‰  ยฑ โˆ“ รท ร— ยท โˆ’ โˆš โ€ฐ โŠ— โŠ• โŠ– โŠ˜ โŠ™ โ‰ค โ‰ฅ โ‰ฆ โ‰ง โ‰จ โ‰ฉ โ‰บ โ‰ป โ‰ผ โ‰ฝ โŠ โŠ โŠ‘ โŠ’ ยฒ ยณ ยฐ
โˆ  โˆŸ ยฐ โ‰… ~ โ€– โŸ‚ โซ›
โ‰ก โ‰œ โ‰ˆ โˆ โˆž โ‰ช โ‰ซ โŒŠโŒ‹ โŒˆโŒ‰ โˆ˜ โˆ โˆ โˆ‘ โˆง โˆจ โˆฉ โˆช โจ€ โŠ• โŠ— ๐–• ๐–– ๐–— โŠฒ โŠณ
โˆ… โˆ– โˆ โ†ฆ โ†ฃ โˆฉ โˆช โŠ† โŠ‚ โŠ„ โŠŠ โŠ‡ โŠƒ โŠ… โŠ‹ โŠ– โˆˆ โˆ‰ โˆ‹ โˆŒ โ„• โ„ค โ„š โ„ โ„‚ โ„ต โ„ถ โ„ท โ„ธ ๐“Ÿ
ยฌ โˆจ โˆง โŠ• โ†’ โ† โ‡’ โ‡ โ‡” โˆ€ โˆƒ โˆ„ โˆด โˆต โŠค โŠฅ โŠข โŠจ โซค โŠฃ โ€ฆ โ‹ฏ โ‹ฎ โ‹ฐ โ‹ฑ
โˆซ โˆฌ โˆญ โˆฎ โˆฏ โˆฐ โˆ‡ โˆ† ฮด โˆ‚ โ„ฑ โ„’ โ„“
๐›ข๐›ผ ๐›ฃ๐›ฝ ๐›ค๐›พ ๐›ฅ๐›ฟ ๐›ฆ๐œ€๐œ– ๐›ง๐œ ๐›จ๐œ‚ ๐›ฉ๐œƒ๐œ— ๐›ช๐œ„ ๐›ซ๐œ… ๐›ฌ๐œ† ๐›ญ๐œ‡ ๐›ฎ๐œˆ ๐›ฏ๐œ‰ ๐›ฐ๐œŠ ๐›ฑ๐œ‹ ๐›ฒ๐œŒ ๐›ด๐œŽ๐œ ๐›ต๐œ ๐›ถ๐œ ๐›ท๐œ™๐œ‘ ๐›ธ๐œ’ ๐›น๐œ“ ๐›บ๐œ”