Question

In: Advanced Math

Write a program (fortran 90) that calls a subroutine to approximate the derivative of y=sin(x)+2x^2 using...

Write a program (fortran 90) that calls a subroutine to approximate the derivative of y=sin(x)+2x^2 using a one-sided difference approach fx = (fi-fi-1)/deltaX and a centered difference approach fx = (fi+1-fi-1)/deltaX. The value of the function f and its derivative fx should be evaluated at x=3.75. Your code should print both values tot he screen when it runs.

Solutions

Expert Solution

! Fortran Programe

PROGRAM Approx_Der
IMPLICIT NONE
REAL :: x,deltaX, y, One_side_Diff, Central_Diff   
x=3.75
deltaX = 0.1
One_side_Diff = (y(x)-y(x-deltaX))/deltaX
Central_Diff = (y(x+deltaX)-y(x-deltaX))/deltaX
PRINT *, 'approximated derivative of y at point x = 3.75 using One Sided Difference : ', One_side_Diff
PRINT *, 'approximated derivative of y at point x = 3.75 using Central Difference: ', Central_Diff
END PROGRAM Approx_Der

FUNCTION y(x)
IMPLICIT NONE
REAL :: y   
REAL, INTENT( IN ) :: x
y =SIN(x)+2*x**2
  
END FUNCTION y

! output

approximated derivative of y at point x = 3.75 using One Sided Difference :     13.9522362                                   

approximated derivative of y at point x = 3.75 using Central Difference:     28.3615875


Related Solutions

y� � y � 2x sin x
y� � y � 2x sin x
f(x,y)=sin(2x)sin(y) intervals for x and y: -π/2 ≤ x ≤ π/2 and -π ≤ y ≤...
f(x,y)=sin(2x)sin(y) intervals for x and y: -π/2 ≤ x ≤ π/2 and -π ≤ y ≤ π find extrema and saddle points In the solution, I mainly interested how to findcritical points in case of the system of trigonometric equations (fx=0 and fy=0). ,
question should be done on Matlab 4) Find the derivative of sin(2x) at x = 0.8...
question should be done on Matlab 4) Find the derivative of sin(2x) at x = 0.8 rad and find the value of h where the error is minimum as compared to the true value i.e. actual value or accurate value. a) Use for loop b) Use element by element operation
Write a code to approximate the derivative of a function f(x) using forward finite difference quotient...
Write a code to approximate the derivative of a function f(x) using forward finite difference quotient f( x + h ) - f( x ) f'(x) ≈ ------------------- (for small h). h For the function f(x) = sin(x), at x=1 , compute the FD quotients for h = 1/2k, k=5,...,N, with N=30 and compare with the exact derivative cos(x). Output k , h , error. Where SHOULD the error tend as h → 0 ? 1. Look at the numbers....
Solve the initial value problem dy/dx = −(2x cos(x^2))y + 6(x^2)e^(− sin(x^2)) , y(0) = −5...
Solve the initial value problem dy/dx = −(2x cos(x^2))y + 6(x^2)e^(− sin(x^2)) , y(0) = −5 Solve the initial value problem dy/dt = (6t^5/(1 + t^6))y + 7(1 + t^6)^2 , y(1) = 8. Find the general solution of dy/dt = (2/t)*y + 3t^2* cos3t
Solve by variation of parameters. y''+4y =sin(2x) y'''-16y' = 2
Solve by variation of parameters. y''+4y =sin(2x) y'''-16y' = 2
Write a fortran 90 program that sets up a 4x4 2D real array A and associate...
Write a fortran 90 program that sets up a 4x4 2D real array A and associate a single value pointer AP with element (2,1) of that array. Set all elements in A equal to 0. and print the value of AP to the screen. Next set all elements in A equal to 1.23 and print the value AP to the screen.
In the first 5 examples find the derivative of Y Y=epower2x Y=epower-2x +xpower2 Y=epowerxpower1/2 Y= epower-3/x...
In the first 5 examples find the derivative of Y Y=epower2x Y=epower-2x +xpower2 Y=epowerxpower1/2 Y= epower-3/x Y=epower4xdivided by xpower2 Integrate the following Int x epower5xpower2 dx Int epower-2x between 1 and 0 Int.epower x1/2 divided by xpower1/2
Let f ( x , y ) = x^ 2 + y ^3 + sin ⁡...
Let f ( x , y ) = x^ 2 + y ^3 + sin ⁡ ( x ^2 + y ^3 ). Determine the line integral of f ( x , y ) with respect to arc length over the unit circle centered at the origin (0, 0).
Maximize 250 + 7x − 5y subject to: 2x + 3y ≤ 90 2x+ y≤62 x+...
Maximize 250 + 7x − 5y subject to: 2x + 3y ≤ 90 2x+ y≤62 x+ y≥20 x ≥ 0, y ≥ 0
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT