Monthly Archives: November 2014

C code for newton-raphson method

Problem: Here we have to find root for the polynomial x^3-8*x-4 upto 6D(decimal places)

Solution in C:

 Output:
2014-11-27 11_48_33-

C code using Weddle’s rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:If(n%6==0)

Then , sum=sum+((3*h/10)*(y(a)+y(a+2*h)+5*y(a+h)+6*y(a+3*h)+y(a+4*h)+5*y(a+5*h)+y(a+6*h)));
a=a+6*h
and Weddle’s rule is applicable then go to step 6

Step 4: else, Weddle’s rule is not applicable

Step 5:Display output

Code:

Output:

2014-11-27 02_44_27-

C code using Trapezoidal Rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)

Step 4:If n=1,2,3,……i

Then , sum=sum+2*y(a+i*h)

Step 5:Display output=sum *h/2

 

Code:

Output:

2014-11-27 08_59_58-

C code using Simpson’s 3/8 rule or Simpson’s three by eight rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)

Step 4:If n is odd

Then , sum=sum+2*y(a+i*h)

Step 5: else, When   n I s even
Then, Sum = sum+3*y(a+i*h)

Step 6:Display output=sum *3* h/8

 

Code:

Output:

2014-11-27 02_44_27-

C code using Simpson’s 1/3 rule or Simpson’s one third rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)+4*f(a+h)

Step 4:sum=sum+4*f(a+i*h)+2*f(a+(i-1)*h)

Step 5:Display output=sum * h/3

Code:

 Output:

2014-11-26 17_14_31-

Assembly:Write a program to (a) Prompt the user (b) Read HELLO and (c) Display them down the left margin

Solution:

Output:

2014-11-25 22_56_22-

Program to display a 10*10 solid box of asterisks with INT 21H and function 9H

This problem is in charles marut  assembly language book in exercise on chapter 4 …This is 11 number problem

Solution:


Importance of Electric Device Knowledge in Computer Science Education

Importance of Electric Device Knowledge in Computer Science Education

Presentation on bernoulli

Presentation on inverse matrix

Presentation on inverse matrix

Project Report – Diabetic Profile Management System : Structured Programming Lab

History and Real Life Applications of Fourier Analaysis

C code for bisection method

The Bisection Method is a numerical method for estimating the roots of a polynomial f(x). It is one of the simplest and most reliable but it is not the fastest method.
Problem: Here we have to find root for the polynomial x^3+x^2-1
Solution in C:

Algorithm:

  1. Start
  2. Read a1, b1, TOL
    *Here a1 and b1 are initial guesses
    TOL is the absolute error or tolerance i.e. the desired degree of accuracy*
  3. Compute: f1 = f(a1) and f3 = f(b1)
  4. If (f1*f3) > 0, then display initial guesses are wrong and goto step 11
    Otherwise continue.
  5. root = (a1 + b1)/2
  6. If [ (a1 – b1)/root ] < TOL , then display root and goto step 11
    * Here [ ] refers to the modulus sign. *
    or f(root)=0 then display root
  7. Else, f2 = f(root)
  8. If (f1*f2) < 0, then b1=root
  9. Else if (f2*f3)<0 then a1=root
  10. else goto step 5
    *Now the loop continues with new values.*
  11. Stop

Output:

2014-11-09 03_03_31-

Another Problem Solving Code:
Problem:
Here we have to find root for the polynomial x^3+x^2-1 upto 4D

Output:2014-11-27 12_22_54-