Last active
March 7, 2024 18:18
-
-
Save empet/f405db9e29ff99ccbf09a36da9fbea36 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "## Breather Pseudospherical Surfaces ##" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| " Theoretical background in *C. Rogers and W. K. Schief - Bäcklund and Darboux Transformations.\n", | |
| "Geometry and Modern Applications in Soliton Theory*." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "using PlotlyJS" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "function breather_param(u::T, v::T, p::Int, q::Int) where T<:Real\n", | |
| " #p, q are coprime integers\n", | |
| " b = p/q \n", | |
| " a = sqrt(1-b^2)\n", | |
| " d = b^2*(cosh(a*u))^2 + a^2*(sin(b*v))^2\n", | |
| " f1 = (sin(b*v)*cosh(a*u))/d\n", | |
| " f2 = cosh(a*u)/d\n", | |
| "\n", | |
| " x = (2*b/a)*f1 *sin(v) +(2*b^2/a)*f2 * cos(v)*cos(b*v)\n", | |
| " y = -(2*b/a)*f1 *cos(v) +(2*b^2/a)*f2 * sin(v)*cos(b*v) \n", | |
| " z = u -(2*b^2/a)*f2 *sinh(a*u)\n", | |
| " return (x, y, z)\n", | |
| "end" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "function breather_plot(p::Int, q::Int)\n", | |
| " ul = range(-6, 6, 300)\n", | |
| " vl = range(0, 2*pi*q/p , 400)\n", | |
| " v = vl * ones(size(ul))'\n", | |
| " u = ones(size(vl))*ul'\n", | |
| " br = breather_param.(u, v, p, q);\n", | |
| " fig=Plot(surface(x=getindex.(br, 1), \n", | |
| " y=getindex.(br, 2), \n", | |
| " z=getindex.(br, 3), \n", | |
| " colorscale=[[0, \"#e26152\"], [1, \"#e26152\"]], \n", | |
| " showscale=false,\n", | |
| " lighting=attr(ambient=0.45,\n", | |
| " diffuse=0.35,\n", | |
| " fresnel=0.5, \n", | |
| " specular=0.25,\n", | |
| " roughness=0.45\n", | |
| " ),\n", | |
| " lightposition=attr(x=100,\n", | |
| " y=100,\n", | |
| " z=-100)\n", | |
| " ))\n", | |
| " \n", | |
| " relayout!(fig, \n", | |
| " title_text=\"Breather Pseudospherical Surface<br>(p, q)=($p, $q)\",\n", | |
| " title_x=0.5, title_font_color=\"white\",\n", | |
| " font_family=\"Open Sherif\",\n", | |
| " width=600,\n", | |
| " height=600,\n", | |
| " scene = attr(xaxis_visible=false, yaxis_visible=false, zaxis_visible=false, \n", | |
| " aspectmode=\"data\",\n", | |
| " camera_eye=attr(x=1.6, y=1.6, z=0.5)),\n", | |
| " paper_bgcolor=\"rgb(0,0,0)\")\n", | |
| " \n", | |
| " return fig\n", | |
| "end " | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "fig = breather_plot(3, 7)\n", | |
| "display(fig)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "%%html <img src=\"https://github.com/empet/3D-Viz-with-PlotlyJS.jl/blob/main/images/breather3-7.gif?raw=true\">" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "@webio": { | |
| "lastCommId": null, | |
| "lastKernelId": null | |
| }, | |
| "kernelspec": { | |
| "display_name": "Julia 1.9.0", | |
| "language": "julia", | |
| "name": "julia-1.9" | |
| }, | |
| "language_info": { | |
| "file_extension": ".jl", | |
| "mimetype": "application/julia", | |
| "name": "julia", | |
| "version": "1.9.0" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment