Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 142
Image: ubuntu2204
Kernel: SageMath 10.0

Graphing Functions and Solving Equations in CoCalc Assignment

Question 1

[1 point] Consider the function F(x)=x3+x2+xx2−x−2\displaystyle F(x) =\frac{x^3 + x^2 + x}{x^2 - x -2 }.

[Don't forget parentheses around the numerator and denominator.]

Part a

Graph this function in CoCalc with −5≤x≤5-5\le x \le 5. Your graph should not be very nice. The problem is the vertical asymptotes.

f(x)=(x^3 + x^2 +x)/ (x^2-x-2)
plot(f(x))
Image in a Jupyter notebook

Part b

Produce a new graph with −5≤x≤5-5\le x\le 5 and add ymin=−20\text{ymin}=-20 and ymax=20\text{ymax}=20. You should see a much nicer graph. Remember, the vertical lines at x=−1x=-1 and x=2x=2 are not actually part of the graph of the function.

If we want to show that a statement of the form "for all x, p(x) implies q(x)" is false, what do we need to do?

Question 2

[1 point] Consider the function h(x)=0.01x3−x2+5h(x)=0.01x^3-x^2+5.

[Make sure you type hh correctly, especially the 0.01 at the front]

Part a

Graph this function using the default window. Notice that no roots (zeros, x-intercepts) are visible. We know from precalc that a cubic polynomial has at least one and at most three roots.

h(x)=0.01*x^(3)-x^(2)+5

Part b

Create a new plot of hh with −10≤x≤10-10\le x \le 10. You should see two roots.

plot(h(x), xmin=-10, xmax=10)
Image in a Jupyter notebook

Part c

If you remember end behavior of polynomials, then you know that the y-values should go up as the x-values get bigger. On the previous graph, the y-values are heading down. That means this curve needs to turn around eventually, and when it does it will have to cross the x-axis again. Now try to graph again with −10≤x≤100-10\le x\le 100. This time, you should see the third root (but the first two may be hard to see now).

plot(h(x), xmin=-10, xmax=100)
Image in a Jupyter notebook

Question 3

[1 point] Graph f(x)=x3f(x)=x^3 and g(x)=−2(x+1)3+4g(x)=-2(x+1)^3+4 on the same axes with −5≤x≤5-5\le x \le 5 and −10≤y≤10-10 \le y \le 10.

Use two different colors and two different line styles.

f(x)=x^3 g(x)= -2*((x+1)^3)+4 plot(f(x), xmin=-5, xmax=5, ymin=-10, ymax=10, color='red', linestyle='--') + plot(g(x), xmin=-5, xmax=5, ymin=-10, ymax=10, color= 'blue', linestyle= ':')
Image in a Jupyter notebook

Question 4

[1 point] Use the solve command to solve the equations below.

Part a

Solve for xx: x3−4x2+x+6=0\quad x^3 - 4x^2 + x + 6=0

solve([x^(3)-4*x^+x+6 == 0], x)
[x == 1/2*(4*x^x - 6)^(1/3)*(I*sqrt(3) - 1), x == -1/2*(4*x^x - 6)^(1/3)*(I*sqrt(3) + 1), x == (4*x^x - 6)^(1/3)]

Part b

Solve for mm: mm+a+1m2+b=1\quad\displaystyle \frac{m}{m+a}+\frac{1}{m^2+b}=1

[Don't forget parentheses around the denominators, and declare variables.]

var('m', 'a', 'b') M= solve([m/(m+a) + 1/(m^2+b) == 1], m) show (M[0]) show(M[1])

m=−−4 a2b+4 a2+1−12 a\displaystyle m = -\frac{\sqrt{-4 \, a^{2} b + 4 \, a^{2} + 1} - 1}{2 \, a}

m=−4 a2b+4 a2+1+12 a\displaystyle m = \frac{\sqrt{-4 \, a^{2} b + 4 \, a^{2} + 1} + 1}{2 \, a}

Question 5

[2 points] Consider the equation xx=7x^x=7.

Part a

Plot this equation with 0<x<30 < x < 3 (remember to use two equal signs when typing the equation).

[Your graph should have only one curve.]

f(x) = x^x == 7 plot(f(x), xmin=0, xmax=3, linestyle='-')
Image in a Jupyter notebook

Part b

Adjust the plot window (zoom in) to approximate to two decimal places the x-intercept of the graph (this is the solution of the equation).

plot(f(x), xmin=2.0, xmax=2.5, linestyle='-')
Image in a Jupyter notebook

Part c

Use find_root to solve for xx.

f(x) = x^x==7 find_root(f(x), 2, 3)
2.3164549587856125

Question 6

[2 points] Consider the equation ex=x3e^x=x^3.

Part a

Graph y=exy=e^x and y=x3y=x^3 on the same axes, and adjust the window until you can clearly see two points of intersection.

[Your graph should have two curves.]

Note: e is not a variable, it is a built-in constant. Never declare e.

f(x) = e^x g(x) = x^3 var('x') S = solve ([f(x) == g(x)], x) show(S[0]) show(S[1]) show(S[2])

x=12 (i 3−1)e(13 x)\displaystyle x = \frac{1}{2} \, {\left(i \, \sqrt{3} - 1\right)} e^{\left(\frac{1}{3} \, x\right)}

x=−12 (i 3+1)e(13 x)\displaystyle x = -\frac{1}{2} \, {\left(i \, \sqrt{3} + 1\right)} e^{\left(\frac{1}{3} \, x\right)}

x=e(13 x)\displaystyle x = e^{\left(\frac{1}{3} \, x\right)}

Part b

Solve this equation for xx using find_root (remember, there are two real solutions).

find_root(f(x) ==g(x), 4, 5)
4.536403654973527
find_root(f(x) ==g(x), 1, 3)
1.8571838602078348

Question 7

[1 point] Use the solve command to solve the inequality x3−3x>4x2+2x^3-3x>4x^2+2.

var('x') show(solve([x^3-3*x > 4*x^2 + 2], x))

[[x>4.72457627118644]]\displaystyle \left[\left[x > 4.72457627118644\right]\right]

Question 8

[1 point] Use the solve command to solve the system:

x−y=5\quad x-y=5

x+2y=9\quad x+2y=9

var('x, y') show(solve([x - y == 5, x + 2*y ==9], x, y))

[[x=(193),y=(43)]]\displaystyle \left[\left[x = \left(\frac{19}{3}\right), y = \left(\frac{4}{3}\right)\right]\right]