|
Do you think of "standard deviation"?
|
|
|
|
|
Yes, I just can't place it quite right. The standard deviation during morning could be radically different from afternoon, so I would need a curve of standard deviation, not a single figure.
|
|
|
|
|
What about calculating average / standard deviation for hourly sets of data?
|
|
|
|
|
For my old computer I need an assembler which is able to take assembled code from a library and link it together in the smallest possible combination.
One 'speciality' of the old CDP1802 processor will force me to write the assembler and linker myself. There are two types of branching instructions: long branches and short branches. Long branches use full 16 bit addresses, but will cause timing issues with the graphics chip. This is an ancient hardware bug.
This is the reason why i must use short branches with short 8 bit addresses. The upper 8 bits are just assumed to remain the same as in the instruction's address. This way memory is segmented into 256 byte blocks. It's not a very strict segmentation as the code can run across the boundaries without any consequences, You just can't loop back with a short branch and long branches can't be used.
The linker will have to puzzle together snippets of code and data with this in mind. At the same time I must be sure that memory usage is as low as possible in the end. My old computer has only 4k RAM, and more than 16k is quite unusual.
The only thing I can think of is to make a memory map of each possible combination and take the one which needs the least amount of memory. There are easily hundreds of small code snippets to be linked and blindly testing every combination will be very slow and inefficient.
First thought: Build a tree with only valid options and then find the branch with the lowest byte count. This is alresy better than brute force, but I hope there is still a more elegant algorithm for this.
The language is JavaScript. that of Mordor, which I will not utter here
I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.
|
|
|
|
|
Assuming that you subdivide the code into N snippets, each terminated by an unconditional jump (e.g. procedures), you could test each possible sequence out of the N! possibilities.
Note that the maximum savings in bytes that you could achieve are the number of jumps that may be converted from 16-bit form to 8-bit form. If this number is smaller than the length of the smallest code snippet, you would not be able to use any sort of pruning of the search tree, but would be forced to evaluate all N! leaves of the tree, which might take a long time...
Borland's Turbo Assembler (for x86 processors) had an option whereby it attempted to optimize (conditional) jumps:
1. All jumps were written without qualifiers.
2. The assembler would make multiple passes through the code, applying the following algorithm:
a. If a jump target was within +127/-128 bytes, output a short (2-byte) jump.
b. If an unconditional jump target was outside that range, output a 3-byte jump.
b. If a conditional jump target was outside that range, output a 5-byte sequence - jump <inverted condition=""> over the following jump (2 bytes) / jump unconditional to the target (3 bytes).
This was applied in a loop until either no more jumps could be optimized or a predetermined number of loops was reached. Typically, only 2-3 loops were necessary.
In addition to the automatic method given above, I would try to write each procedure so that the jumps are all 8-bit forms. Optimizing a procedure by hand is likely to be much easier than attempting global optimization.
I hope that this helps.
|
|
|
|
|
|
Hi all there,
I need to understatnd that How .NET CLR understands different languages at once and make MSIL (universal code or common code) to ASP.NET engine(i mean in web app)
Thanks in advance
Pitchaiyan C
|
|
|
|
|
Wrong forum.
Please stop asking such questions here.
You have a misunderstanding about this -- the CLR doesn't understand any languages -- it's more like the languages understand the CLR, but even that is a misleading description.
Furthermore, most members here on CP (me anyway) are just ordinary developers who do not know (or care) anything about how the deep internals work. You would probbaly need to contact the developers at Microsoft to gain the level of detail you desire.
The things you are asking about are way beyond what is required for day-to-day development of commercial and enterprise applications. If you truly want to understand how it all works, you will likely need a doctorate degree.
|
|
|
|
|
I can't find anything wrong to understand things that have developed successfully already, i need your help if you already know it then just you can share it that will increase your's knowledge level also Mr PIEBALDconsult and i need to tell you one thing Sir Isaac Newton didn't have a doctorate degree when he found the gravitational force at all, it can mean you that doctorate degree is not necessary at all to become a big man in knowledge like Sir Isaac Newton.
Thanks Mr.PIEBALDconsult.
|
|
|
|
|
Isaac Newton was a genius and figured out his findings by himself.
|
|
|
|
|
|
Hi friends, need help!! i am absloute beginner and need advise. below algorithm is an extrat from a text book but when i try to apply and solve the problem on paper i see that this algorithm will fail. as i get a remainder 0 every digit i key in till 8 (i took number 8 as an examole and applied below)...please advise....also i found that applying this algorithm on number 2 would result in 0 as well and if it is 0 then not prime, then how is this algorithm correct!
1 start
2 read the number num
3 [initialize]
i <--2, flag <--1
4 repeatnsteps 4 through 6 unitl i
modified 6-Sep-14 8:03am.
|
|
|
|
|
Did you type it over correctly? Steps 5 and 6 are obviously missing, and "until i" is not a condition.
|
|
|
|
|
4th step - repeat steps 4 through 6 unitl i <num or flag =0 5) rem <--num mod i 6) if rem=0 then
flag<-- 0 else i<--i+1 7) if flag =0 then print number is not prime else prit number is prime 8) stop
in this step if i use number 2 as an example it would result in 0 which will result it number being non-prime.
-- modified 6-Sep-14 10:12am.
|
|
|
|
|
Ok, now it makes more sense. The problem here is that 2 is a special case, and they did not handle it. Simply add a step: if the number is two, it is prime.
So in short, yes, the book is wrong and you are right.
edit: ok now it makes less sense, why are most of the steps gone again? What I wrote above should still apply though.
|
|
|
|
|
Thank you , i was editing so the steps can be read properly....atleast i know that i was not wrong. i appricate you help and gives me confidence that peoople online can help me with my problems while i am learning.
|
|
|
|
|
also, i found that with this approach if i have number 99 the remainder will show as 1 and which would say it is a prime number, but again 99 is not a prime number.
|
|
|
|
|
What step is that at? Obviously you'd get a remainder of 1 for 2, but then in the next step you'd find that the remainder with 3 is 0, and therefore it's not a prime.
|
|
|
|
|
won't the remainder be 0 for 2, when you divided 2 by 2?
|
|
|
|
|
Sure, but you're not testing 2, you're testing 99, right? The remainder of 99 / 2 is 1, the remainder of 99 / 3 is 0
|
|
|
|
|
so assuming the number 2 in these steps in not properly defined and so if we move in the sequence and found another number to be divisible and remainder to be 0 (we should then in this case consider it to be correct) and therefore 99 would not show up as prime in when the algorithm runs, is that correct?
|
|
|
|
|
i found the soltion: The flag value can either be 1 or 0 in the course of this program. Flag is just a variable. This is tested in step 7 to determine if the number is prime or not prime. flag value is initially set to 1(during initialization). It may or may not change at step 6 depending on whether rem=0. The value of rem is 0 when the result of the calculation at step 5 is 0 (happens when the division produces no reminder). as you know by doing num mod i we divide num by the current value of i and check the reminder. If the reminder is 0 that means num is divisible by i. So num cannot be a prime. Whenever we find that reminder is 0 we set value of flag=0 which means the number is not prime.
|
|
|
|
|
the algorithm in plain english is
(0) initially set i=2 and flag=1
(1) take a number (num) which we want to test for being prime.
(2) Then we start dividing the number num successively by i= 2, 3, 4.....upto (num-1) and check for the reminder. At each iteration we increase i by 1.
(3) At any stage, if we find that num is divisible by i then (num is not prime) set flag=0
(4) If we reach i= (num-1) and still reminder is never 0 at any stage, then flag value remains unchanged at 1 and the number is prime
We test the flag value at the end of the program to decide whether num is prime or not.
|
|
|
|
|
|
As to the missing code, you need to use the Encode button so your angle brackets don't get interpreted as XML/HTML.
1 start
2 read the number num
3 [initialize]
i <--2, flag <--1
4 repeat n steps 4 through 6 unitl i <num or flag =0
5 rem <--num mod i
6 if rem=0 then
flag<-- 0
else
i<--i+1
7 if flag =0 then
print number is not prime
else
print number is prime
8 stop
See also: http://www.codeproject.com/Forums/1643/Java.aspx?fid=1643&tid=4943621[^]
|
|
|
|