## Definition

Given the parametric equation of a logarithmic spiral:

$$
x(t) = ae^{bt} \cos(t)
\\
y(t) = ae^{bt} \sin(t)
$$

Then the curvature $\kappa$ of the spiral is given by:

$$
\kappa (t) = \frac{ e^{-bt} } {a\sqrt{1 + b^2}}
$$

where $t$ is the tangential angle.

## Objective

Given the general definition of the curvature of a parametric curve in the xy plane:

$$
\kappa = \left \| \frac{d\mathbf{T}}{dt} \right \| = \frac{| \dot{x}\ddot{y} - \dot{y}\ddot{x} |}{{(\dot{x}^2 + \dot{y}^2)} ^ { \frac{3}{2} }}
$$

Recover the above curvature equation of a logarithmic spiral using sympy.


```python
from sympy import *
init_printing()

# Define variables
x, y, t = symbols('x y t')
a, b = symbols('a b')

# Spiral equation
x = a * exp(b*t) * cos(t)
y = a * exp(b*t) * sin(t)

x, y
```


```python
# Get derivatives
xd = diff(x, t)
yd = diff(y, t)
xdd = diff(xd, t)
ydd = diff(yd, t)

# Define the true curvature equation
true_curvature = exp(- b * t) / (a * sqrt(1 + b**2))
true_curvature
```


```python
# Compute curvature
curvature = Abs(xd * ydd - yd * xdd) / (xd**2 + yd**2)**(3/2)
curvature
```


```python
curvature = curvature.simplify()
curvature
```


```python
args = {'a': 14, 'b': 5, 't': 0.2}
true_curvature.subs(args).evalf()
```


```python
curvature.subs(args).evalf()
```


```python
expand(true_curvature - curvature)
```

The newly computed `curvature` expression give the same result as the `true_curvature` expression given in the textbooks.

25f572697fd831d1364431ed848001019af17beb
ipynb
Jupyter Notebook
Analysis/Notebooks/Spiral Dataset/Spiral Curvature Calculus.ipynb
brouhardlab/kappa
2e74530e54fc02e08e03e56a4a33ece6c7ce9941
MIT
2017-11-29T15:09:50.000Z
2020-12-04T11:08:17.000Z
Analysis/Notebooks/Spiral Dataset/Spiral Curvature Calculus.ipynb
brouhardlab/kappa
2e74530e54fc02e08e03e56a4a33ece6c7ce9941
MIT
2017-11-17T19:20:10.000Z
2020-08-16T16:33:31.000Z
Analysis/Notebooks/Spiral Dataset/Spiral Curvature Calculus.ipynb
brouhardlab/kappa
2e74530e54fc02e08e03e56a4a33ece6c7ce9941
MIT
2017-10-13T02:24:17.000Z
2022-03-16T01:14:59.000Z
Qwen/Qwen-72B
1. YES
2. YES