```python
import sympy as sy
from sympy import diff
from sympy.abc import x
from sympy import Function
#f = Function('f')
```


```python
f = 1/(x+1)
f

```




$\displaystyle \frac{1}{x + 1}$




```python
diff(f,x).subs(x,-5)

```




$\displaystyle - \frac{1}{16}$




```python
diff(f,x).subs(x,-3)

```




$\displaystyle - \frac{1}{4}$




```python
diff(f,x).subs(x,0)
```




$\displaystyle -1$




```python
diff(f,x).subs(x,2)


```




$\displaystyle - \frac{1}{9}$




```python
from sympy import sin, cos
import sympy as sy
from sympy import simplify
from sympy import sympify
x = sy.symbols('x)')
```


```python
expr = sin(x)**2 +cos(x)**2
expr
```




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




```python
simplify(expr)
```




$\displaystyle 1$




```python
sympify('r + cos(x)**2')
```




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




```python
from sympy import Matrix
wwb05 = Matrix([[0,2,4,6,8,10,12], 
                [13,16,18,19,18,14,11]]) 
print("x = top row(left to right)            f(x) = bottom row")
wwb05


```

    x = top row(left to right)            f(x) = bottom row





$\displaystyle \left[\begin{matrix}0 & 2 & 4 & 6 & 8 & 10 & 12\\13 & 16 & 18 & 19 & 18 & 14 & 11\end{matrix}\right]$




```python
x = wwb05[0:7]
print("x-values are stored in variable x as Matrix slice:",x)
```

    x-values are stored in variable x as Matrix slice: [0, 2, 4, 6, 8, 10, 12]



```python
def func(x):
    return wwb05[7:15]
print("f(x) values are stored in variable x as Matrix slice:",func(x))
```

    f(x) values are stored in variable x as Matrix slice: [13, 16, 18, 19, 18, 14, 11]



```python
rot = Matrix([[0,2,4,6,8,10,12], 
              [13,16,18,19,18,14,11]]) 
from sympy.matrices import Matrix
from sympy.abc import x, y
M = Matrix([[x, 0,2,4,6,8,10,12], [y, 13,16,18,19,18,14,11]])
M
```




$\displaystyle \left[\begin{matrix}x & 0 & 2 & 4 & 6 & 8 & 10 & 12\\y & 13 & 16 & 18 & 19 & 18 & 14 & 11\end{matrix}\right]$




```python
M.diff(x)
```




$\displaystyle \left[\begin{matrix}1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\end{matrix}\right]$




```python
f = sy.Function('f')
def f(x):
    return 1/x
diffqot = f(x.subs(x,3)) - f(x.subs(x,0.4))
diffqot
```




$\displaystyle -2.16666666666667$




```python
t,h = sy.symbols('t,h')
A,B,C = sy.symbols("A,B,C",constant=True, real=True) 
# line above this is obsolete code (see cell 185)
# I am not sure on problem 6 of WWB05 about the constants "A,B,C"
# Are these integers, real numbers, rational?

def f(t):
    return -5 - 11*t
```


```python
diff(f(t))
```




$\displaystyle -11$




```python
f = sy.Function('f')
def f(x):
    return -2 -7*sy.sqrt(x)
```


```python
f(x)
```




$\displaystyle - 7 \sqrt{x} - 2$




```python

```


```python
expr0 = (f(x+h) - f(x))/h
expr0
```




$\displaystyle \frac{7 \sqrt{x} - 7 \sqrt{h + x}}{h}$




```python

expr0_rewritten =   A /  ( sy.sqrt(B*x + C*h) + sy.sqrt(x) )
expr0_rewritten
```




$\displaystyle \frac{A}{\sqrt{x} + \sqrt{B x + C h}}$




```python
from sympy import simplify
sy.simplify(expr0)
```




$\displaystyle \frac{7 \left(\sqrt{x} - \sqrt{h + x}\right)}{h}$




```python
exp5 = sy.simplify(expr0)
exp5
```




$\displaystyle \frac{7 \left(\sqrt{x} - \sqrt{h + x}\right)}{h}$




```python

```

5eb19d8cd8ee61aebf2fde9d307e41100a2b5632
ipynb
Jupyter Notebook
Personal_Projects/SympyPractice.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Personal_Projects/SympyPractice.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Personal_Projects/SympyPractice.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Qwen/Qwen-72B
1. YES
2. YES