Skip to content

Commit

Permalink
Documentation build - no history
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 11, 2023
0 parents commit 5f6da2f
Show file tree
Hide file tree
Showing 314 changed files with 87,267 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
154 changes: 154 additions & 0 deletions _downloads/01d26ddfe66a9569b4cf79881141dece/cross_product_error.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"metadata": {
"name": "cross_product_error"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The error in a cross product calculation with (3,) tuples"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import Symbol, symarray, Matrix, matrices\n",
"u = Matrix(symarray('u', (3, 1)))\n",
"v = Matrix(symarray('v', (3, 1)))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c = u.cross(v)\n",
"c"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 2,
"text": [
"[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]"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Assuming same error $\\delta$ for both vectors:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"d = Symbol('d')\n",
"e = matrices.ones((3,1)) * d"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Same calculation as above, with error"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ue = u + e\n",
"ve = v + e\n",
"ce = ue.cross(ve)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calculate absolute error by subtracting true result from result with error"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cce = ce - c\n",
"cce.simplify()\n",
"cce"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 5,
"text": [
"[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)]"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Floating point calculation error given by operations on elements:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 6,
"text": [
"[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]"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each element has two products and one subtraction; The input values are $\\le 1$. Calculation error per element then $3 \\epsilon / 2$"
]
}
],
"metadata": {}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit 5f6da2f

Please sign in to comment.