# Spring 2015 MATH 307: Mathematical computing with MathematicaBranko Ćurgus

Tuesday, June 2, 2015

• Assignment 3 has been posted today.
• In Problem 1 you need to use the Calendar package: Needs["Calendar`"]. This package contains several functions related to date arithmetic: DaysBetween[], DaysPlus[], DateQ[]. Today I did a problem that inspired me to to ask questions in this problem. Look at the file 20150306.nb. Some of the ideas that I used in this file might be useful in solving this problem.
An important warning: Before you use the commands from the Calendar package you must load the Calendar package. If you by mistake try to use one of the Calendar package commands without having the package loaded, you will have to quit the kernel (Evaluation→Quit Kernel→Local) before loading the package.
• I will comment on Problem 2 in class. Reading and understanding the file Twin_primes.nb can help in constructing commands in this problem. The file 20150526_Sums_of_cubes.nb is also helpful.
• Problem 3 is quite similar to the problem solved in ExpfTanl.nb. In the notebook ExpfTanl.nb there are many hints on what to do in Problem 3.
• The files vonKoch_curve.nb and PythagorasTree.nb are "guides" for the construction of fractals in Problem 4.
• In the first part of Problem 4 you are asked to create a function that would produce iterations of the quadratic type 2 curve. In the first picture below I show the 0th iteration in blue and the 1st iteration in red. I emphasize the points that are used. You do not need to do this on your plots. In the second picture below I show the 1st iteration in blue and the 2nd iteration in red. The large picture is the fourth iteration of the quadratic type 2 curve.
• In the second part of Problem 4 you are asked to create a function that would produce iterations of the Cesaro fractal which depends on angle $\alpha$. The four pictures below show the 0th, 1st, 2nd and the 3rd iteration of the Cesaro fractal with the small angle $\alpha = \pi/16$.

• Below is an animated gif file that cycles through the 1st, 2nd, 3rd, 4th, 5th and the 6th iteration of the Cesaro fractal and, within each of the iterations cycles through all the angles starting from $\pi$, proceeding towards $0$ and then back to $\pi$ in steps of $\pi/50$. The animation starts by the first iteration and cycles through angles from $\pi$ to $0$ and back to $\pi$. This is repeated for 2nd, 3rd, 4th 5th and 6th iteration. For each iteration there are 101 pictures.

• Place the cursor over the image to start the animation.

Monday, May 18, 2015

• Very important tools in Mathematica and on this assignment are Module[] and Pure Function. I will talk about them in class.
• As we discussed yesterday Problem 1 is an exploration of a surprising function. The point of the problem is to find accurate answers to the questions that are asked and support them with as rigorous explanations as you can. You should use what you learned in Calculus combined with the power of Mathematica. To explore the function use the functions D[] to find the derivative and FullSimplify[] to simplify it. To find special points you can use Solve[], Reduce[] or FindRoot[] where appropriate. However, Mathematica needs a lot of human help in this problem.
• Problem 2.
• In the first part of this problem you need to unify, as explained in the problem, three animations given below.

Place the cursor over the image to start the animation.

Place the cursor over the image to start the animation.

Place the cursor over the image to start the animation.

• In the second part of this problem you need to reproduce two pictures from Wikipidia's Cardioid page I made an animation that unifies these two pictures. You should be able to produce something like this. If not you can present one animation and one picture.

Place the cursor over the image to start the animation.

• In the third part of Problem 2 you need to produce generalized cardioids. The animations below are large. On a slow internet connection it takes a while for them to load.
• Below is the cardioid generated by a wheel with radius 1/2 rolling on a circle with radius 1.

Place the cursor over the image to start the animation.

• Below is the cardioid generated by a wheel with radius 1/3 rolling on a circle with radius 1.

Place the cursor over the image to start the animation.

• Below is the cardioid generated by a wheel with radius 2 rolling on a circle with radius 1.

Place the cursor over the image to start the animation.

• Below is the cardioid generated by a wheel with radius 3/2 rolling on a circle with radius 1.

Place the cursor over the image to start the animation.

• The file Probabilities.nb deals with questions which are similar to questions in Problem 3.
• I will comment on Problem 4 in class.

Monday, May 11, 2015

• Assignment 1 is due on Monday, May 18, 2015. You should name your assignment Yourlastname_A1.nb. This file should be placed in your Dropbox directory Dropbox\307_Yourlastname that you shared with me. Please do not save anything else except your assignments in this directory.
• Your homework notebooks should be organized neatly. The organization should follow the format of the assignment notebook 201520_A1.nb. A notebook should start with a title cell. In a separate cell should be your name. Individual assigned problems should be presented as sections. More about organization of your notebook you can find in the information sheet. One of the posted movies at my Mathematica page explains how to organize your homework notebooks. I pointed that out in my comments.
• We discussed some aspects of Problem 1 in the notebook 20150507.nb. In this file I showed how to define a funny trigonometric function based on a parabola. I used Mod[] function. There is another way to define such a function using ArcSin[Sin[x]]. More about this you can find in More_on_Trig.nb file. I pointed out tomorrow that you might experience problems with Plot[] so that the graph of a funny trig function is not being connected. These problems are caused by the plot option Exclusions➜Automatic. Changing Exclusions➜Automatic to Exclusions➜None might fix the problem.
• Further aspects of Problem 1 were discussed in 20150511.nb.
• For Problem 1 you will need to carefully read the file TheBeautyOfTrigonometry.nb. Please pay attention to tricks that I introduce in that file. Reading this file should be a learning experience.
• When you adopt the content of The beauty of trigonometry to your funny Cos, Sin it is essential to pay attention to the proper domains for the variables involved. Here proper means that there should be no overlap in the parametric plots. In 3-d parametric plots overlaps can slow down plotting considerably. Your notebook should evaluate in less than 60 seconds. If it is slower, then comment out the slow parts. That is enclose the slow parts in (*    *). For example, in my Primer2014.nb notebook I commented out several parts that are slow to evaluate.
• Remember that each definition of a function in Mathematica should be preceded by Clear[];. Inside Clear[] you place the name of your function and all the variables that you are using. Please let me know if I did not follow my own rule in some of my files. I call this rule PPP for Prudent Programming Practice.
• On Friday we discussed Problem 2. The discussion is in the notebook 20150508.nb. Here I explained how to define recursive functions. I explained the distinction between recursively defined functions and functions defined by closed form expressions.
• Today we discussed Problem 3. The discussion is in the notebook 20150511.nb.
• Finally, since in our work we produce a lot of pictures our Mathematica files can be quite big. To avoid saving big files (which are more likely to have problems), before saving your work, delete all output cells in your notebook. This is done in the menu item (keyboard shortcut ). Since our code will easily recreate all output cells there is no harm in doing this. You can evaluate all notebook by (keyboard shortcut ).

Tuesday, March 31, 2015

• Mathematica part of the class will start on Tuesday, May 5, 2015.
• The information sheet
• We will use
which is available in BH 215. This is the current version of this powerful computer algebra system.
• To get started with Mathematica see my Mathematica page. Please watch the videos that are on my Mathematica page before the first class. Watching the movies is essential for being able to organize your homework notebooks well! I will not discuss the basics of notebook structuring.
• We also have
which is available on many more campus computers. This is an old, but still powerful, version of this software. These two versions are not compatible.