Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23...
15
Symbolic and Automatic Differentiation & Code Generation Doug James
Transcript of Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23...
![Page 1: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/1.jpg)
Symbolic and Automatic Differentiation & Code Generation
!Doug James
![Page 2: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/2.jpg)
Motivation: Bending Force
Now take a second derivative!
![Page 3: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/3.jpg)
Symbolic math tools
• Useful for differentiation & optimized code gen.
• Examples:
• Maple
• Matlab
• Mathematica
• ...
![Page 4: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/4.jpg)
Motivation 2: Newton-Schulz Iteration
• See whiteboard
![Page 5: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/5.jpg)
Example 1Evaluate the algebraic expression
where
![Page 6: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/6.jpg)
Example 1
![Page 7: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/7.jpg)
Example 1
![Page 8: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/8.jpg)
Example 2
![Page 9: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/9.jpg)
Example 2
Doh!Doh!
Doh!Doh!
Doh!
Doh!
![Page 10: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/10.jpg)
Example 3: Newton-Schulz Iteration
• See code
![Page 11: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/11.jpg)
Example 4: Neo-Hookean material
![Page 12: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/12.jpg)
Example 4: Neo-Hookean material
![Page 13: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/13.jpg)
Example 4: Ogden material
See code output(!)
![Page 14: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/14.jpg)
Automatic Differentiation: Many compilers available
![Page 15: Symbolic and Automatic Differentiation & Code Generation · t5 = tll = t12 t18 t19 t21 = t22 t23 t25 = t26 t31 = t32 = t31*t31; t34 = Sm02*sm02 , t35 = Sm12*sm12 t36 = sm22*sm22 t38](https://reader034.fdocuments.net/reader034/viewer/2022042807/5f816e0550b25869262a44c3/html5/thumbnails/15.jpg)
Automatic Differentiation: Many compilers available