Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question #1-Explore the Julia Sets (40 marks) A Julia Set is a construction from complex math that can be used to generate a wide range

image text in transcribed

Question #1-Explore the Julia Sets (40 marks) A Julia Set is a construction from complex math that can be used to generate a wide range of fractal patterns, with the chaotic property: very small changes in the initial conditions lead to dramatic changes in the generated shape. A standard Linux tool, gnuplot, is capable of plotting a Julia Set from a simple text script and we have provided you with the basis of this script as the attached file "shape_template.txt". You will create a C program to automate the process of inserting the initial conditions, two floating point numbers, into the correct place in the script, a simple token replacement. In case you try this on your owrn computer, the command "sudo apt-get install gnuplot-x11" is likely to be helpful. Write a program q1 julia_explorer.c that allows the user to produce Julia Set plots interactively: 1. Accept exactly three command-line arguments a. : A path to the provided "shape_template.txt" gnuplot script i. Identify a correct shape_template.txt file as one your program can open for reading, and which contains two "tags": #A# and #B#. For any incorrect file output "Error: bad file" and return with code -1 b. c. d. : A floating point value a (which has meaning in the construction of the Juliaset) : A floating point value b (which has meaning in the construction of the Juliaset) For any problem with the a or b arguments, output "Error: bad float arg" and return -1 2. Produce a modified gnuplot script on standard out, where the modifications are exactly: a. The #A# tag text is replaced with a, printed with 6 decimals (use %on b, The #B#tag text is replaced with b, printed with 6 decimals (use %on c. Note that the provided shape_template.txt is only an example. Your code should definitely handle the tags in this file, but hardcode as little about it as possible, such that any other file with the same tags can also be used for testing Examples test runs $ gcc qi julia_explorer.c -o q1 julia explorer $./q1 julia_explorer shape_template.txt 39.111 67 | gnuplotp .Jq1 julia_explorer shapetemplate.txt 35.999 63.9090 I gnuplot-p Question #1-Explore the Julia Sets (40 marks) A Julia Set is a construction from complex math that can be used to generate a wide range of fractal patterns, with the chaotic property: very small changes in the initial conditions lead to dramatic changes in the generated shape. A standard Linux tool, gnuplot, is capable of plotting a Julia Set from a simple text script and we have provided you with the basis of this script as the attached file "shape_template.txt". You will create a C program to automate the process of inserting the initial conditions, two floating point numbers, into the correct place in the script, a simple token replacement. In case you try this on your owrn computer, the command "sudo apt-get install gnuplot-x11" is likely to be helpful. Write a program q1 julia_explorer.c that allows the user to produce Julia Set plots interactively: 1. Accept exactly three command-line arguments a. : A path to the provided "shape_template.txt" gnuplot script i. Identify a correct shape_template.txt file as one your program can open for reading, and which contains two "tags": #A# and #B#. For any incorrect file output "Error: bad file" and return with code -1 b. c. d. : A floating point value a (which has meaning in the construction of the Juliaset) : A floating point value b (which has meaning in the construction of the Juliaset) For any problem with the a or b arguments, output "Error: bad float arg" and return -1 2. Produce a modified gnuplot script on standard out, where the modifications are exactly: a. The #A# tag text is replaced with a, printed with 6 decimals (use %on b, The #B#tag text is replaced with b, printed with 6 decimals (use %on c. Note that the provided shape_template.txt is only an example. Your code should definitely handle the tags in this file, but hardcode as little about it as possible, such that any other file with the same tags can also be used for testing Examples test runs $ gcc qi julia_explorer.c -o q1 julia explorer $./q1 julia_explorer shape_template.txt 39.111 67 | gnuplotp .Jq1 julia_explorer shapetemplate.txt 35.999 63.9090 I gnuplot-p

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago