12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room 54-820A, Chris Hill, Room 54-1511,

Slides:



Advertisements
Similar presentations
Iframes & Images Using HTML.
Advertisements

L.Ghadah R. Hadba CT1514-L1.  Computer Graphics :refers to processing of creating a new image from Geometry, Lighting parameters, Materials and Textures.Using.
Monte Carlo Methods and Statistical Physics
Chapter 17 Creating Images for the Web. Chapter Lessons Learn about Web features Optimize images for Web use Create a button for a Web page Create slices.
Multimedia for the Web: Creating Digital Excitement Multimedia Element -- Graphics.
Chapter 7 Sampling and Sampling Distributions
Introduction to Computer Graphics
1 10. Joint Moments and Joint Characteristic Functions Following section 6, in this section we shall introduce various parameters to compactly represent.
Modern Navigation Thomas Herring
Principles of the Global Positioning System Lecture 10 Prof. Thomas Herring Room A;
Image Compression CSC CSC Computing with Images2 How do we use fewer bytes to encode the same or similar information? Reduce redundancy Take.
Photoshop: Designing Graphics for the Web Christine Vucinich & Vicki Weidler ITS Training Services 224 B Computer Building University Park, PA 16802
Digital Images. Scanned or digitally captured image Image created on computer using graphics software.
 Scanned or digitally captured image  Image created on computer using graphics software.
Introduction to Graphic Arts Technology PRINT Versus WEB.
File Formats Different applications (programs) store data in different formats. Applications support some file formats and not others. Open…, Save…, Save.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Principles of the Global Positioning System Lecture 11 Prof. Thomas Herring Room A;
Computer Image Dr Jimmy Lam CAD for Fashion and Textiles.
1 Creating Web Graphics Outline 2.1 Graphics Types 2.2 Vector Graphics 2.3Bitmapped Graphics 2.4Graphics for the Web 2.5 GIF (Graphics Interchange Format)
1 Bitmap Graphics It is represented by a dot pattern in which each dot is called a pixel. Each pixel can be in any one of the colors available and the.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
File Formats About graphic file formats And image compression.
Module Code: CU0001NI Technical Information on Digital Images Week -2.
Lecture 4 - Introduction to Computer Graphics
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
All About File Formats Mr. Butler John Jay High School Department of Technology.
Presentation Design: Graphics. More About Color “Bit depth” of colors -- This is based on the smallest unit of information that a computer understands.
Digital Image: Representation & Processing (2/2) Lecture-3
Bitmap Vs. Vector Graphics. To create effective artwork, you need to understand some basic concepts about vector graphics versus bitmap images, resolution,
SOFTWARE TYPES Word processing Page layout Paint Draw.
8 Using Web Graphics Section 8.1 Identify types of graphics Identify and compare graphic formats Describe compression schemes Section 8.2 Identify image.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Modern Navigation Thomas Herring
Information Processes and Technology Multimedia: Graphics.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 3 This presentation © 2004, MacAvon Media Productions Introduction to Computer Graphics.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
Graphics workshop Library and Information Services University of St Andrews.
File Formats Different applications (programs) store data in different formats. Applications support some file formats and not others. Open…, Save…, Save.
File Formats and Vector Graphics. File Types Images and data are stored in files. Each software application uses different native file types and file.
Image Compression CSC CSC Computing with Images2 Image Compression Goal: reduce redundancy –Encode the same information using fewer bits.
Vector vs. Raster Objectives:
Unit 1: Task 1 By Abbie Llewellyn. Vector Graphic Software (Corel Draw) Computer graphics can be classified into two different categories: raster graphics.
Modern Navigation Thomas Herring MW 11:00-12:30 Room
 Scanned or digitally captured image  Image created on computer using graphics software.
Project Two Adding Web Pages, Links, and Images Define and set a home page Add pages to a Web site Describe Dreamweaver's image accessibility features.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Principles of the Global Positioning System Lecture 12 Prof. Thomas Herring Room ;
Review of Probability. Important Topics 1 Random Variables and Probability Distributions 2 Expected Values, Mean, and Variance 3 Two Random Variables.
Sampling and estimation Petter Mostad
Image File Formats. What is an Image File Format? Image file formats are standard way of organizing and storing of image files. Image files are composed.
Error Modeling Thomas Herring Room ;
Joint Moments and Joint Characteristic Functions.
WEB GRAPHICS EXPLORING COMPUTER SCIENCE - LESSON 3-4.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
HTML5 and CSS3 Illustrated Unit F: Inserting and Working with Images.
Efficient Game Graphics From Flash MX 2004 Game Design Demystified.
Chapter 6 Sampling and Sampling Distributions
Understanding Images. Pixels pixels Every image is made up of very small squares called pixels, and each pixel represents a color or shade. Pixels within.
File Formats Different applications (programs) store data in different formats. Applications support some file formats and not others. Open…, Save…, Save.
Vector (Shapes) vs. Raster (Pixels)
Digital Illustration Chapter 6 File format.
Digital Photo editing with Photoshop
Digital Images.
Introduction to Computer Graphics
Vector (Shapes) vs. Raster (Pixels)
Lecture 4 - Introduction to Computer Graphics
Presentation transcript:

Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room , Web page

12/07/ Lec 232 Today’s Lecture Final project: Order of presentations Guidelines for presentations Comparison of Question 3 from the solutions Graphics formats Statistics and random numbers (maybe) Reminder: Class evaluations can now be done on-line.

Class project Groups GroupTopic Shaena Berlin, Anna MerrifieldPredicting Run-up on the North Shore of O’ahu Martina Coccia, Sedar SahinExpansion of Universe Susan FlowersSudoku solver (Mathematica) Charles HallamSudoku solver Kimberly HuppertSlope Stability analysis Kirrah Jones, Ciara SivelsNeuton Diffusion Lauren JozwiakFlexure models Benjamin NieldCheckers Game Curran OiTracking High-Energy Electrons Stephanie Sallum, Harriet LauHangman 12/07/ Lec 233

12/07/ Lec 234 Class Project Aim of the project is to put together everything you have learned in this course: –Algorithm design –User interface –Numerical methods –Graphics output

12/07/ Lec 235 Ground rules Some of you will be working in groups. The role of each person in the group should be explained in the project description. There is a written and code components to the projects (see web page of requirements). You can solve the problem in any language that you want to use For those that choose Fortran, C or C++, they can choose their a graphics program to display results.

12/07/ Lec 236 Problem statement Each group should develop a problem statement that defines the problem they are trying to solve. Some projects are driven by differential and other types of equations. The nature of these equations, especially important aspects of their derivation and limitations should be discussed in the written text. Other projects are more logical and game theory driven. The logical flow and algorithms should be discussed in written text. The written text should ~2000 words (a few pages of single spaced text).

Presentations Each group will have 7-10 minutes for the presentation and demonstration (single person groups have 7 minutes, two person groups have 10-minutes). Some part of the presentation time should be allocated for questions. In general, 1-slide every 2 minutes is a good presentation pace: So single person presentations should have 4-5 slides at most. There is an ~2000 word written description to go with the presentation and detailed information can be included here. If you are using your own computer, make sure you have the correct video adapter (Mac user’s mainly but also some small PC laptops). If you want to present on my mac, let me know and send the presentation materials and codes beforehand. 12/07/ Lec 237

Evaluation of Question 3 results We have solutions to this problem in 4 languages and 5 different solutions: –Matlab ODE45 pushed to RelTol limit –FortranA single step size model –FortranB adaptive step size model –C adaptive step size based on FortranB code –Mathematica: Very large number of WorkingPrecision The following plots show the differences between the solutions and the mean of all except Mathematica 12/07/ Lec 238

Comparison Comparision of solutions CMP Matlab FortranA FortranB C Mathematica X Y Z Notice that Mathematica disagrees with the other solutions. This is very clear in the following plots. These plots are generated with the matlab comparison program on the web site. 12/07/ Lec 239

X component 12/07/ Lec 2310

Y component 12/07/ Lec 2311

Z component 12/07/ Lec 2312

Who is correct 4 of the 5 solutions match each other until the very end of the time interval where we know that maintaining accuracy is difficult. Is Mathematica wrong? Or are all the others wrong? Mathematica could be correct if its high accuracy initial conditions and constant generate different results (can be tested by changing values in Mathematica) However we noted that Mathematica tended to have accuracy at the last value: Setting the time duration to be 1 second rather than 20 seconds generates consistent values at 1-secs. 12/07/ Lec 2313

12/07/ Lec 2314 Graphics As we have seen some languages (Matlab and mathematica) already have graphics imbedded in them Languages such as Fortran, C and C++ do not explicitly contain graphics but graphics routines can be included in programs if a graphics library can be found. Often graphically output needs to be included in other documents (such as reports and web pages) Quality of the display depends very much on the type of graphics used. For graphics there are too many “standards”

12/07/ Lec 2315 Types of graphics files Graphics files fall into two basic types: –Vector graphics, made of lines and objects (e.g., fonts) that can scaled. The most common of these is Postscript (in its various forms) –Bitmapped graphics defined by pixels that have certain characteristics. The most common of these is GIF (Graphics Interchange Format). These types of formats are good for images especially with continuous tone changes. Bitmapped graphics can look very bad when re-scaled. Some formats are a composite of each type (e.g. Mac PICT format).

12/07/ Lec 2316 Basic Graphic formats Postscript: Comes in different versions (level 1, 2 and 3) and as encapsulated (EPS). EPS files may have a preview of image which is often displayed in WYSIWYG word processors. (The preview image may not always be displayable). Postscript is meant for printers and can maintain very high resolution Not all printers can print all levels of postscript and not all printers understand all parts of postscript. Postscript is a graphics programming language.

12/07/ Lec 2317 Other vector formats Often “drawing” program (opposed to “painting” programs) us a vector graphics format that is unique to the program (e.g, Macdraw). Advantages: –Small file sizes –Scalable –Good for may scientific graphics plots such as line drawings

12/07/ Lec 2318 Pixel formats GIF is the most common but enforcement of the patent on the compression algorithm used has raised concerned Network Portable Graphics (PNG) is an alternative but a lot of older software will not handle this. JPEG (Joint Photographic Experts Group) also common and good for image data These format represent an image as pixels which have attributes such as color. When image is resized, the pixels need to be merged and mapped to the new location.

12/07/ Lec 2319 Examples: Output from Kaleidagraph in PICT format

12/07/ Lec 2320 Bitmap format Basic bit-mapped graphic

12/07/ Lec 2321 Rescaled versions PICT and bitmap

12/07/ Lec 2322 JPEG Version Medium Resolution

12/07/ Lec 2323 JPEG Maximum resolution

12/07/ Lec 2324 Scaled versions of JPEG Effects of scaling graphics

12/07/ Lec 2325 EPS Files (from Photoshop) 1.1 Mbytes (with current power point displays well. In old power point, did not display well )

12/07/ Lec 2326 EPS Direct from Printing This figure will print with high resolution and with Mac PowerPoint > figure displays well.

12/07/ Lec 2327 File sizes For the different images we just looked at: Original KG figure32K (24K no data) PICT 8K Bitmap12K JPEG (medium)44K JPEG (maximum)68K EPS (photoshop)1.1M EPS (KG)40K (no fonts) EPS (KG+fonts)256K

12/07/ Lec 2328 Microsoft Graphics (Object based) Sextant 10/00 2*Sun Elev (deg) GMT Hrs + M1*x +... M8*x 8 + M9*x M M M R

