Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness

A scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results.

In C++ write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (test model) and finally the results of each test according to experiments as a double array (test experiment). Then, the program should calculate the error of the model by evaluating the average of the squares of the differences between the model result and experimental result (see formula below) using a function.

NOTE: Individual square of the difference between the model value and the experiment value calculations MUST be done in the function. Every other functionality MUST be done in the main function.

NOTE: To calculate the square of a number you MAY use the pow function within the math library.

NOTE: testCount will always be a positive integer whose value will be at most 50.

NOTE: The sizes of both test model and test experiment arrays will always be equal to test count.

 

Input
5
1 2 3 4 4
2 3 3 5 6
3
56 45 92
51 48 100
7
3.5 2.3 5.6 7.1 10.3 3.0 2.1
2.5 1.9 7.2 9.1 10.3 3.0 3.1
Output
1.4
32.6667
1.24571

testCount 1 Error (testModel, - textExperiment,)? testCount i=0

Step by Step Solution

3.39 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

include include using namespace std double functionSquaredouble base ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Applied Regression Analysis And Other Multivariable Methods

Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg

5th Edition

1285051084, 978-1285963754, 128596375X, 978-1285051086

More Books

Students also viewed these Computer Engineering questions

Question

=+a) Is this an observational or experimental study?

Answered: 1 week ago