Typesetting math: 100%

Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Loading...
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. chetankumar nadagoud/
  3. Week 3.5 - Deriving 4th order approximation of a 2nd order derivative using Taylor Table method

Week 3.5 - Deriving 4th order approximation of a 2nd order derivative using Taylor Table method

Aim : To solve the 4th order approxiamtion of 2nd order derivative using : 1. Central difference 2. Skewed right-sided difference 3. Skewed left-sided difference   1. Central difference method: We take information from both sides of a point.     f(i)  f'(i)*ΔxΔx   f''(i)* Δx2Δx2 f'''(i)* Δx3Δx3…

    • chetankumar nadagoud

      updated on 04 Feb 2022

    Aim : To solve the 4th order approxiamtion of 2nd order derivative using :

    1. Central difference

    2. Skewed right-sided difference

    3. Skewed left-sided difference

     

    1. Central difference method: We take information from both sides of a point.

     

     

    f(i)

     f'(i)*ΔxΔx

      f''(i)* Δx2Δx2

    f'''(i)* Δx3Δx3

     f''''(i)*Δx4Δx4

        af(i-2)

       a

            -2a

            4a/2

            -8a/6

          16a/24

        bf(i-1)

       b

           -b

            b/2

            -b/6

          b/24

        cf(i)

       c

            0

             0

              0

           0

        df(i+1)

       d

           d

            d/2

            d/6

          d/24

       ef(i+2)

       e

          2e

           4e/2

            8e/6

          16e/24

     

       0 

          0

              1

             0

              0

    We create matrix for the above table to solve for a,b,c,d and e

    A = [11111-210122120122-43-160164323124012423]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣11111−210122120122−43−160164323124012423⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦

    B = [00100]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣00100⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦

    X = rats(linsolve(A,B))

    We use rats to convert decimal to fractions we get:

    where: a = -1/12

               b = 4/3

               c = -5/2

               d = 4/3

               e = -1/12

     2.Right skew method: Here we take values right side of the point.

     

      f(i)

     f'(i)*ΔxΔx

      f''(i)* Δx2Δx2

    f'''(i)* Δx3Δx3

     f''''(i)*Δx4Δx4

    f'''''(i)*Δx5Δx5

        af(i)

       a

            0

              0

           0

                 0

             0

        bf(i+1)

       b

           b

              b/2

            b/6

               b/24

           b/120

        cf(i+2)

       c

           2c

             4c/2

              8c/6

               16c/24

          32c/120

        df(i+3)

       d

            3d

             9d/2

            27d/6

               81d/24

          243d/120

       ef(i+4)

       e

           4e

            16e/2

            64e/6

             256e/24

         1024e/120

       gf(i+5) 

       g 

           5g

            25g/2

             125g/6

             625g/24

         3125g/120

     

      0

           0

             1

            0

              0

               0

     

    We create matrix for the above table to solve for a,b,c,d,e and g

    A = [111111012345012429216225201686276646125601241624812425624625240112032120243120  1024120 3125120]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣111111012345012429216225201686276646125601241624812425624625240112032120243120  1024120 3125120⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦

    B = [001000]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣001000⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦

    X = rats(linsolve(A,B))

    We use rats to convert decimal to fractions we get:

     

    3. Left skew method : Here we take points on the left side of the point.

     

     

    f(i)

    f'(i)*ΔxΔx

      f''(i)* Δx2Δx2

    f'''(i)* Δx3Δx3

     f''''(i)*Δx4Δx4

    f'''''(i)*Δx5Δx5

        af(i)

       a

            0

              0

           0

                 0

             0

        bf(i-1)

       b

           -b

              b/2

            -b/6

               b/24

           -b/120

        cf(i-2)

       c

           -2c

             4c/2

              -8c/6

               16c/24

          -32c/120

        df(i-3)

       d

            -3d

             9d/2

            -27d/6

               81d/24

          -243d/120

       ef(i-4)

       e

           -4e

            16e/2

            -64e/6

             256e/24

         -1024e/120

       gf(i-5) 

       g 

           -5g

            25g/2

             -125g/6

             625g/24

         -3125g/120

     

      0

    0

             1

            0

              0

               0

     

    A = [1111110-1-2-3-4-501242921622520-16-86-276-646-125601241624812425624625240-1120-32120-243120  -1024120-3125120]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣1111110−1−2−3−4−501242921622520−16−86−276−646−125601241624812425624625240−1120−32120−243120  −1024120−3125120⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦ 

    B = [001000]⎡⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢⎣001000⎤⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥⎦

    X = rats(linsolve(A,B))

    We use rats to convert decimal to fractions we get:

     

    Steps in codeing :

    1. Create a function for f(x)=cosx⋅e(x)f(x)=cosx⋅e(x)

    function f = func(x)
    f = cos(x)*exp(x);
    end
    
    

    2. Insert the coefficients in a matrix and solve them using linsolve 

    % coefficients for Left skew method
    clear all
    close all
    clc
    
    A = [1 1 1 1 1 1;
        0 -1 -2 -3 -4 -5;
        0 1/2 4/2 9/2 16/2 25/2;
        0 -1/6 -8/6 -27/6 -64/6 -125/6;
        0 1/24 16/24 81/24 256/24 625/24;
        0 -1/120 -32/120 -243/120 -1024/120 -3125/120];
    B = [0;0;1;0;0;0];
    
    X = rats(linsolve(A,B))
    
    
    %Coefficients for Right skew method
    
    clear all
    close all
    clc
    
    A = [1 1 1 1 1 1;
        0 1 2 3 4 5;
        0 1/2 4/2 9/2 16/2 25/2;
        0 1/6 8/6 27/6 64/6 125/6;
        0 1/24 16/24 81/24 256/24 625/24;
        0 1/120 32/120 243/120 1024/120 3125/120];
    B = [0;0;1;0;0;0];
    
    X = rats(linsolve(A,B))
    
    %coefficienst for Central difference method
    
    clear all
    close all
    clc
    
    A = [1 1 1 1 1;
        -2 -1 0 1 2;
        4/2 1/2 0 1/2 4/2;
        -8/6 -1/6 0 1/6 8/6;
        16/24 1/24 0 1/24 16/24]
    
    B = [0;0;1;0;0]
    
    X = rats(linsolve(A,B))
    
    

    3. Create the functions for Central difference,Right skew and Left skew and substitute the values obtained from above program in it.

    %central difference
    function out = centraldiff(x,dx)
    a=-1
    b=16
    c=-30
    d=16
    e=-1
    analyticalsol= -2*exp(x)*sin(x);
    central = (a*func(x-2*dx)+b*func(x-dx)+c*func(x)+d*func(x+dx)+e*func(x+2*dx))/(12*(dx^2));
    out = abs(central-analyticalsol);
    end
    
    %Right skew
    function out = rightskew(x,dx)
    
    analyticalsol = -2*exp(x)*sin(x);
    rightskew = (45*func(x)-154*func(x+dx)+214*func(x+2*dx)-156*func(x+3*dx)+61*func(x+4*dx)-10*func(x+5*dx))/(12*(dx^2))
    out = abs(analyticalsol-rightskew);
    end
    
    %Left skew
    function out = leftskew(x,dx)
    
    analyticalsol = -2*exp(x)*sin(x);
    leftskew= (45*func(x)-154*func(x-dx)+214*func(x-2*dx)-156*func(x-3*dx)+61*func(x-4*dx)-10*func(x-5*dx))/(12*(dx^2))
    out = abs(analyticalsol-leftskew);
    end
    
    

    4. Now write main code involving all these functions and plot the graph.

    Main code:

    clear all
    close all
    clc
    
    x = pi/3;
    dx = linspace(pi/4,pi/400,100);
    
    
    %central
    for i = 1:length(dx)
        central_error(i) = centraldiff(x,dx(i));
    end
    
    %right
    for i = 1:length(dx)
        right_error(i)=rightskew(x,dx(i));
    end
    
    %left
    for i = 1:length(dx)
        left_error(i)=leftskew(x,dx(i));
    end
    
    %plotting
    figure(1)
    loglog(dx,central_error,'LineWidth',1,'Marker','pentagram','MarkerSize',2)
    hold on
    loglog(dx,right_error,'LineWidth',1,'Marker','pentagram','MarkerSize',2)
    loglog(dx,left_error,'LineWidth',1,'Marker','pentagram','MarkerSize',2)
    legend('central difference','right-skew difference','left-skew difference')
    xlabel('dx')
    ylabel('Error')
    grid on

    Plots and Results : 

    Conclusion :

    1.Central difference method has least error among right skew and left skew method.

    2. Left skew method error decreases as value of dx increases

    3. As dx values decreases Right skew and left skew method both converge and has same errror.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Leave a comment

    Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

    Please  login to add a comment

    Other comments...

    No comments yet!
    Be the first to add a comment

    Read more Projects by chetankumar nadagoud (23)

    Week 1 : Exploring the GUI of GT-POWER

    Objective:

    Aim : Explore the GUI of GT-Suite and run the intercooler setup. GT SUITE: GT-SUITE is the industry-leading simulation tool with capabilities and libraries aimed at a wide variety of applications and industries. It offers engineers functionalities ranging from fast concept design to detailed system or sub-system/component…

    calendar

    05 Dec 2022 09:52 AM IST

    • BIM
    • CAE
    • CFD
    • CSS
    • DEM
    • FEA
    • GIS
    • GT-SUITE
    • HEV
    • MBD
    Read more

    Project 1 : CFD Meshing for Tesla Cyber Truck

    Objective:

                                                                   CFD Meshing of Tesla Cyber Truck   Aim : CFD meshing for Tesla Cyber Truck. Objectives: For…

    calendar

    04 Dec 2022 10:50 AM IST

    • ANSA
    • CFD
    Read more

    Week 4 Challenge : CFD Meshing for BMW car

    Objective:

    CFD Meshing for BMW car Aim: CFD meshing for BMW car using ANSA Objectives: For the given model, check and solve all geometrical errors on half portion and Assign appropriate PIDs. Perform meshing with the given Target length and element Quality criteria. After meshing the half model, Do symmetry to the other side. Target…

    calendar

    30 Nov 2022 06:45 AM IST

    • ANSA
    • CFD
    Read more

    Week 3 - External flow simulation over an Ahmed body.

    Objective:

                                          External flow simulation over an Ahmed body                                 Aim: Run the simulation for…

    calendar

    01 Nov 2022 08:49 AM IST

    • CFD
    Read more

    Schedule a counselling session

    Please enter your name
    Please enter a valid email
    Please enter a valid number

    Related Courses

    coursecard

    Design loads considered on bridges

    Recently launched

    10 Hours of Content

    coursecard

    Design of Steel Superstructure in Bridges

    Recently launched

    16 Hours of Content

    coursecard

    Design for Manufacturability (DFM)

    Recently launched

    11 Hours of Content

    coursecard

    CATIA for Medical Product Design

    Recently launched

    5 Hours of Content

    coursecardcoursetype

    Accelerated Career Program in Embedded Systems (On-Campus) Courseware Partner: IT-ITes SSC nasscom

    Recently launched

    0 Hours of Content

    Schedule a counselling session

    Please enter your name
    Please enter a valid email
    Please enter a valid number

                Do You Want To Showcase Your Technical Skills?
                Sign-Up for our projects.