{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
"(s, t)"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%display typeset\n",
"var('s,t')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"R=2\n",
"def x(s,t):\n",
" return (R+s*cos(t/2))*cos(t)\n",
"\n",
"def y(s,t):\n",
"\treturn (R+s*cos(t/2))*sin(t)\n",
"\n",
"def z(s,t):\n",
"\treturn s*sin(t/2)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n"
],
"text/plain": [
"Graphics3d Object"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cm = colormaps.Greens\n",
"def c(s,t):\n",
"\treturn 0.5+0.5*sin(t)**2\n",
"\n",
"S=parametric_plot3d((x(s,t), y(s,t), z(s,t)), (s,-1,1), (t,0,2*pi), color = (c,cm))\n",
"show(S)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n"
],
"text/plain": [
"Graphics3d Object"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Bord = parametric_plot3d((x(-1,t), y(-1,t), z(-1,t)), (t,0,2*pi), color=\"red\", thickness =3)\n",
"show(S+Bord)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 9.0",
"language": "sage",
"name": "sagemath"
},
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}