Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
483 views

##Lab 6 Symmetry of functions and their modifications

%md First we'll look at the three types of symmetry--**x-axis, y-axis and origin**. Recall that a function that is symmetric with respect to the y-axis is classified as an **even** function and one that is symmetric w.r.t. the orgin is classified as an **odd** function. A relation that is symmetric w.r.t. the x-axis is NOT a function as it obviously fails the vertical line test!! You will also see a new *plot* command called **implicit_plot

First we'll look at the three types of symmetry--x-axis, y-axis and origin.

%md y-axis symmetry means that all points on the function on one side of the x-axis have mirror images on the other side. Numerically, this means that the opposite of the x-value, *-x*, produces the same function- or y-value. Examine and execute the command block below to see if the $f(x)=x^4-3x^2$ is symmetric w.r.t. the y-axis and thus even. ce763147-a7dc-4926-9299-05ab74ef4254s︠ x,y=var('x,y') f(x)=x^4-3*x^2 f(x)==f(-x) ︠6256305d-101c-4f1c-afc6-318677377253 %md Since the sides of the equation are identical, we can assume that the function has x-axis symmetry and thus is even. You create a command block to now see if the function, $f(x)=5x^3-7x$ is symmetric w.r.t. the origin by setting f(-x)=-f(x)$. In other words, replacing x with its opposite produces the opposite y-value. Graphically, a function point that appears anywhere has a mirror image after rotating around the origin 180 degrees. a12bdcb1-0d50-4d43-9665-d472e1ddd933︠ ︠7723a8ca-5f0b-4fa8-b87f-caee78ad8862︠ ︠6952310b-aff5-4fd8-825c-300e2a3739be︠ %md Now let's look at implicitly defined functions or relations like $x^2+3y^2=18$. Study the command block below to see how the new graphing command works. I first run the numerical tests for x-axis and origin symmetry. 9903074d-e8c1-4e11-a00f-9c4216da1dbf︠ x,y=var('x,y') f(x,y)=x^2+3*y^2-18#this is a function of 2 variables created by setting one side equal to zero! show(f(x,y)) show(f(x,y)==f(-x,y))#testing for x-axis symmetry show(f(x,y))==f(-x,-y)#testing for symmetry w.r.t. origin #here comes the new implicit plot command: implicit_plot(f(x,y),(x,-5,5),(y,-5,5),axes='true')# you can other plot options to spruce up the plot as well. The three required arguments for this command are in this order: (1)a function of 2 variables, (2)horizontal variable with its range, (3)vertical variable with its range. ︠6b8b928c-d0dc-46dd-ae32-d44f8d2a793fis︠ %md The relation we looked at above was not a function. But it does have both x-axis and y-axis symmetry. It does not have symmetry w.r.t. the origin. Practice your skills as you test these for symmetry and create plots. 1. $f(x)=5x^4-3x^2+4$ 2. $g(x)=x^(1/3)-x/4$ 3. $x^2-3xy+y^2=0$ Use the implicit_plot command here.

The relation we looked at above was not a function. But it does have both x-axis and y-axis symmetry. It does not have symmetry w.r.t. the origin. Practice your skills as you test these for symmetry and create plots.

  1. f(x)=5x43x2+4f(x)=5x^4-3x^2+4

  2. g(x)=x(1/3)x/4g(x)=x^(1/3)-x/4

  3. x23xy+y2=0x^2-3xy+y^2=0 Use the implicit_plot command here.

%md Let's investigate modifications to the graphs of functions. One general rule to keep in mind is this: **When you want to alter a graph vertically to adjust the function's output. Horizontal modifications are achieved by adjusting the input(x-variable)**. It's going to take a little extra code to get the job done. You'll also be introduced to the idea of a *for* loop that does the same thing with different values of a list repeatedly. The blocks of code below will eventually result in single graphs of multiple functions graphed together. I am using two separate blocks since I have to use the answers from the first block to create the second block of commands. There is a more direct way but we don't want to go there just yet! The first two blocks will demonstrate how to shift a function **vertically** and the second two will shift the same function horizontally. The final two blocks will shift a function both vertically and horizontally simultaneously. ff6630d7-3392-4b29-ba3e-9b2c69b3bfeas︠ vert_adjustment=[-2,-1,1,2]#list of values for shifting f(x,v)=x^2+v#This is just the basic x-squared function just using two variables #the loop sequence that generates for different function expressions: for v in vert_adjustment: f(x,v)
x^2 - 2 x^2 - 1 x^2 + 1 x^2 + 2
#I use copy and paste with solutions above to create single plot of the list of 4 functions above. You execute to see plot plot([x^2,x^2-2,x^2-1,x^2+1,x^2+2],(x,-2,2))#notice that the brackets indicate a list! ︠1f2d651b-84e5-440f-aa37-d5990f97118ds︠ #Now to shift horizontally. . . hor_adjustment=[-1,-.5,.5,1] f(x,h)=(x-h)^2 for h in hor_adjustment: f(x,h)
(x + 1)^2 (1.00000000000000*x + 0.500000000000000)^2 (1.00000000000000*x - 0.500000000000000)^2 (x - 1)^2
plot([x^2,(x + 1)^2,(1.00000000000000*x + 0.500000000000000)^2,(1.00000000000000*x - 0.500000000000000)^2,(x - 1)^2],(x,-2,2))#you execute to see plot ︠19b75d14-1575-4307-bd59-bff2f6738400is︠ %md Your turn! You modify the simple cubic, $x^3-x$, in three ways: (1)stretch/squeeze it vertically by the two different factors 3 and 1/3. The final plot should consist of the original function and the two modified versions; (2)stretch/squeeze the same cubic horizontally by the same two factors; (3)Reflect or flip the cubic over the x-axis by negating the function. This last item won't involve the use of the *for* loop.

Your turn! You modify the simple cubic, x3xx^3-x, in three ways: (1)stretch/squeeze it vertically by the two different factors 3 and 1/3. The final plot should consist of the original function and the two modified versions; (2)stretch/squeeze the same cubic horizontally by the same two factors; (3)Reflect or flip the cubic over the x-axis by negating the function. This last item won't involve the use of the for loop.

︠31a3a0f7-ebfe-4152-9892-29198e3bb170︠ ︠5e5e1e46-beda-450b-b8ca-6adf51aae0b2︠ ︠9fc0dba5-a261-4c9c-8d5b-762a9afc94dd︠