Question

Write a C program that numerically calculates the second derivative of the function f(t) = sin(H) + 0.3A where the input&rang

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
double fun(double t)
{
return sin(t*t)+0.3*t*t*t;
}
double gfun(double t)
{
return (9.0*t)/5.0+2.0*cos(t*t)-4.0*t*t*sin(t*t);
}
int main()
{
double h=1e-7;
double t;
for(t=0.1;t<5;t=t+0.1)
{
double num=(fun(t+h)-2*fun(t)+fun(t-h))/(h*h);
printf("Second derivative at t=%f, numerically is %f and analytically is %f\n",t,num,gfun(t));
}
return 0;
}

FAcheckimain.exe Second derivative at t-0.1e80e, numerically is 2.179645 and analytically is 2.179500 Second derivative at t-

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write a C program that numerically calculates the second derivative of the function f(t) = sin(H)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3. (a) Write a MatLab program that calculates for the function F(x, y) = ln(x + Va,2-y2) The prog...

    3. (a) Write a MatLab program that calculates for the function F(x, y) = ln(x + Va,2-y2) The program should use pretty) to display both the original function and the differentiated result, and also use fprintf() to print a label such as "F(x,y) -" and "dF/dxdy - " in front of both the function and the derivative. Then have your program also print out the derivative again after it uses simplify() on the result (b) Find the Taylor expansion of...

  • Write a C++ program using a function called sum that calculates the following summation: p=2+5 F...

    Write a C++ program using a function called sum that calculates the following summation: p=2+5 F = i2 + 5 i=1 Where n is provided by the user in the main function. The function calculates the sum and return it to the main function to display it.

  • 4. (a) A function f has first derivative f (r) - and second derivative f"(z) It is also known that the function f h...

    4. (a) A function f has first derivative f (r) - and second derivative f"(z) It is also known that the function f has r-intercept at (-3,0), and a y-intercept at (0,0) (i) Find all critical points, and use them to identify the intervals over which you will examine the behaviour of the first derivative (ii) Use the f'(x), and the First Derivative Test to classify each critical point. (iii) Use the second derivative to examine the concavity around critical...

  • Write a C++ program that calculates the discount of the original price of an item and...

    Write a C++ program that calculates the discount of the original price of an item and displays the new price, and the total amount of savings. This program should have a separate header (discount.h), implementation (discount.cpp) and application files (main.cpp). The program must also have user input: the user must be prompted to enter data (the original price, and the percent off as a percentage). There must also be a validation, for example: Output: “Enter the original price of the...

  • python the polynomial equation is Ax^3+Bx^2+Cx+D b) Evaluating a polynomial derivative numerically For a function f(x),...

    python the polynomial equation is Ax^3+Bx^2+Cx+D b) Evaluating a polynomial derivative numerically For a function f(x), the derivative of the function at a value x can be found by evaluating f(x+2)-(*) and finding the limit as a gets closer and closer to 0. Using the same polynomial as the user entered in part (a), and for the same value of x as entered in part (a), compute the limit numerically. That is, start with an estimate by evaluating** 72 using...

  • My code for calculating the first derivative is the second image Compute second derivative O solutions...

    My code for calculating the first derivative is the second image Compute second derivative O solutions submitted (max: 10) You are provided with a set of data for the position of an object over time. The data is sampled at evenly spaced time intervals. Your task is to find a second order accurate approximation for the acceleration at each point in time. Write a Matlab function that takes in a vector of positions x, the time interval between each sampled...

  • Write a function called testneg with one input and no outputs. The function will test to...

    Write a function called testneg with one input and no outputs. The function will test to see if the input value is negative. If it is negative, use fprintf to print the message to the screen Warning: The input value n is negative. where n is not literally the letter n, but is the value of the input to the function. Assume the input value is a floating-point number, so use an appropriate format in the fprintf to print the...

  • Write in C++ using emacs. Write a program that calculates the ending balance of several savings...

    Write in C++ using emacs. Write a program that calculates the ending balance of several savings accounts. The program reads information about different customers’ accounts from an input file, “accounts.txt”. Each row in the file contains account information for one customer. This includes: the account number, account type (premium, choice, or basic account), starting balance, total amount deposited, and total amount withdrawn. Your program should: - open the file and check for successful open, - then calculate the ending balance...

  • Write a program in C++. You need everything everythihng given You will create a function that...

    Write a program in C++. You need everything everythihng given You will create a function that validates input. It should accept only non-negative integers. If the input is incorrect the function should throw an exception. The exception will not be caught in the function. You will create a function that reads in 2 integer values. One is a number that will be raised to the power of the second. So if 5 and 6 are entered the result would be...

  • Write a complete program that uses the functions listed below. Except for the printOdd function, main...

    Write a complete program that uses the functions listed below. Except for the printOdd function, main should print the results after each function call to a file. Be sure to declare all necessary variables to properly call each function. Pay attention to the order of your function calls. Be sure to read in data from the input file. Using the input file provided, run your program to generate an output file. Upload the output file your program generates. •Write a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT