```python
import sympy as sm
```


```python
from sympy.physics.vector import init_vprinting
init_vprinting(use_latex='mathjax', pretty_print=False)
```


```python
from IPython.display import Image
Image('fig/2rp_new.png', width=300)
```


```python
from sympy.physics.mechanics import dynamicsymbols
```


```python
theta1, theta2, l1, l2 = dynamicsymbols('theta1 theta2 l1 l2')
theta1, theta2, l1, l2
```




$\displaystyle \left( \theta_{1}, \  \theta_{2}, \  l_{1}, \  l_{2}\right)$




```python
px = l1*sm.cos(theta1) + l2*sm.cos(theta1 + theta2) # tip psition in x-direction
py = l1*sm.sin(theta1) + l2*sm.sin(theta1 + theta2) # tip position in y-direction
```


```python
# evaluating the jacobian matrix 
a11 = sm.diff(px, theta1) # differentiate px with theta_1
a12 = sm.diff(px, theta2) # differentiate px with theta_2

a21 = sm.diff(py, theta1) # differentiate py with theta_1
a22 = sm.diff(py, theta2) # differentiate py with theta_2

J = sm.Matrix([[a11, a12], [a21, a22]]) # assemble into matix form
Jsim = sm.simplify(J) # simplified result
Jsim
```




$\displaystyle \left[\begin{matrix}- l_{1} \sin{\left(\theta_{1} \right)} - l_{2} \sin{\left(\theta_{1} + \theta_{2} \right)} & - l_{2} \sin{\left(\theta_{1} + \theta_{2} \right)}\\l_{1} \cos{\left(\theta_{1} \right)} + l_{2} \cos{\left(\theta_{1} + \theta_{2} \right)} & l_{2} \cos{\left(\theta_{1} + \theta_{2} \right)}\end{matrix}\right]$




```python
# Manipulator singularities

Jdet = sm.det(Jsim) #determinant of the jacobian matrix
detJ = sm.simplify(Jdet)
detJ
```




$\displaystyle l_{1} l_{2} \sin{\left(\theta_{2} \right)}$




```python
sm.solve(detJ, (theta2)) # slove detJ for theta_2
```




$\displaystyle \left[ 0, \  \pi\right]$




```python
# This means the manipulator will be in singular configuration when the angle  θ2  is either zero or it is  ±π ,
Image('fig/2rp_sing_config1.png', width=300)  # θ2=0 
```


```python
Image('fig/2rp_sing_config2.png', width=300) # θ2=±π 
```


```python

```

dc04763a33b59fe50c6495e74aeeb38157e1e830
ipynb
Jupyter Notebook
Jacobian--Singularity--2RP.ipynb
Eddy-Morgan/Jacobian--Singularity--2RP
37c86725c9b5cc87b926b20ef7eee5b68f9b4fc5
Apache-2.0
Jacobian--Singularity--2RP.ipynb
Eddy-Morgan/Jacobian--Singularity--2RP
37c86725c9b5cc87b926b20ef7eee5b68f9b4fc5
Apache-2.0
Jacobian--Singularity--2RP.ipynb
Eddy-Morgan/Jacobian--Singularity--2RP
37c86725c9b5cc87b926b20ef7eee5b68f9b4fc5
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES