Dr. Zakir Naik, Shahrukh Khan, Soha Ali Khan on NDTV

30 Disember 2011

Greatest Common Divisor: Euclid's Method, Recursive Procedure

29 Disember 2011

In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), or highest common factor (hcf), of two or more non-zero integers, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

In mathematics, the Euclidean algorithm (also called Euclid's algorithm) is an efficient method for computing the greatest common divisor (GCD) of two integers. It is named after the Greek mathematician Euclid, who described it in Books VII and X of his Elements.

Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. The approach can be applied to many types of problems, and is one of the central ideas of computer science.

"The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions."

Muaturun:

Greatest Common Divisor

28 Disember 2011

In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), or highest common factor (hcf), of two or more non-zero integers, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

Muaturun:

Dr. Zakir Naik - Historic Debate at Oxford Union [UK]


DEAF-MUTE COMMUNICATOR USING BRAIN COMPUTER INTERFACE

19 Disember 2011

Spartacus: Gods of the Arena S01E06

16 Disember 2011



Kill his self....

14 Disember 2011

Spartacus: Gods of the Arena S01E05



Spartacus: Gods of the Arena S01E04

13 Disember 2011


Spartacus: Gods of the Arena S01E03

12 Disember 2011


Spartacus: Gods of the Arena S01E02

11 Disember 2011


Download

Spartacus: Gods of the Arena S01E01



Download

Maharaja Lawak Mega (2011) Minggu 07



Bahagian 1
Bahagian 2
Bahagian 3

XOR Function

20 November 2011



Generate XOR function using McCulloch-Pitts neuron by writing an M-file. The truth table for the XOR function is.

X1    X2    Y
0     0     0
0     1     1
1     0     1
1     1     0 

example38.m
%XOR function using McCulloch-Pitts neuron
clear;
clc;

%Getting weights and threshold value
disp('Enter Weights');
w11 = input('Weight w11 = ');
w12 = input('Weight w12 = ');
w21 = input('Weight w21 = ');
w22 = input('Weight w22 = ');
v1 = input('Weight v1 = ');
v2 = input('Weight v2 = ');

disp('Enter Threshold Value');
theta = input('theta = ');

x1 = [0 0 1 1];
x2 = [0 1 0 1];
z = [0 1 1 0];

con = 1;
while con
    zin1 = x1 * w11 + x2 * w21;
    zin2 = x1 * w21 + x2 * w22;
  
    for i = 1:4
        if zin1(i) >= theta
            y1(i) = 1;
        else
            y1(i) = 0;
        end
      
        if zin2(i) >= theta
            y2(i) = 1;
        else
            y2(i) = 0;
        end
    end
  
    yin = y1 * v1 + y2 * v2;

    for i = 1:4
        if yin(i) >= theta
            y(i) = 1;
        else
            y(i) = 0;
        end
    end
  
    disp('Output of Net');
    disp(y);

    if y == z
        con = 0;
    else
        disp('Net is not learning enter another set of weights and Threhold value');
        w11 = input('Weight w11 = ');
        w12 = input('Weight w12 = ');
        w21 = input('Weight w21 = ');
        w22 = input('Weight w22 = ');
        v1 = input('Weight v1 = ');
        v2 = input('Weight v2 = ');
        theta = input('theta = ');
    end
end

disp('McCulloch-Pitts Net for XOR function');

disp('Weights of Neuron Z1');
disp(w11);
disp(w21);

disp('Weights of Neuron Z2');
disp(w12);
disp(w22);

disp('Weights of Neuron Y');
disp(v1);
disp(v2);

disp('Threshold value');
disp(theta);

ANDNOT

Generate  ANDNOT function using McCulloch-Pitts neural net by a MATLAB program. The truth table for the ANDNOT function is as follows:

X1    X2    Y
0     0     0
0     1     0
1     0     1
1     1     0 

example37.m
%ANDNOT function using Mcculloch-Pitts neuron
clear;
clc;

%Getting weights and threshold value
disp('Enter weights');
w1 = input('Weight w1 = ');
w2 = input('Weight w2 = ');

disp('Enter Threshold Value');
theta = input('thete = ');

y = [0 0 0 0];
x1 = [0 0 1 1];
x2 = [0 1 0 1];
z = [0 0 1 0];

con = 1;
while con
    zin = x1 * w1 + x2 * w2;
  
    for i = 1:4
        if zin(i) >= theta
            y(i) = 1;
        else
            y(i) = 0;
        end
    end
  
    disp('Output of Net');
    disp(y);
    if y == z
        con = 0;
    else
        disp('Net is not learning enter another set of weights and threshold value');
        w1 = input('Weight w1 = ');
        w2 = input('Weight w2 = ');
        theta = input('thete = ');
    end
end

disp('Mcculloch-Pitts Net for ANDNOT function');

disp('Weights of Neuron');
disp(w1);
disp(w2);

disp('Threshold value');
disp(theta);

Activation Function

Write a MATLAB program to generate a few activation functions that are being used in neural networks. The activation functions play a major role in determining the output of the functions. One such program for generating the activation functions is as given below.

example21.m

%Illustration of various activation function used in NN's
x = -10:0.1:10;
tmp = exp(-x);
y1 = 1 ./ (1 + tmp);
y2 = (1 - tmp) ./ (1 + tmp);
y3 = x;
subplot(231); plot(x, y1); grid on;
axis([min(x) max(x) -2 2]);
title('Logistic Function');
xlabel('(a)');
axis('square');
subplot(232); plot(x, y2); grid on;
axis([min(x) max(x) -2 2]);
title('Hyperbolic Tangent Function');
xlabel('(b)');
axis('square');
subplot(233); plot(x, y3); grid on;
axis([min(x) max(x) min(x) max(x)]);
title('Identity Function');
xlabel('(c)');
axis('square');

Conversions between inches and centimeters

15 November 2011
Write a class that contains the following two method:


/** Converts from inches to centimeters */

public static double inchToCentimeter(double in)

/** Converts from centimeters to inches */
public static double centimeterToInch(double cm)


The formula for the conversion is:

centimeters = 2.54 x inches

Write a test program that invokes these methods to display the following tables:

Inches     Centimeters     Centimeters     Inches
 
1.0        2.54            5.0             1.96
2.0        5.08            10.0            3.93
...
9.0        22.86           45.0            17.71
10.0       25.4            50.0            19.68

Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package conversionbetweeninchesandcentimeters;

/**
 *
 * @author dekwan
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        sop("Inches    Centimeters    Centimeters    Inches\n");

        // SOP Inches to Centimeters
        for (int i = 1; i <= 10; i++)
        {
            sop("" + i);
            sop("         " + inchToCentimeter(i));
            sop("            " + i * 5);
            sop("             " + centimeterToInch(i * 5) + "\n");
        }
    }

    /** Converts from inches to centimeters */
    public static double inchToCentimeter(double in)
    {
        return in * 2.54;
    }

    /** Converts from centimeters to inches */
    public static double centimeterToInch(double cm)
    {
        return cm / 2.54;
    }

    private static void sop(String string)
    {
        System.out.print(string);
    }

}



Print C++

10 November 2011
Write a program that produces the following output:

CCCCCCCCC         ++              ++
CC                ++              ++
CC          ++++++++++++++  ++++++++++++++
CC          ++++++++++++++  ++++++++++++++
CC                ++              ++
CCCCCCCCC         ++              ++

main.cpp

#include<iostream>

using namespace std;

int main()
{
    cout << "CCCCCCCCC         ++              ++" << endl;
    cout << "CC                ++              ++" << endl;
    cout << "CC          ++++++++++++++  ++++++++++++++" << endl;
    cout << "CC          ++++++++++++++  ++++++++++++++" << endl;
    cout << "CC                ++              ++" << endl;
    cout << "CCCCCCCCC         ++              ++" << endl;

    return 0;
}

Print Programming Assignment 1

Write a programming that produces the following output:

****************************************
*         Programming Assignment 1     *
*          Computer Programming I      *
*           Author: Dek Wan            *
*      Due Date: Wednesday, Nov 10     *
****************************************

In your program, subtitute Dek Wan with your own name. If necessary, adjust the positions and the number of stars to produce a rectangle.

main.cpp

#include<iostream>

using namespace std;

int main()
{
    cout << "****************************************" << endl;
    cout << "*         Programming Assignment 1     *" << endl;
    cout << "*          Computer Programming I      *" << endl;
    cout << "*           Author: Dek Wan            *" << endl;
    cout << "*      Due Date: Thursday, Nov 10      *" << endl;
    cout << "****************************************" << endl;

    return 0;
}

Displaying Patterns

05 November 2011
Write a method to display a patter as follow:
1
            2 1
          3 2 1
...
n n-1 ... 3 2 1

The method header is

public static void displayPattern(int n)


Input:
9

Output:
1
       21
      321
     4321
    54321
   654321
  7654321
 87654321
987654321

Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package displayingpatterns;

import java.util.Scanner;

/**
 *
 * @author dekwan
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in);

        displayPattern(scan.nextInt());
    }

    public static void displayPattern(int n)
    {
        for (int i = 1; i <= n; i++)
        {
            for (int j = n; j > i; j--)
            {
                sop(" ");
            }

            for (int j = i; j > 0; j--)
            {
                sop("" + j);
            }

            sop("\n");
        }
    }

    public static void sop(String str)
    {
        System.out.print(str);
    }

}


Sorting Three Numbers

04 November 2011
Write the following method to display three numbers in decreasing order:

public static void displaySortedNumbers(double num1, double num2, double num3)


Input:
5678 1234 6789

Output:
6789.0
5678.0
1234.0

Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sortingthreenumbers;

import java.util.Scanner;

/**
 *
 * @author dekwan
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in);
        double num1 = scan.nextDouble();
        double num2 = scan.nextDouble();
        double num3 = scan.nextDouble();

        displaySortedNumbers(num1, num2, num3);
    }

    public static void displaySortedNumbers(double num1, double num2, double num3)
    {
        double temp;

        while (num1 < num2 || num2 < num3)
        {
            temp = num1;
            num1 = num2;
            num2 = temp;

            while (num2 < num3)
            {
                temp = num2;
                num2 = num3;
                num3 = temp;
            }
        }

        sopl("");
        sopl("" + num1);
        sopl("" + num2);
        sopl("" + num3);
    }

    public static void sopl(String str)
    {
        System.out.println(str);
    }

}



Summing int digits in an interger

Write a method that computes the sum of the digits in an interger. Use the following method header:

public static int sumDigits(long n)


For example, sumDigits(234) return 9 (2 + 3 + 4).

Input:
234

Output:
9

Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package summingthedigitsinaninterger;

import java.util.Scanner;

/**
 *
 * @author dekwan
 */
public class Main
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in);
       
        long number = scan.nextInt();
        sopl(sumDigits(number) + "\n");
    }

    public static void sopl(String str)
    {
        System.out.println(str);
    }

    public static int sumDigits(long digit)
    {
        int num;
        int sum = 0;
       
        while (digit != 0)
        {
            num = (int) digit % 10;
            digit = digit / 10;
            sum = sum + num;
        }

        return sum;
    }

}


Math: Triangular Numbers

03 November 2011
A triangulat number is define as 1 + 2 + 3 + ... + n for n = 1, 2, ..., and so on. So, the first few numbers are 1, 3, 6, 10, ... Write the following method that return a triangular number:


public static int getTriangularNumber(int n)


Write test program that displays the first 100 triangular number with 10 numbers on each line.

Input:
100

Ouput:
1 3 6 10 15 21 28 36 45 55
66 78 91 105 120 136 153 171 190 210
231 253 276 300 325 351 378 406 435 465
496 528 561 595 630 666 703 741 780 820
861 903 946 990 1035 1081 1128 1176 1225 1275
1326 1378 1431 1485 1540 1596 1653 1711 1770 1830
1891 1953 2016 2080 2145 2211 2278 2346 2415 2485
2556 2628 2701 2775 2850 2926 3003 3081 3160 3240
3321 3403 3486 3570 3655 3741 3828 3916 4005 4095
4186 4278 4371 4465 4560 4656 4753 4851 4950 5050

Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package triangularnumbers;

