Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for...
16
Symbolic Code Generation & Differentiation Doug James
Transcript of Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for...
![Page 1: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/1.jpg)
Symbolic Code Generation& Differentiation
Doug James
![Page 2: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/2.jpg)
Motivation: Bending Force
Now take a second derivative!
![Page 3: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/3.jpg)
Symbolic math tools
• Useful for differentiation & optimized code gen.
• Examples:
• Maple
• Matlab
• Mathematica
• ...
![Page 4: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/4.jpg)
Motivation 2:Newton-Schulz Iteration
• See whiteboard
![Page 5: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/5.jpg)
Example 1Evaluate the algebraic expression
where
![Page 6: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/6.jpg)
Example 1
![Page 7: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/7.jpg)
Example 1
![Page 8: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/8.jpg)
Example 2
![Page 9: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/9.jpg)
Example 2
![Page 10: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/10.jpg)
Example 2
Doh!Doh!
Doh!Doh!
Doh!
Doh!
![Page 11: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/11.jpg)
Example 3: Newton-Schulz Iteration
• See code
![Page 12: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/12.jpg)
Example 4: Neo-Hookean material
![Page 13: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/13.jpg)
Example 4: Neo-Hookean material
![Page 14: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/14.jpg)
Example 4: Ogden material
See code output(!)
![Page 15: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/15.jpg)
Automatic Differentiation:Many compilers available
![Page 16: Symbolic Code Generation & Differentiation · 2009. 2. 4. · Symbolic math tools • Useful for differentiation & optimized code gen. • Examples: • Maple • Matlab • Mathematica](https://reader036.fdocuments.in/reader036/viewer/2022071420/611959134a14fe647b043006/html5/thumbnails/16.jpg)
Automatic Differentiation:Many compilers available