Generating Sierpinski Carpet Points using C++ and Plotting the Results, Study Guides, Projects, Research of Physics

A computational physics lab project where students are required to write a c++ program to generate points for the sierpinski carpet using given rules and plot the results. The project includes instructions for creating an html page to post the exercise, including a short description, a link to the source code file, the source code text, and the plot image.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/31/2009

koofers-user-kdf
koofers-user-kdf 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programing Standards & Simple Data Plots
Project #3
Computational Physics Lab
Prof. Volker Crede
January 22, 2008 (due: January 24 at the end of class)
Remember the “Sierpinski Carpet” from last week!
Part 1
Write a C++ program to generate (x, y) points according to the following rules:
(xnew, ynew) r
(0.5, 0.27*y) for r<0.02
(-0.139*x+0.263*y+0.57, 0.246*x+0.224*y-0.036) for 0.02<=r<=0.017
(0.17*x-0.215*y+0.408, 0.222*x+0.176*y+0.0893) for 0.17<r<=0.3
(0.781*x+0.034*y+0.1075, -0.032*x+0.739*y+0.27) for 0.3<r<1
where r is a uniform random number in the interval [0,1). Use as starting values for your
program (x,y) = (0.5, 0.0). Run the program, and plot your results. After plotting choose an
appropriate name for your plot. Remember, when developing your program adhere to our
programing standards. You can use your source code from part 1 as a starting point.
Part 2
Post this exercise to your computational physics website. Create a html page for Project 3.
Create a link from your main project web page to this html page. This html page should include the
following heading information: exercise (project) title, exercise number, your name, & today’s date.
The main content of this page should include the following:
a short description of the execise in Part 1
a link to the source code file
the text region which contains the actual source code text
the plot image
pf2

Partial preview of the text

Download Generating Sierpinski Carpet Points using C++ and Plotting the Results and more Study Guides, Projects, Research Physics in PDF only on Docsity!

Programing Standards & Simple Data Plots

Project

Computational Physics Lab

Prof. Volker Crede

January 22, 2008 (due: January 24 at the end of class)

Remember the “Sierpinski Carpet” from last week! Part 1 Write a C++ program to generate (x, y) points according to the following rules: (xnew, ynew) r (0.5, 0.27y) for r<0. (-0.139x+0.263y+0.57, 0.246x+0.224y-0.036) for 0.02<=r<=0. (0.17x-0.215y+0.408, 0.222x+0.176*y+0.0893) for 0.17 For your web images, make sure that the image is sized so that it reasonably fits on your html page. This can be done using the height and width options of the image html tag; example: __ For text regions use the html object tag; example: __