# Point Lander Model with Drag


```python
from sympy import *
init_printing()
```


```python
# State
x, y, vx, vy, m = symbols('x y vx vy m')
r = Matrix([x, y])
v = Matrix([vx, vy])
s = Matrix([r, v, [m]])
# Control
u, theta = symbols('u theta')
# Parameters
c1, c2, c3, g, a = symbols('c1 c2 c3 g a')
```


```python
# State Dynamics
vnorm = v.norm()
vhat  = v/vnorm
print vhat
dx = vx
dy = vy
dvx = c1*u/m*cos(theta) - c3*(vnorm**2)*vhat[0]/m
dvy = c1*u/m*sin(theta) - g - c3*(vnorm**2)*vhat[1]/m
dm = -c1*u/c2
ds = Matrix([dx, dy, dvx, dvy, dm])
```

    Matrix([[vx/sqrt(Abs(vx)**2 + Abs(vy)**2)], [vy/sqrt(Abs(vx)**2 + Abs(vy)**2)]])



```python
# Homotopic Cost Lagrangian
L = a*c1 / c2 * u + (1-a) * c1**2 /c2 * u**2
```


```python
# Hamiltonian
H = l.dot(ds) + L
```


```python
# Costate Dynamics
dl = -Matrix([diff(H, i) for i in s])
dl
```


```python

```

db49bf4a6edf98c32a81fccf19ddadb032eb2e1b
ipynb
Jupyter Notebook
src/Notebook/Lander Model.ipynb
cisprague/Astro.IQ
4e2df67ddc0ffc518c4f65d0bf558380e6a7c6d1
MIT
2017-11-21T18:25:52.000Z
2022-03-16T18:18:41.000Z
src/Notebook/Lander Model.ipynb
siddharthdeore/Astro.IQ
4e2df67ddc0ffc518c4f65d0bf558380e6a7c6d1
MIT
2017-08-16T19:51:03.000Z
2017-11-14T21:03:18.000Z
src/Notebook/Lander Model.ipynb
siddharthdeore/Astro.IQ
4e2df67ddc0ffc518c4f65d0bf558380e6a7c6d1
MIT
2019-07-08T23:10:11.000Z
2022-03-15T15:32:53.000Z
Qwen/Qwen-72B
1. YES
2. YES