Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Math 261 Fall 2015, Homework 1 help

Project: vector curves
Views: 44

General sage math cloud information

One option you can use for your computer homework is Sage math cloud, and online interactive notebook server for Sage, a free symbolic mathematics system. You can sign up for free sage math cloud account at

http://cloud.sagemath.com/

When registering, please use your full name and your SVSU email address. It will make it easier for me to communicate with you, and for you to submit your work to me.

After registering and logging in, you have to create a new project. I suggest you give it a name like "Calc 3" or something similar. After opening the new project, go to settings (a "wrench" icon) and add me as a collaborator, so you can ask me for help and submit your notebooks to me online. To add me, you open the settings (the "wrench" icon), scroll down to find the "Collaborators" box, type my name (Jan Hlavacek) or my email ([email protected]) into the search box, press enter, and a list of users matching your search will show below. At the moment I seem to be the only Jan Hlavacek using the server, but I added "(SVSU)" to my last name so you can easily identify me. Select my name from the list and click "Add selected". I will now be able to see your work on this project, type comments in your worksheets, and you can ask me questions using the chat.

Starting a Sage notebook

When you first open a project, it will be empty. You will need to create a new Sage worksheet. Click on the large "Create or upload files" button and you will be presented with a file creation dialog. There are number of different file types you can create. You want a "SageMath worksheet" for this homework.

You probably want to edit the filename, the default is based on current date and time, and in my experience it is really painful when you have 20 files all named something like "2015-12-07-132321" and you try to figure out what is in them and which one is the one you need. Then you click the "SageMath Worksheet" button, and you new empty worksheet will open.

Now you are ready to do the math.

Getting help

You can click in the "Help" button in the upper right corner of the page, and it will open a list of various links to bunch of help materials. There is a lot of information, you may want to start with the link to general Sage Math help and support pages, or scroll down to get to the "Getting Started" section.

