The error in a cross product calculation with (3,) tuples


```
from sympy import Symbol, symarray, Matrix, matrices
u = Matrix(symarray('u', (3, 1)))
v = Matrix(symarray('v', (3, 1)))
```


```
c = u.cross(v)
c
```




    [u_1_0*v_2_0 - u_2_0*v_1_0, -u_0_0*v_2_0 + u_2_0*v_0_0, u_0_0*v_1_0 - u_1_0*v_0_0]



Assuming same error $\delta$ for both vectors:


```
d = Symbol('d')
e = matrices.ones((3,1)) * d
```

Same calculation as above, with error


```
ue = u + e
ve = v + e
ce = ue.cross(ve)
```

Calculate absolute error by subtracting true result from result with error


```
cce = ce - c
cce.simplify()
cce
```




    [d*(u_1_0 - u_2_0 - v_1_0 + v_2_0), d*(-u_0_0 + u_2_0 + v_0_0 - v_2_0), d*(u_0_0 - u_1_0 - v_0_0 + v_1_0)]



Floating point calculation error given by operations on elements:


```
c
```




    [u_1_0*v_2_0 - u_2_0*v_1_0, -u_0_0*v_2_0 + u_2_0*v_0_0, u_0_0*v_1_0 - u_1_0*v_0_0]



Each element has two products and one subtraction; The input values are $\le 1$.  Calculation error per element then $3 \epsilon / 2$

1889c3be7d53dc217742bab5f426be9efcdd51e6
ipynb
Jupyter Notebook
doc/source/notebooks/cross_product_error.ipynb
tobon/nibabel
ff2b5457207bb5fd6097b08f7f11123dc660fda7
BSD-3-Clause
2015-10-01T01:13:59.000Z
2015-10-01T01:13:59.000Z
doc/source/notebooks/cross_product_error.ipynb
tobon/nibabel
ff2b5457207bb5fd6097b08f7f11123dc660fda7
BSD-3-Clause
2015-11-13T03:05:24.000Z
2016-08-06T19:18:54.000Z
doc/source/notebooks/cross_product_error.ipynb
tobon/nibabel
ff2b5457207bb5fd6097b08f7f11123dc660fda7
BSD-3-Clause
2019-02-27T20:48:03.000Z
2019-02-27T20:48:03.000Z
Qwen/Qwen-72B
1. YES
2. YES