import java.util.Scanner;

/**
 *
 * @author dekwan
 */
public class Main
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        Scanner scan = new Scanner(System.in);

        int number = scan.nextInt();

        sop("\n");

        for (int i = 0; i < number; i += 10)
        {
            for (int j = 1; j <= 10; j++)
            {
                sop(getTriangularNumber(i + j) + " ");
            }
            sop("\n");
        }
    }

    public static int getTriangularNumber(int n)
    {
        return (n * (n + 1)) / 2;
    }

    public static void sop(String str)
    {
        System.out.print(str);
    }
}




Understanding Women


Forget

26 Oktober 2011


Awak masik cik kan??

24 Oktober 2011


Cinta tak kenal CC...


Mistake



MENYINTAI TIDAK BERMAKNA MEMILIKI


Janganlah kau angkuh melaungkan...
Si dia kepunyaanmu...
Atau kau kepunyaan si dia ...
Kerana hakikatnya...
Kita tidak pernah memiliki sesiapa...
Walau sekeping hati seorang insan...
Tidakkah kau sedar...
Hukum alam menyatakan...
Menyintai tidak semestinya memiliki?...

Manusia pandai berpura...
Berlakon di pentas dunia...
Dan bertopeng menutup rahsia..
Tetapi hati...
Tidak pernah berdusta pada empunya...
Tentang perasaan yang bergolak di dalamnya...

Tidakkah kau sedar...
Mungkin si dia melafazkan...
Ungkapan cinta padamu...
Tetapi hati dan perasaannya...
Tidak pernah berniat begitu...
Dia hanya berselindung...
Di sebalik sejuta alasan...

Dan kau...
Begitu jujur dan setia menyintainya..
Sehingga terlupa..
Hukum alam menyatakan..
Menyintai tidak bermakna memiliki..

Sesungguhnya...
"Aku tidak pernah memiliki dirimu..."
"Dan kau jua tidak memiliki diriku."

Mengertilah...
Kita sebenarnya kepunyaan..
Yang Maha Esa...
Tiada sesiapa berhak memiliki diri kita...
Kecuali Dia...
Dia mengasihi hambaNya...
Dia memiliki hambaNya...
Dan ke pangkuan Dia kita akan dikembali......

Sumber: https://www.facebook.com/photo.php?fbid=1562600720194&set=p.1562600720194&type=1&theater

Lucahnye.....


Binatang pon ade hati perut...

23 Oktober 2011

Jelez....


I Love it....


I love hijab gurl....



Who create you???



A true friends

22 Oktober 2011

Yekew?? Bohong la, care sikit presure, tegur sikit terasa....

Aku belajar...



Love you mom



Bulan dipagar bintang...



So true....


Dah sampai masanya biarkan dia berdikari, kalau care pon bukannye die hargai....

Muke2 bakal jadi prof...


p/s: yg tengah tu muke serius tak leh bla.....

Macam ni la suwit...



iC ???



Ehem.....

03 September 2011

Ulama Politik - Untuk Dakwah atau Parti?

29 Ogos 2011



Thor (2011) BRRiP MKV

28 Ogos 2011


Bahagian 1 [Mediafire]
Bahagian 2 [Mediafire]
Bahagian 3 [Mediafire]



Memadam sejarah didalam UNITY

Mudah sahaja, buka terminal dan masukkan arahan ini.
rm ~/.local/share/zeitgeist/activity.sqlite && zeitgeist-daemon --replace
Selamat mencuba.

Fakta-fakta mengenai t3t3k

22 Ogos 2011

Sumber: http://www.damnlol.com/facts-about-breasts-1773.html?utm_source=wahoha.com&utm_medium=referral&utm_campaign=wahoha

Kari katuk celeb....






















Sumber: http://www.fotomage.com/funny-celeb-caricatures/#778899