**Unformatted text preview:**

CPS 101 Introduction to Computational ScienceWensheng ShenDepartment of Computational ScienceSUNY BrockportChapter 6 Modeling ProcessDefinitionModel classificationSteps of modeling6.1 Definition Modeling is the application of methods to solve complex, real-world problems in order to make predictions about what might happen with different conditionsExamples Dr. Jerrold Marsden, a computational physicist at CalTech, models space mission trajectory design;Dr. Julianne Collins, a genetic epidemiologist at the Greenwood Genetics Center, models epidemiological studies using SAS;People at the Human-Technology Interaction Center of The University of Oklahoma models strategic planning in air traffic control;Scientists use computational models to discover land mines;Scientists model the oscillating patterns of the disease dengue fever.6.2 Modeling classification Stochastic versus deterministic A stochastic (probabilistic) model exhibits random effects --- the path of a hurricane; A deterministic model does not exhibit random effects --- a falling object in a vacuum. Static versus dynamic A static model is not involved in time --- the volume of a tank; A dynamic model changes with time --- the number of fish in a pond; Continuous versus discrete A continuous model changes continuously with time and space; A discrete model changes with time and space in a discrete sequence;6.3 Steps of modelingAnalyze the problemFormulate a model Gather data Determine variables and units Establish relationships among variables and submodels Determine equations and functionsSolve the modelVerify and interpret the model’s solution Verification: to make sure solving the problem correctly Validation: to make sure solving the right problemReport the modelErrors occur at any stage in computational science, from data collection to computer implementation. It is very important that a modeler must know where errors are from and how to prevent themChapter 7 ErrorsError sources Data errors A sensor might malfunction The accuracy of sensor is not sufficient The sensor is not calibrated or misread Modeling errors Error in formulating models. Lord Kevin developed a model to calculate the Earth age to be 20 to 40 million years old based on the assumption the Earth was cooling from a molten mass with the Sunbeing the only source of energy. Implementation errors Computational scientist could make errors. For example, in 1999 NASA’s Mars Climate Orbiter spacecraft was lost because the builder of the spacecraft, Lockheed Martin Corp., programmed it to use English units, but NASA’s Jet Propulsion scientists employed metric units.7.1 PrecisionPrecision: the precision of a number is the number of significant digits. Significant digits of an integer are all the digits except the leading and trailing zeros. The significant digits of a float point are all the digits except the leading zeros. The precision of 0.0055600 is 5, the precision of 005,664,080 is 6. A normalized number in exponential notation has the decimal point immediately preceding the first nonzero digit, such as 0.98436×103.The signigicand is 98436 and the exponent is 3.7.2 Absolute and relative errorsAbsolute error: the absolute value of the difference between the exact solution and the computed results.absolute error = |exact – computed|Relative error: the ratio between the absolute error and the absolute value of the exact solution.Example: the exact solution of 2×2 is 4, but the computer gives a result of 3.9999999999. The absolute error = 0.0000000001.The relative error = 0.000000000025.7.3 Round-off error Round-off error is the error cause by rounding a number to a certain precision. Round 0.3364 to 0.336 To round a normalized number to precision k, consider the (k+1)th significant digit. If d is less than 5, round down by truncating the significand to k significant digits. If d is greater than or equal to 5, round up by truncating the significand to k significant digits and then adding 1 to the kth significant digit of the significand. Round-off error occurs in computer when there are not enough bits to store an entire floating point number and it is approximated to the nearest number that can be represented. 1/3 = 0.33333333333…Assignment statement: x=1.0/3.0, gives the value of the expression on the right to the variable x on the left.An assignment statement causes the computer to store the value of an expression in a memory location associated with a variable .7.4 Overflow and underflowOverflow is an error condition that occurs when there are not enough bits to express a value in a computer. Over flow happens when we add to positive numbers to get a negative result, or when we add two negative numbers to get a positive result.Suppose a very small computer uses 16 bits to store an integer. If we ask the computer to perform the sum 20480+16384, the result will be surprisingly a negative number, -28672. This is because when the leftmost bit, the sign bit, gets a carry from the addition on the right, converting the result to a negative number.0 0 0 0 0 0 0 0 0 0 00 1 0 1 00150 0 0 0 0 0 0 0 0 0 00 1 0 0 00152048016384+0 0 0 0 0 0 0 0 0 0 01 0 0 1 0015Result: -28672, Why?Two’s complement: -215+ 212= -28672215= 32768In 1996, and overflow error caused the European Space’s Agency’s Ariane 5 rocket to explode. In less than 37 seconds after the launch, the guidance system’s computer attempted to convert the rocket’s sideways velocity from a 64-bit floating point number to a 16 bit integer. Because the number was too large, overflow results, and the guidance system attempted a severe correction for a wrong turn that had not occurred. Very quickly the rocket had to self-destruct. The overflow of a few bits caused the loss of a rocket that took 10 years and $7 billion to develop. http://www.around.com/ariane.htmlUnderflow is an error condition that occurs when the result of a computation is too small for a computer to represent. Example: suppose a computer can express the smallest floating point number with the magnitude of 10-39. If in an arithmetic operation, we obtained a correct value of 10-48, which is smaller than the smallest floating-point value the computer can represent, then underflow occurs, and the computer evaluates 10-48to zero.7.5 Arithmetic

View Full Document