Just some basic stuff:

  • Sage worksheet consists of a series of cells.
  • You can add new cells between existing cells by clicking on gray lines separating cells.
  • Use `Shift-Enter` to "run", or evaluate, each cell.
  • Use `%html` on the first line of cell all by itself to have a cell interpret HTML formatting. "Run" the cell to see what it looks like. Double-click in the cell to go back to editing.
  • Similarly, `%md` will allow you to write in [Markdown](https://daringfireball.net/projects/markdown/syntax/) syntax.
  • For math formulas in text, you can use [$\mathrm{\LaTeX}$](https://www.sharelatex.com/learn/Mathematical_expressions) syntax (use single dollar signs, or use `\(` and `\)`, which is preferable).
  • For "displayed" mathematics (centered on a line of its own) you can use double dollar-signs or `\[` and `\]`, which is preferable.
  • Cells that do not start with `%html` or `%md` (or few other codes like that) are Sage code cells and will be evaluated by Sage.
  • Sage is build upon Python, so many syntax constructs from Python (loops, lists, iterators, ...) can be used in Sage.

Some examples what you can do are below. Let me know if you have any questions.

Defining a vector function

First define a vector function [\mathbf{r}(t) = \left\langle t\cos(t)/2, t, t\sin(t)/2\right\rangle] Notice that since it is the first time we are using the letter t as symbolic variable, we have to declare it, so sage will know it is a symbolic variable and will not try to find an object named t and complain it cannot find it. The line starting with the % sign will do that.

%var t r = vector((t*cos(t)/2,t,t*sin(t)/2))

What is the value of the function when t=1t = 1? We can evaluate the vector function like this (I am going to first save the value to a variable pt, for "point", so we can use it later, and then display the value of pt):

pt = r(t=1) pt
(1/2*cos(1), 1, 1/2*sin(1))

To find an approximate numerical value, we use the .n() method:

pt.n()
(0.270151152934070, 1.00000000000000, 0.420735492403948)

Derivatives of vector functions

To find a derivative of the vector function, use the diff method:

rp = r.diff(t) rp
(-1/2*t*sin(t) + 1/2*cos(t), 1, 1/2*t*cos(t) + 1/2*sin(t))

Given a vector, we can find its norm using the .norm() method. For example, to find the norm of the vector rp, and therefore the speed of the motion described by the vector function r\mathbf{r}, we use

speed = rp.norm() speed
sqrt(1/4*(t*cos(t) + sin(t))*(conjugate(t)*cos(conjugate(t)) + sin(conjugate(t))) + 1/4*(t*sin(t) - cos(t))*(conjugate(t)*sin(conjugate(t)) - cos(conjugate(t))) + 1)

Note that this is pretty messy. Sage does not know that our vectors are real, and uses a more general complex vector norm. It also does not simplify the result. We can specifically ask to simplify. We have to simplify two ways: first using the simplify function, which will perform algebraic simplification, then the .simplify_trig() method, which simplify the result using trigonometric identities:

simplify(speed).simplify_trig()
sqrt(1/4*t^2 + 5/4)

TNB Frame

The unit tangent vector can be found by dividing the tangent vector r\mathbf{r}', or rp, by the speed. An easier way is to "normalize" the vector rp.

T = simplify(rp.normalized()).simplify_trig() T
(-1/2*(t*sin(t) - cos(t))/sqrt(1/4*t^2 + 5/4), 1/sqrt(1/4*t^2 + 5/4), 1/2*(t*cos(t) + sin(t))/sqrt(1/4*t^2 + 5/4))

In similar way we can get the unit normal vector N:

N = simplify(T.diff(t).normalized()).simplify_trig() N
(-1/8*((t^3 + 6*t)*cos(t) + (t^2 + 10)*sin(t))/((1/4*t^2 + 5/4)^(3/2)*sqrt((t^4 + 8*t^2 + 20)/(t^4 + 10*t^2 + 25))), -1/4*t/((1/4*t^2 + 5/4)^(3/2)*sqrt((t^4 + 8*t^2 + 20)/(t^4 + 10*t^2 + 25))), 1/8*((t^2 + 10)*cos(t) - (t^3 + 6*t)*sin(t))/((1/4*t^2 + 5/4)^(3/2)*sqrt((t^4 + 8*t^2 + 20)/(t^4 + 10*t^2 + 25))))

You see that the N vector is very complicated, even after simplification. Since for further calculation we do not need to take derivatives, we can simplify things by evaluating these vector function at t=1t=1:

T1 = T(t=1) N1 = N(t=1)

The binormal vector is the crossproduct of TT and NN:

B1 = T1.cross_product(N1) T1.n() N1.n() B1.n()
(-0.122951598318416, 0.816496580927726, 0.564106583727118) (-0.988430742756272, -0.151619608715781, 0.00402007800389206) (0.0888119994439421, -0.557086014531156, 0.825692195172367)

Plotting

To plot a vector from a point PP to point QQ, use arrow(P,Q). So to plot a vector T1 positioned at a point pt, do arrow(pt,pt+T1).

The following will plot the curve defined by the function r(t)\mathbf{r}(t) for 0tπ0 \le t \le \pi, as well as the TNB frame at the point pt corresponding to t=1t=1:

parametric_plot3d(r,(t,0,pi),color="black") + arrow(pt,pt+T1,color="blue") + arrow(pt,pt+N1,color="green") + arrow(pt,pt+B1,color="red")
3D rendering not yet implemented

Note that you can manipulate the plot with your mouse, or your finger or stylus on a touch screen.

Curvature and osculating circle

To find the equation of the osculating circle we need to first find the radius. The radius of the osculating circle is 1/κ1/\kappa where κ\kappa is the curvature. There are several ways how to find the curvature, one is [\kappa = \frac{\left\vert T'(t)\right\vert}{\left\vert r'(t)\right\vert}]

kappa = T.diff(t).norm()/speed kappa1 = kappa(t=1) radius = 1/kappa1

The osculating circle touches the curve at the point pt, has radius radius and its center is directly in the normal direction from pt. Since the normal vector N1 has norm 1, the vector radius*N1 will be normal to the curve at pt, and when we place it to pt, the center of the osculating circle will be at its tip:

center = pt + radius*N1

The osculating circle will be inside the plane defined by the vectors T\mathbf{T} and N\mathbf{N}, which is called the osculating plane of the curve at the point pt. The vectors are orthogonal and unit, just like the standard basis vectors i\mathbf{i} and j\mathbf{j}. This means that you can use them to create a local cartesian coordinate system in the osculating plane, with horizontal axis pointing in the direction of T\mathbf{T} and vertical axis pointing in the direction of N\mathbf{N}, and center at the point pt.

In the standard coordinate system in the xyxy-plane, the vector equation of a circle with center at the origin and radius rr is [\mathbf{c}(t) = r\cos(t)\mathbf{i} + r\sin(t)\mathbf{j}, \quad 0 \le t \le 2\pi] Moving the center to another point means just adding the positin vector of the point.

In the osculating plane, all you need to do is replace the vectors i\mathbf{i} and j\mathbf{j} by T\mathbf{T} and N\mathbf{N}.

With that, you should be able to create the vector equation of the circle in the osculating plane, with radius radius, and center center.

Once you have the vector expression for the circle, you can use parametric_plot3d to plot the circle. You can then "add" this plot to the plots of the curve and the TNB frame to get the combined plot you are supposed to produce.