12/07/ Lec 2329 Issue with graphics Increasingly documents need to be prepared electronically and generating acceptable graphics is one of the biggest problems still. For electronic presentation of images, best if the original graphics is generated at 72 dots-per-inch. If the graphics is not scaled then these can print OK as well. For printing, vector graphics are most often the best. Display quality: Try antialiasing (process to smooth out edges but some times makes graphics look fuzzy. For WYSWYG word processing, encapsulated postscript generates good prints but may not be rendered in electronic versions (such as web pages). Currently: Still a lot of testing to see what works best.

12/07/ Lec 2330 Graphics packages in programming There are graphics programs that can be purchased or are open source in which data can be supplied and graphics generated There are also graphics libraries that can used and incorporated into user developed software. Some packages come in both forms Example: Generic Mapping Tool (GMT) available from Includes program that can be scripted and routines that can be used in user developed software Caution with these programs is that calls and features can change with versions

12/07/ Lec 2331 Review of statistics Random errors in measurements are expressed with probability density functions that give the probability of values falling between x and x+dx. Integrating the probability density function gives the probability of value falling within a finite interval Given a large enough sample of the random variable, the density function can be deduced from a histogram of residuals.

12/07/ Lec 2332 Example of random variables

12/07/ Lec 2333 Histograms of random variables

12/07/ Lec 2334 Characterization Random Variables When the probability distribution is known, the following statistical descriptions are used for random variable x with density function f(x): Square root of variance is called standard deviation

12/07/ Lec 2335 Theorems for expectations For linear operations, the following theorems are used: –For a constant = c –Linear operator = c –Summation = + Covariance: The relationship between random variables f xy (x,y) is joint probability distribution:

12/07/ Lec 2336 Estimation on moments Expectation and variance are the first and second moments of a probability distribution As N goes to infinity these expressions approach their expectations. (Note the N-1 in form which uses mean)

12/07/ Lec 2337 Probability distributions While there are many probability distributions there are only a couple that are common used:

12/07/ Lec 2338 Probability distributions The chi-squared distribution is the sum of the squares of r Gaussian random variables with expectation 0 and variance 1. With the probability density function known, the probability of events occurring can be determined. For Gaussian distribution in 1-D; P(|x|<1  ) = 0.68; P(|x|<2  ) = 0.955; P(|x|<3  ) = Conceptually, people thing of standard deviations in terms of probability of events occurring (ie. 68% of values should be within 1-sigma).

12/07/ Lec 2339 Central Limit Theorem Why is Gaussian distribution so common? “The distribution of the sum of a large number of independent, identically distributed random variables is approximately Gaussian” When the random errors in measurements are made up of many small contributing random errors, their sum will be Gaussian. Any linear operation on Gaussian distribution will generate another Gaussian. Not the case for other distributions which are derived by convolving the two density functions.

12/07/ Lec 2340 Random Number Generators Linear Congruential Generators (LCG) – x(n) = a * x(n-1) + b mod M Probably the most common type but can have problems with rapid repeating and missing values in sequences The choice of a b and M set the characteristics of the generator. Many values of a b and M can lead to not-so-random numbers. One test is to see how many dimensions of k-th dimensional space is filled. (Values often end up lying on planes in the space. Famous case from IBM filled only 11-planes in a k-th dimensional space. High-order bits in these random numbers can be more random than the low order bits.

12/07/ Lec 2341 Example coefficents Poor IBM case: a = 65539, b = 0 and m = 2^31. MATLAB values: a = and m = 2^ = Knuth's Seminumerical Algorithms, 3rd Ed., pages : a = and m = 2^32 Second order algorithms: From Knuth: x_n = (a_1 x_{n-1} + a_2 x_{n-2}) mod m a_1 = , a_2 = , and m = 2^

12/07/ Lec 2342 Gaussian random numbers The most common method (Press et al.) Generated in pairs from two uniform random number x and y z1 = sqrt(-2ln(x)) cos(2*pi*y) z2 = sqrt(-2ln(x)) sin(2*pi*y) Other distributions can be generated directly (eg, gamma distribution), or they can be generated from the Gaussian values (chi^2 for example by squaring and summing Gaussian values) Adding 12-uniformly distributed values also generates close to a Gaussian (Central Limit Theorem)

12/07/ Lec 2343 Conclusion Examined random number generators: Tests should be carried out to test quality of generator or implement your (hopefully previously tested) generator Look for correlations in estimates and correct statistical properties (i.e., is uniform truly uniform) Test some algorithms with matlab: randtest.mrandtest.m

12/07/ Lec 2344 Summary of Today’s class Aim of the project is to put together everything you have learned in this course: –Algorithm design –User interface –Numerical methods –Graphics output Analysis of Question 3 Graphics formats and issues. Statistics and random numbers. Remember on-line class evalutions