{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "29cc1cd9", "metadata": {}, "outputs": [], "source": [ "import sympy as sm\n", "import sympy.physics.mechanics as me\n", "me.init_vprinting()" ] }, { "cell_type": "code", "execution_count": null, "id": "306ec154", "metadata": {}, "outputs": [], "source": [ "theta, beta, alpha, l = me.dynamicsymbols('theta, beta, alpha, l')\n", "A, B, C, D = sm.symbols('A, B, C, D', cls=me.ReferenceFrame)" ] }, { "cell_type": "code", "execution_count": null, "id": "90e849d3", "metadata": {}, "outputs": [], "source": [ "B.orient_axis(A, theta, A.z)\n", "C.orient_axis(B, beta, -B.x)\n", "D.orient_axis(C, alpha, C.z)" ] }, { "cell_type": "code", "execution_count": null, "id": "40be21c1", "metadata": {}, "outputs": [], "source": [ "r = l*D.x\n", "r" ] }, { "cell_type": "code", "execution_count": null, "id": "005f5954", "metadata": {}, "outputs": [], "source": [ "r.express(C)" ] }, { "cell_type": "code", "execution_count": null, "id": "7d90975b", "metadata": {}, "outputs": [], "source": [ "r.express(B)" ] }, { "cell_type": "code", "execution_count": null, "id": "9c91de67", "metadata": {}, "outputs": [], "source": [ "r.express(A)" ] }, { "cell_type": "code", "execution_count": null, "id": "61739b20", "metadata": {}, "outputs": [], "source": [ "r.dot(C.x).diff(alpha)" ] }, { "cell_type": "code", "execution_count": null, "id": "74ea1e2a", "metadata": {}, "outputs": [], "source": [ "r.dot(C.y).diff(alpha)" ] }, { "cell_type": "code", "execution_count": null, "id": "004fc719", "metadata": {}, "outputs": [], "source": [ "r_alpha_C = r.dot(C.x).diff(alpha)*C.x + r.dot(C.y).diff(alpha)*C.y\n", "r_alpha_C" ] }, { "cell_type": "code", "execution_count": null, "id": "b8dd3f05", "metadata": {}, "outputs": [], "source": [ "r.diff(alpha, C).express(C).simplify()" ] }, { "cell_type": "code", "execution_count": null, "id": "43ca6e43", "metadata": {}, "outputs": [], "source": [ "theta, beta, alpha, l" ] }, { "cell_type": "code", "execution_count": null, "id": "98391ce8", "metadata": {}, "outputs": [], "source": [ "t = me.dynamicsymbols._t" ] }, { "cell_type": "code", "execution_count": null, "id": "eb9c6a9c", "metadata": {}, "outputs": [], "source": [ "theta.diff(t)" ] }, { "cell_type": "code", "execution_count": null, "id": "6c5e0e4e", "metadata": {}, "outputs": [], "source": [ "r" ] }, { "cell_type": "code", "execution_count": null, "id": "04ca107c", "metadata": {}, "outputs": [], "source": [ "r.diff(t, D)" ] }, { "cell_type": "code", "execution_count": null, "id": "b9838b67", "metadata": {}, "outputs": [], "source": [ "r.diff(t, A).simplify()" ] }, { "cell_type": "code", "execution_count": null, "id": "58ea7722", "metadata": {}, "outputs": [], "source": [ "r.dt(A)" ] }, { "cell_type": "code", "execution_count": null, "id": "515167b9", "metadata": {}, "outputs": [], "source": [ "r.dt(D)" ] }, { "cell_type": "code", "execution_count": null, "id": "d0bcd160", "metadata": {}, "outputs": [], "source": [ "q = t*A.y\n", "q" ] }, { "cell_type": "code", "execution_count": null, "id": "d64c89f1", "metadata": {}, "outputs": [], "source": [ "q.dt(A).dt(B)" ] }, { "cell_type": "code", "execution_count": null, "id": "a8a7c77c", "metadata": {}, "outputs": [], "source": [ "q.dt(B).dt(A)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }