Plotting a Continuous Probability Distribution Function(PDF) from a Histogram – Solved in Python

Assuming you have an array of number to which you need to plot a histogram. Plot the histogram in python using the following code.

             n, bins, patches = plt.hist(D, 40, histtype='bar')
         plt.show()

The resulting plot looks like image 1. Once you have histogram you know need transform the histogram such that sum of frequency of all the points is 1
Image 1

To do that just use the following code in python. We are just diving each range by total number of data points.

         n = n/len(A)
         n = np.append(n, 0)

Now we have histogram whose sum of probability of all the points of occurrence is 1.

The final Step:
If your histogram looks like a Gaussian distribution, plot the mean and variance for the histogram.

         mu = np.mean(n)
         sigma = np.std(n)
 
Once you have the mean and variance plot the gaussian pdf function. There might be problem in scale and you might get peak at a higher value. To fix this just scale this to a factor it fits. A final image in shown in image 2.

         mu = np.mean(n)
         sigma = np.std(n)
         plt.bar(bins,n, width=(bins[len(bins)-1]-bins[0])/40)
         y1= (1/(sigma*np.sqrt(2*np.pi))*np.exp(-(bins - mu)**2 /(2*sigma**2)))*0.03
         plt.plot(bins, y1, 'r--', linewidth=2)
Image 2

Finally we have the probability distribution function as 
1/(sigma*np.sqrt(2*np.pi))*np.exp(-(bins - mu)**2 /(2*sigma**2)))*0.03

PS : Imports
import numpy as np
import matplotlib
from matplotlib import pyplot as plt

There are no odd-length cycles in a d-dimensional hypercube.- Solved

I was given this problem as one of my assignments in my class. I had tried a lot of math approaches including the mathematics induction and searched the internet but couldn't find such simple and accurate solution until one of my friends came up with it. Cheers to you buddy! Enjoy the brilliance of simplicity below.

Let the cycle in d-dimensional hypercube has n0, n1,..,nk nodes. Processor labels will change by only one bit to the adjacent nodes. As we go from node ni to ni+1 there will be only one bit change in the processor label. Since, k is in the order of 2k the number of parity changes in bit must be even. Hence, there cannot exist an odd number of cycles in a d-dimensional hypercube. 

*Few Definitions:
CycleA cycle in a graph is defined as a path originating and terminating at the same node. 
The length of a cycle: The number of edges in the cycle

Unable to build Tizen ".tpk" with Unity after upgrading the Tizen Sdk - Solved!

After updating the Tizen 2.4 package to Rev 3/Rev 4. Unity will be unable to package the tpk file. 
[The following error occurs: Failed to sign and package the application.]

There is no proper fix for this but there are two probable work arounds.

1st Way: Reinstall the previous rev of Tizen Sdk. Rebbot the systme and use it.

2nd Way (preferable): Build the package Manullly. Using the following steps:
   - go to Temp\StagingArea in your Unity project home folder
   - rename the folder "build" into "bin"
   - zip content of StagingArea folder and call that zip file "tizen.tpk". In the root of this zip file you should have \bin \data \lib and so on
   - run "tizen.bat package" on this new tizen.tpk file and then use "sdb install" to install this new file.
     ex: sdk\tools\ide/bin/tizen.bat package -- "D:\Unity\Project\..\Temp\StagingArea\tizen.tpk" -t tpk -s <Certificate Name>

Search an Encumbrance Cerificate (EC) - for Andhra Pradesh Registrations - (Please Select SRO problem - Fixed)

You might be wondering why a blog post for such a simple solution, then may be you need to try searching you EC details on this site. Just follow these little steps and you will know it is very simple and you will also realize the level of testing and the effeminacy of developers who has made the web- site. Take the later part on a sarcastic note, will u? Joke apart, let go ahead and get our Encumbrance Details. Just follow the steps below and you will have what you want.

Step 1:

Go to the following IRGS website:  and in the right most column under SERVICES you will see Encumbrance Search (EC). Please click on it. Now you will be taken to specific page which all the details of how to make the search. I wasn't intelligent enough to understand it, you can always test if your level of intelligence is above mine? Now that you have understood it you can please press "submit" and close my blog or, you can tag along with me on the blog accepting we have the same level of IQ.

Step 2:

After clicking in Submit you will bre redirected to page where you will have to make the 1st level of search. Select the Document No. in the first drop down box and Enter the Number in the next input field. Also enter you year of registration. Later come the tricky part, Registration at SRO will not be able to accept the SRO name you are giving (This works as expected only in some browsers else you will be getting the following error pop-up "Please Select SRO"). You will have to enter the SRO Code.
Once you get the code and you enter it in the SRO details it will still not function because the program that runs on the page expects more. So, you will have to add braces on either side of the SRO code like this "(SRO Code)", ex: "(621)" and press Submit.

Step 3:

Now verify if you details are correct and press Next. Now you will be redirected to the second search page where you do not bother about any thing and just press Submit.


Step 4:
Here you will be provided with the list of Document.ID in the left most column. Please select the check boxes for you respective document.id and click on Submit.


There you got to your desired page. Click on print and take print out or save a local copy as per your need.

ABCD: AnyBody Can Doodle.

Have you wondered what makes a doodle looks that awesome? Pause for a second, imagine some doodle. Isn't it beautiful? If it doesn't, then it is because of Halloween, everything looks spooky on a Halloween day;)

The beauty of the Doddle lies in the complexity of the doodle. The irony is that, drawing the enigma is actually easy than drawing a simple structure, because everyone knows a simple structure and even the small flaw is shown magnified, but in a  doodle, no one knows what it is? it is an enigma you have created that has never existed before. The best way to build the enigma is by putting all simple pieces together in random way until nobody understands what. That was a brilliant idea. Ain't it?

There are 3 simple steps to learn Doodling.

1. Create your own characters:
These characters can be very simple, like two eyes and a mouth inside a simple circle or a square. You can just learn them by practicing some characters.


2. Randomness:
Draw your characters randomly in different places, different sizes and even in different angles on a page. Make them collide in one another. Make the pencil poke you balloon doodle. Whats the dun without a little fight?

3. Filling the Gaps:
Now fill the gaps between your characters. You can fill them by drawing squares, hatching, make a net, chess borad boxes or just fill up the damn place. Everything looks cool just lke you.;)

Go ahead! Make awesomeness!

Pic Candle Videos,Youtube








Installing matplotlib.pyplot and Numpy for Python using pip-Win

Installing pip-Win:

Download the pip-Win from the following link. pip-Win_1.7.exe

Double click on the exe file and let it install. It will download all the dependedncies required. 

Note: Make sure you are connected to the Internet while the installation is in progress.

The installation happens only for the first time. from nex time you can directly run the same exe to open it.


Installing matplotlib.pyplot:

After the intallation of pip-Win you need to install matplotlib. Now open pip-Win.exe.

In the python Interpereter set your path where the python is present. ex: c:\python27\python.exe
in command type "pip  install matplotlib" and click on run.

Note: it will take a couple of time to install the following package. Once it is done you are ready to use the package.

Other useful references:
Installing Mplab on other Linux Distro's and other method to install on windows.
Drawing graphs basic tutorial


Writing and Reading from a File System for TIzen

Create a File:

Creates a empty new file in a specified location that is relative to the directory.
"File createFile(DOMString relativeFilePath);"

Example:
tizen.filesystem.resolve(
     <absolute path>, 
    function(dir){
     dir.createFile(<filename>);
    }, function(e) {
      console.log("Error" + e.message);
    }, "rw"
);



Writing to a File:

Writes the specified DOMString to a FileStream.
"void write(DOMString stringData);"

Example:
tizen.filesystem.resolve(

<filename with absolute path>, 

function(fd){

  var filehandler=fd;

    fd.openStream(
            "w",
            function(fs){
              fs.write(<data>);
              fs.close();
            }, function(e) {
                console.log("Error " + e.message);
            }, "UTF-8"
        );      
    }, function(e)  {
      console.log("Error" + e.message);
    }, "w"
);



Reading From a File:

Reads the specified number of characters from the position of the file pointer in a FileStream and returns the characters as a string. The resulting string length might be shorter than charCount if EOF is true.
"DOMString read(long charCount);"


Example:
tizen.filesystem.resolve(
     <filename with absolute path>
    function(fd){
    var filehandler=fd;
    fd.openStream(
            "r",
            function(fs){
             var data = fs.read(filehandler.fileSize);
            fs.close();
            }, function(e) {
              console.log("Error " + e.message);
            }, "UTF-8"
        );      
    }, function(e)  {
      console.log("Error" + e.message);
    }, "r"
);

For all the above operations Privilege has to be set in the config file:
Go to Config File > Privilege > and ADD the following privileges
http://tizen.org/privilege/filesystem.read and
http://tizen.org/privilege/filesystem.write

For more info please refer to: FileSystem API