{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Mathematical tools" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from osdyn.utils.misc.info import what_function\n", "from osdyn.utils.misc.mmath import bound, get_unit, get_precision" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from osdyn.utils.misc import mmath" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Avalaible functions" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "what_function(mmath)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## bounds for a range or colorbar" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get inner rounds\n", "print(bound(-1034.3285), bound(1034.3285))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get outer rounds\n", "print(bound(-1034.3285, shrink=False), bound(1034.3285, shrink=False))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get outer rounds at 10^2\n", "print(bound(-1034.3285, shrink=False, precision=2), bound(1034.3285, shrink=False, precision=2))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get inner rounds for decimal numbers\n", "print(bound(-0.3285), bound(0.3285))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get outer rounds at 10^{-2}\n", "print(bound(-0.3285, shrink=False, precision=-3), bound(0.3285, shrink=False, precision=-3))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## unit of a number" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "get_unit(000.00399)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "get_unit(0.99)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "get_unit(-0.93)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## precision of a number" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "get_precision(-0.00093)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "get_precision(-103.0)" ] } ], "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.7.8" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }