Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 173
Kernel: SageMath (stable)

Final Exam

Name: Edgar Arevalo

Score:

Rules for writing in this notebook

  • Insert your name in the first cell of this notebook

  • Answer every part of the mini project in a different cell.

  • To insert a cell use the menu item Insert

  • State the input(s) and output(s) before each of your functions

  • Give your functions suggestive names

  • Restrict the size of figures that you create

J## Mini project 4: Area of a tilted ellipse

Problem formulation

Consider the equation of a conic Ax2+2Bxy+cy2=D A*x^2+2B*x*y+c*y^2=D with ACB2>0.A*C-B^2>0. Recall that the condition means that the conic is an ellipse.

  1. (manual) Use completing the square technique to rewrite the given equation in the form (x+ky)2/a2+y2/b2=1,(x+k*y)^2/a^2+y^2/b^2=1, where a,k,ba,k,b are expressions depending on the parameters of the given ellipse.

let k=B/A, a=D/A, and b=D/(A*C-B^2/A)

(x+B/Ay)2/(D/A)+y2/D/(ACB2/A)=1(x+B/A*y)^2/(D/A)+y^2/D/(A*C-B^2/A)=1
  1. Show that if the shear transformation defined by the matrix M=[1k01]M = \left[ \begin{smallmatrix} 1&k\\ 0&1 \end{smallmatrix} \right] is applied to the points x,yx,y of the standard ellipse x2/a2+y2/b2=1,x^2/a^2+y^2/b^2=1, the reslting curve has the equation that you derived in part 1. Use this fact to derive the formula for the area of the given ellipse in terms of parameters A,B,C,D.A, B, C, D.

M=[1B/A01]M = \left[ \begin{smallmatrix} 1&B/A\\ 0&1 \end{smallmatrix} \right]

(X)2/(D/A)+y2/D/(ACB2/A)=1(X)^2/(D/A)+y^2/D/(A*C-B^2/A)=1
  1. Write a function that takes parameters A,B,C,DA, B, C, D, checks the condition ACB2>0A*C-B^2>0 and, if the condition is true, returns the area of the given ellipse. If the condition is false, your function returns the string "The conic is not ellipse."

  2. Test your function on example of your choice. Plot the given ellipse and the corresponding standard ellipse in one figure.

def area_el(A,B,C,D): if A*C-B^2>0: return (D/A)*(D/(A*C-B^2)/A)*pi else: return "The conic is not ellipse" area_el(2,1,3,1)
1/20*pi
var"x y" G = 2*x^2+2*1*x*y+3*y^2==1 P = x^2/(1/2)+y^2/(1/1*3-1^2/2)==1
File "<ipython-input-10-026dfbce6afb>", line 1 var"x y" ^ SyntaxError: invalid syntax
G.show()
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-7-3953782f1ed5> in <module>() ----> 1 G.show() NameError: name 'G' is not defined
#1) #Ax2+2Bxy+Cy^2=D #A(x^2+Bxy/A+(By/A)^2-(By/A)^2 #A(x+Bx/A)^2-(By/A)^2+Cy^2=D #A(x+Bx/A)^2-y^2(B^2/A+C)=D #(x+B/A*y)^2/(D/A)+y^2/D/(A*C-B^2/A)=1