473,903 Members | 3,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logarithmic scale

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 ....
But the problem is that I can't use them as they are far apart like
all the first 5 no.'s will be in the first breakpoint, so its no help.

Can I use a formula like logarithmic scale in javascript to calculate
the breakpoint that are based on logarithmic scale.
Sep 25 '08 #1
6 4059
Sunny <su**********@g mail.comwrites:
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 ....
But the problem is that I can't use them as they are far apart like
all the first 5 no.'s will be in the first breakpoint, so its no help.

Can I use a formula like logarithmic scale in javascript to calculate
the breakpoint that are based on logarithmic scale.
You can use logarithms in javascript. See Math.log:

http://developer.mozilla.org/En/Core...jects:Math:log

I have no idea what you mean by break points or what you're trying to
do. It looks like you just want to split an ordered list in two, sort of:

x = Math.ceil(list. length / 2)
break_point = (list[x] - list[x+1]) / 2

If that doesn't help, please explain further.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Sep 25 '08 #2
Joost Diepenmaat <jo***@zeekat.n lwrites:
x = Math.ceil(list. length / 2)
break_point = (list[x] - list[x+1]) / 2
I meant Math.floor()

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Sep 25 '08 #3
On Sep 25, 3:47 pm, Joost Diepenmaat <jo...@zeekat.n lwrote:
Joost Diepenmaat <jo...@zeekat.n lwrites:
x = Math.ceil(list. length / 2)
break_point = (list[x] - list[x+1]) / 2

I meant Math.floor()

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
I have a series of numbers that i want to display on graph.
Numbers are like 10, 40, 80, 100, 500, 10000, 100000. there are 50
numbers
Like the last column has value that is really higher.
Here users can break this numbers into groups.
But when I take the average using the no. of groups they want (100000
-10)/6 = 16665.
so the groups come out 10 - 16665.
Now if i have to display this data on chart.
all the 30 points come under group 10 - 16665 & couple of groups
remain empty like 1ike no value exists in them because the difference
between the lowest & highest element is too big(10,100000). So I want
a method that computes an average or create groups based on logic.
Sep 25 '08 #4
"Sunny" <su**********@g mail.com>
I have a series of numbers that i want to display on graph.
Numbers are like 10, 40, 80, 100, 500, 10000, 100000. there are 50
numbers
Like the last column has value that is really higher.
Here users can break this numbers into groups.
But when I take the average using the no. of groups they want (100000
-10)/6 = 16665.
so the groups come out 10 - 16665.
Now if i have to display this data on chart.
all the 30 points come under group 10 - 16665 & couple of groups
remain empty like 1ike no value exists in them because the difference
between the lowest & highest element is too big(10,100000). So I want
a method that computes an average or create groups based on logic.
First take the log (as said by JD, see Math; remember that 10-base log(x) =
ln(x)/ln(10) ) of all points into a new series.
Do your groupings with this new series and display.
The y-axis will now run from say -0.3 to 4.2. Round these min and max values
down resp up to -1 and 5.
Display the axis where you transform the values y to 10^y (e.g. 0.1, 1, 10,
100, 1000, 10000).

Tom
Sep 25 '08 #5
Sunny wrote:
Hi Is there a way to find a proper distance between large numbers.
alt.homework is elsewhere. You do yourself no favor at all by not doing
your homework by yourself. Trust me.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Sep 26 '08 #6
On 25 sep, 21:15, Sunny <sunnyluth...@g mail.comwrote:
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 ....
I do see all these evaluate to -1665, but I don't understand what you
further mean. I really think you should rephrase the problem in a
clearer way. Anyway, I think your algorithm would go like this:

var nrs = [10, 40, 80, 100, 500, 10000];
var breakpoints = new Array();
var f = (nrs[nrs.length-1] - nrs[0]) / nrs.length;
for (var i=0; i<nrs.length; i++)
breakpoints[i] = i * f - ((i+1) * f);
document.write( breakpoints); // -1665 for every entry
[...]
Now if i have to display this data on chart.
Line chart:
http://code.google.com/apis/chart/#line_charts

var nrs = [10, 40, 80, 100, 500, 10000];
document.write( '<img src="http://chart.apis.goog le.com/chart?'
+ 'chxt=y'
+ '&chxl=0:|0|'
+ nrs[nrs.length-1]/2 + '|' + nrs[nrs.length-1]
+ '&chs=400x400 '
+ '&cht=lc'
+ '&chds=0,' + nrs[nrs.length-1]
+ '&chd=t:' + nrs
+ '">');

Pie chart:
http://code.google.com/apis/chart/#pie_charts

var nrs = [10, 40, 80, 100, 500, 10000];
var perc = new Array();
var sum = 0;
for (var i=0; i<nrs.length; i++)
sum += nrs[i];
for (var j=0; j<nrs.length; j++)
perc[j] = nrs[j] / sum;
document.write( '<img src="http://chart.apis.goog le.com/chart?'
+'chs=750x300'
+ '&chd=t:' + perc
+ '&cht=p3'
+ '&chl=' + nrs.join('|')
+ '">');

Hope this helps,

--
Bart
Sep 28 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3749
by: John Fouhy | last post by:
So I've got a horizontal scale widget in my GUI. When I click the mouse in the area to the right of the GUI, the scale advances by 1. 13 +-------------------------+ |<| X |>| +-------------------------+ || \/
4
6615
by: codecraig | last post by:
Hi, I am using Tkinter and I have a Label and a Scale. I want to update my label everytime the Scale value changes. What is the best way of doing this? Do i have to bind for every event type? Or is there some better way? If I do have to bind each type of event to the scale, what types occur for a Scale? Thanks.
1
4170
by: Andre | last post by:
Hi, I'm trying to plot a histogram on some data that I receive at runtime. I'm trying to measure distances between two points, and these distances can be from the range 1 to 5000000. I want to use a logarithmic scale with a range -2^29 to +2^29. How can I determine at any point in time which strata (i.e which cohort or portion of scale) the value belongs to (without using the square or square-root functions)? I could have mask-bits of...
8
30492
by: Derek Basch | last post by:
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. Thanks, Derek Basch P.S. I suck at math so feel free to make me feel stupid if it is really easy to do :).
8
6076
by: Derek Basch | last post by:
Given a value (x) that is within the range (1e-1, 1e7) how do I round (x) up to the closest exact logarithmic decade? For instance: 10**3 = 1000 x = 4978 10**4 = 10000 x = 10000 Thanks Everyone!
3
2042
by: Jerry Spence1 | last post by:
A very useful feature was added in 2.0 of .NET framework which was the scaling of a form and all the controls within it. This is really useful but I am finding very little information of how to use it. I have managed to implement it as follows: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim addSize As New SizeF(0.5F, 0.5F)
0
1500
by: TonyJ | last post by:
Hello! We have a pc running a form application. If I push some buttons in this application I want to send some commands to a scale which is connected to a specific IP address. When I sent a command I also receive an answer from the scale. I want to communicate with the scale using TCP or UDP. The commands that can be sent to the scale are very short about 3 to 5 characters.
5
667
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",...
19
4912
by: Matteo Migliore | last post by:
Hi! I've to scale a vector of numbers of size N to a vector of size M. The trasformation is like a zoom on images but I need on a vector. The second size can be M >= N or M <= N, M 0. The value for each element can be from 0 to 255. Is there some methods that can I use?
0
9999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9847
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,...
0
10500
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9684
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7206
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();...
0
5894
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 LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN 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...
0
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4726
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
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.