```python
from IPython.display import Image
from IPython.core.display import HTML 
from sympy import *; x,h = symbols("x h")
Image(url= "https://i.imgur.com/6Jq28eO.png")
```









```python
# https://www.onlinemath4all.com/how-to-find-equation-of-tangent-to-the-curve.html
# screenshot,upload,copy to clipboard all at once with ShareX (not sponsored)
Image(url= "https://i.imgur.com/cdZ7reJ.png")
```









```python
expr0 = 2*x*cos(x)
x0 = pi
y0 = -2*pi
# m = derivative of expr0
expr0
```




$\displaystyle 2 x \cos{\left(x \right)}$




```python
#okay now we find the first derivative of the curve stored as a Function of x
def F(x):
    return 2*x*cos(x)   #not using lambdify here cause loop function errors
f(x)
```




$\displaystyle 2 x \cos{\left(x \right)}$




```python
def dF(x):    #d means d/dx of F(x)
    return limit(  (( F(x+h)-F(x) ) / h)  ,h,0)
dF(x)
```




$\displaystyle - 2 x \sin{\left(x \right)} + 2 \cos{\left(x \right)}$




```python
dF = diff(F(x))  #does the same thing in less code
dF
```




$\displaystyle - 2 x \sin{\left(x \right)} + 2 \cos{\left(x \right)}$




```python
# now that we have both variables we need  (x0,y0) and dF
# we can move on
Image(url= "https://i.imgur.com/DV4ROWu.png")
```









```python
#now we insert dF into point slope form with x0,y0
EofT = y0 + dF*(x - x0)
EofT
```




$\displaystyle \left(x - \pi\right) \left(- 2 x \sin{\left(x \right)} + 2 \cos{\left(x \right)}\right) - 2 \pi$




```python
simplify(EofT)   # simplify does some magic here and gives us our first correct answer m = -2
```




$\displaystyle - 2 \left(x - \pi\right) \left(x \sin{\left(x \right)} - \cos{\left(x \right)}\right) - 2 \pi$




```python
simplify??
```


```python
# from here it is just trial and error trying to find a sympy function that gives us b
# finding where we made the error proves to be difficult here. 
# is handwriting this better here?
# gut tells me b solution is simple since somehow we found m.
# maybe we have dF correct but made some error when doing point slope form?
#now we insert dF into point slope form with x0,y0
#EofT2 = y0 + dF*(x - x0)
#EofT2
#
dF = diff(F(x))  #does the same thing in less code
dF
# correct answer found by guessing 0, looking here at the original dF, it kind of looked like a point-slope for
```




$\displaystyle - 2 x \sin{\left(x \right)} + 2 \cos{\left(x \right)}$




```python
Image(url= "https://i.imgur.com/57Du8iT.png")
```









```python

```

7d258c136f16d4adac08bec39de14e581233f54a
ipynb
Jupyter Notebook
Calculus_Homework/WWB08.8.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Calculus_Homework/WWB08.8.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Calculus_Homework/WWB08.8.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Qwen/Qwen-72B
1. YES
2. YES