From 357d4977eb2b5e0f3cceaefad346cf30ab83ab3e Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 00:34:16 -0500 Subject: [PATCH 01/13] 1 --- .devcontainer/devcontainer.json | 1 + .../equation-checkpoint.ipynb | 35 ++++++++ .../analysis-amd64/analysis/equation.ipynb | 80 +++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb create mode 100644 analysis-master/analysis-amd64/analysis/equation.ipynb diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9b5120ed..6f6cd0c9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,6 +21,7 @@ }, "extensions": [ "mhutchie.git-graph", + "donjayamanne.jupyter", ], "postCreateCommand": "pip install -r analysis-master/analysis-amd64/requirements.txt" } \ No newline at end of file diff --git a/analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb b/analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb new file mode 100644 index 00000000..9245ab26 --- /dev/null +++ b/analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb @@ -0,0 +1,35 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "string = \"3+4+5\"\n", + "re.sub(\"\\d+[+]{1}\\d+\", string, sum([int(i) for i in re.split(\"[+]{1}\", re.search(\"\\d+[+]{1}\\d+\", string).group())]))" + ] + } + ], + "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.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb new file mode 100644 index 00000000..ce9c6f2d --- /dev/null +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 148, + "metadata": {}, + "outputs": [], + "source": [ + "import re" + ] + }, + { + "cell_type": "code", + "execution_count": 152, + "metadata": {}, + "outputs": [], + "source": [ + "string = \"3+45+-5\"" + ] + }, + { + "cell_type": "code", + "execution_count": 153, + "metadata": {}, + "outputs": [], + "source": [ + "def add(string):\n", + " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"\\d+[+]{1}[-]?\\d+\", str(sum([int(i) for i in re.split(\"[+]{1}\", re.search(\"\\d+[+]{1}[-]?\\d+\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 154, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "'7*0'" + }, + "metadata": {}, + "execution_count": 154 + } + ], + "source": [ + "add(string)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.6-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file From b1d5834ff137e89a610f0697ba8eca627ed40899 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 00:35:19 -0500 Subject: [PATCH 02/13] 2 --- .../analysis-amd64/analysis/equation.ipynb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index ce9c6f2d..33772754 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 155, "metadata": {}, "outputs": [], "source": [ @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 153, + "execution_count": 156, "metadata": {}, "outputs": [], "source": [ @@ -32,28 +32,21 @@ }, { "cell_type": "code", - "execution_count": 154, + "execution_count": 157, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { - "text/plain": "'7*0'" + "text/plain": "'43'" }, "metadata": {}, - "execution_count": 154 + "execution_count": 157 } ], "source": [ "add(string)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From f9c25dad09f1c0d53b928408bb3b14ffca87d8b5 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 12:58:44 -0500 Subject: [PATCH 03/13] 3 --- .../analysis-amd64/analysis/equation.ipynb | 51 +++++++++++++------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index 33772754..0a4f162d 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -2,51 +2,70 @@ "cells": [ { "cell_type": "code", - "execution_count": 148, + "execution_count": 61, "metadata": {}, "outputs": [], "source": [ - "import re" + "import re\n", + "from decimal import Decimal\n", + "from functools import reduce" ] }, { "cell_type": "code", - "execution_count": 155, + "execution_count": 56, "metadata": {}, "outputs": [], - "source": [ - "string = \"3+45+-5\"" - ] + "source": [] }, { "cell_type": "code", - "execution_count": 156, + "execution_count": 62, "metadata": {}, "outputs": [], "source": [ "def add(string):\n", " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"\\d+[+]{1}[-]?\\d+\", str(sum([int(i) for i in re.split(\"[+]{1}\", re.search(\"\\d+[+]{1}[-]?\\d+\", string).group())])), string, 1)\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(sum([Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 157, + "execution_count": 63, + "metadata": {}, + "outputs": [], + "source": [ + "def multiply(string):\n", + " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 69, "metadata": {}, "outputs": [ { - "output_type": "execute_result", - "data": { - "text/plain": "'43'" - }, - "metadata": {}, - "execution_count": 157 + "output_type": "stream", + "name": "stdout", + "text": "-29\n" } ], "source": [ - "add(string)" + "string = \"-3+4+-5*6\"\n", + "string = multiply(string)\n", + "string = add(string)\n", + "print(string)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From adfa6f5cc07137e514ced1bd428f262e52e16533 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 17:24:59 -0500 Subject: [PATCH 04/13] 4 --- .../analysis-amd64/analysis/equation.ipynb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index 0a4f162d..b8c86e18 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -11,13 +11,6 @@ "from functools import reduce" ] }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": 62, @@ -59,13 +52,6 @@ "string = add(string)\n", "print(string)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From 60ffe7645bb58fa12c1255b0fd700b54bd682792 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 19:01:55 -0500 Subject: [PATCH 05/13] 5 --- .../analysis-amd64/analysis/equation.ipynb | 67 ++++++++++++++++--- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index b8c86e18..58b5c57f 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 61, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -25,11 +25,31 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ - "def multiply(string):\n", + "def sub(string):\n", + " while(len(re.findall(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string)) != 0):\n", + " g = re.search(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string).group()\n", + " if(re.search(\"[-]{1,2}\", g).group() == \"-\"):\n", + " r = re.sub(\"[-]{1}\", \"+-\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " elif(re.search(\"[-]{1,2}\", g).group() == \"--\"):\n", + " r = re.sub(\"[-]{2}\", \"+\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " else:\n", + " pass\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [], + "source": [ + "def mul(string):\n", " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" @@ -37,21 +57,48 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 32, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", - "text": "-29\n" + "text": "-30\n" } ], "source": [ - "string = \"-3+4+-5*6\"\n", - "string = multiply(string)\n", - "string = add(string)\n", - "print(string)" + "def eval(string):\n", + " string = mul(string)\n", + " string = sub(string)\n", + " string = add(string)\n", + " return string" ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "-22" + }, + "metadata": {}, + "execution_count": 34 + } + ], + "source": [ + "string = \"2--3+4-5*6-1\"\n", + "eval(string)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 429d3eb42c6aeb7af9002c457b02856bc64f8e46 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 22:34:43 -0500 Subject: [PATCH 06/13] 6 --- .../analysis-amd64/analysis/equation.ipynb | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index 58b5c57f..b5ebf646 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 28, + "execution_count": 48, "metadata": {}, "outputs": [], "source": [ @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 49, "metadata": {}, "outputs": [], "source": [ @@ -25,7 +25,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 50, "metadata": {}, "outputs": [], "source": [ @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 51, "metadata": {}, "outputs": [], "source": [ @@ -57,17 +57,37 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 52, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "-30\n" - } - ], + "outputs": [], "source": [ - "def eval(string):\n", + "def div(string):\n", + " while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [], + "source": [ + "def exp(string):\n", + " while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [], + "source": [ + "def evaluate(string):\n", + " string = exp(string)\n", + " string = div(string)\n", " string = mul(string)\n", " string = sub(string)\n", " string = add(string)\n", @@ -76,29 +96,27 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 70, "metadata": {}, "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "-128+0.8\n" + }, { "output_type": "execute_result", "data": { - "text/plain": "-22" + "text/plain": "'-127.2'" }, "metadata": {}, - "execution_count": 34 + "execution_count": 70 } ], "source": [ - "string = \"2--3+4-5*6-1\"\n", - "eval(string)" + "string = \"8^2*4/-2+0.8\"\n", + "evaluate(string)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From 37a4a0085e8d48a7a1f2f72cd99606c0af650c88 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Wed, 29 Apr 2020 23:02:02 -0500 Subject: [PATCH 07/13] 7 --- .../analysis-amd64/analysis/equation.ipynb | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index b5ebf646..abe8dfd0 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 48, + "execution_count": 164, "metadata": {}, "outputs": [], "source": [ @@ -13,19 +13,19 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 165, "metadata": {}, "outputs": [], "source": [ "def add(string):\n", " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(sum([Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x + y), [Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 166, "metadata": {}, "outputs": [], "source": [ @@ -45,43 +45,43 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 167, "metadata": {}, "outputs": [], "source": [ "def mul(string):\n", " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 168, "metadata": {}, "outputs": [], "source": [ "def div(string):\n", " while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 169, "metadata": {}, "outputs": [], "source": [ "def exp(string):\n", " while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 170, "metadata": {}, "outputs": [], "source": [ @@ -96,27 +96,29 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 171, "metadata": {}, "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "-128+0.8\n" - }, { "output_type": "execute_result", "data": { - "text/plain": "'-127.2'" + "text/plain": "'-158456325028528675187087900672.000000'" }, "metadata": {}, - "execution_count": 70 + "execution_count": 171 } ], "source": [ - "string = \"8^2*4/-2+0.8\"\n", + "string = \"8^32*4/-2+0.8\"\n", "evaluate(string)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 0a721ca500be58ba7c6ca83408b0eb054ea89dc7 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Thu, 30 Apr 2020 15:22:37 -0500 Subject: [PATCH 08/13] 8 --- .../analysis-amd64/analysis/equation.ipynb | 130 ++++++++++++++++-- 1 file changed, 121 insertions(+), 9 deletions(-) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb index abe8dfd0..d43817b7 100644 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ b/analysis-master/analysis-amd64/analysis/equation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 164, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 165, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -25,7 +25,7 @@ }, { "cell_type": "code", - "execution_count": 166, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 167, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 168, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 169, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -81,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 170, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -90,22 +90,46 @@ " string = div(string)\n", " string = mul(string)\n", " string = sub(string)\n", + " print(string)\n", " string = add(string)\n", " return string" ] }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 13, "metadata": {}, "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "unexpected EOF while parsing (, line 1)", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def parentheses(string):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n" + ] + } + ], + "source": [ + "def parentheses(string):" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "-158456325028528675187087900672.000000+0.8\n" + }, { "output_type": "execute_result", "data": { "text/plain": "'-158456325028528675187087900672.000000'" }, "metadata": {}, - "execution_count": 171 + "execution_count": 22 } ], "source": [ @@ -113,6 +137,94 @@ "evaluate(string)" ] }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "from sympy import symbols, solve" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "x = symbols(\"x\")\n", + "expr = x-4-2\n", + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x - 6\n" + } + ], + "source": [ + "print(expr)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "expr = \"x-4-2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x-4-2\n" + } + ], + "source": [ + "print(expr)" + ] + }, { "cell_type": "code", "execution_count": null, From 2bcd4236bb1a6ed82d3fea0fee114268a295c733 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Fri, 1 May 2020 23:06:32 -0500 Subject: [PATCH 09/13] moved equation.ipynb to correct folder --- .../analysis-amd64/analysis/equation.ipynb | 257 ------------------ .../equation-checkpoint.ipynb | 0 2 files changed, 257 deletions(-) delete mode 100644 analysis-master/analysis-amd64/analysis/equation.ipynb rename analysis-master/{analysis-amd64 => }/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb (100%) diff --git a/analysis-master/analysis-amd64/analysis/equation.ipynb b/analysis-master/analysis-amd64/analysis/equation.ipynb deleted file mode 100644 index d43817b7..00000000 --- a/analysis-master/analysis-amd64/analysis/equation.ipynb +++ /dev/null @@ -1,257 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "import re\n", - "from decimal import Decimal\n", - "from functools import reduce" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "def add(string):\n", - " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x + y), [Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "def sub(string):\n", - " while(len(re.findall(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string)) != 0):\n", - " g = re.search(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string).group()\n", - " if(re.search(\"[-]{1,2}\", g).group() == \"-\"):\n", - " r = re.sub(\"[-]{1}\", \"+-\", g, 1)\n", - " string = re.sub(g, r, string, 1)\n", - " elif(re.search(\"[-]{1,2}\", g).group() == \"--\"):\n", - " r = re.sub(\"[-]{2}\", \"+\", g, 1)\n", - " string = re.sub(g, r, string, 1)\n", - " else:\n", - " pass\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "def mul(string):\n", - " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [], - "source": [ - "def div(string):\n", - " while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "def exp(string):\n", - " while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n", - " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "def evaluate(string):\n", - " string = exp(string)\n", - " string = div(string)\n", - " string = mul(string)\n", - " string = sub(string)\n", - " print(string)\n", - " string = add(string)\n", - " return string" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "output_type": "error", - "ename": "SyntaxError", - "evalue": "unexpected EOF while parsing (, line 1)", - "traceback": [ - "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def parentheses(string):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n" - ] - } - ], - "source": [ - "def parentheses(string):" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "-158456325028528675187087900672.000000+0.8\n" - }, - { - "output_type": "execute_result", - "data": { - "text/plain": "'-158456325028528675187087900672.000000'" - }, - "metadata": {}, - "execution_count": 22 - } - ], - "source": [ - "string = \"8^32*4/-2+0.8\"\n", - "evaluate(string)" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [], - "source": [ - "from sympy import symbols, solve" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "[6]" - }, - "metadata": {}, - "execution_count": 26 - } - ], - "source": [ - "x = symbols(\"x\")\n", - "expr = x-4-2\n", - "sol = solve(expr)\n", - "sol" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "x - 6\n" - } - ], - "source": [ - "print(expr)" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "expr = \"x-4-2\"" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "[6]" - }, - "metadata": {}, - "execution_count": 29 - } - ], - "source": [ - "sol = solve(expr)\n", - "sol" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "x-4-2\n" - } - ], - "source": [ - "print(expr)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "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.6-final" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} \ No newline at end of file diff --git a/analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb b/analysis-master/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb similarity index 100% rename from analysis-master/analysis-amd64/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb rename to analysis-master/analysis/.ipynb_checkpoints/equation-checkpoint.ipynb From 5a1aa780ffb7c80ff32b2d7455f758c51583c43e Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Tue, 12 May 2020 20:43:31 -0500 Subject: [PATCH 10/13] readded equation.ipynb --- analysis-master/analysis/equation.ipynb | 257 ++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 analysis-master/analysis/equation.ipynb diff --git a/analysis-master/analysis/equation.ipynb b/analysis-master/analysis/equation.ipynb new file mode 100644 index 00000000..d43817b7 --- /dev/null +++ b/analysis-master/analysis/equation.ipynb @@ -0,0 +1,257 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import re\n", + "from decimal import Decimal\n", + "from functools import reduce" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "def add(string):\n", + " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x + y), [Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def sub(string):\n", + " while(len(re.findall(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string)) != 0):\n", + " g = re.search(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string).group()\n", + " if(re.search(\"[-]{1,2}\", g).group() == \"-\"):\n", + " r = re.sub(\"[-]{1}\", \"+-\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " elif(re.search(\"[-]{1,2}\", g).group() == \"--\"):\n", + " r = re.sub(\"[-]{2}\", \"+\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " else:\n", + " pass\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "def mul(string):\n", + " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "def div(string):\n", + " while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def exp(string):\n", + " while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "def evaluate(string):\n", + " string = exp(string)\n", + " string = div(string)\n", + " string = mul(string)\n", + " string = sub(string)\n", + " print(string)\n", + " string = add(string)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "unexpected EOF while parsing (, line 1)", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def parentheses(string):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n" + ] + } + ], + "source": [ + "def parentheses(string):" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "-158456325028528675187087900672.000000+0.8\n" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": "'-158456325028528675187087900672.000000'" + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "string = \"8^32*4/-2+0.8\"\n", + "evaluate(string)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "from sympy import symbols, solve" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "x = symbols(\"x\")\n", + "expr = x-4-2\n", + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x - 6\n" + } + ], + "source": [ + "print(expr)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "expr = \"x-4-2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x-4-2\n" + } + ], + "source": [ + "print(expr)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.6-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file From 6d544a434ef02453f26999453b5ad69ced5018bc Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Tue, 12 May 2020 20:46:42 -0500 Subject: [PATCH 11/13] readded equation.ipynb --- analysis-master/analysis/equation.ipynb | 257 ++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 analysis-master/analysis/equation.ipynb diff --git a/analysis-master/analysis/equation.ipynb b/analysis-master/analysis/equation.ipynb new file mode 100644 index 00000000..d43817b7 --- /dev/null +++ b/analysis-master/analysis/equation.ipynb @@ -0,0 +1,257 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import re\n", + "from decimal import Decimal\n", + "from functools import reduce" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "def add(string):\n", + " while(len(re.findall(\"[+]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x + y), [Decimal(i) for i in re.split(\"[+]{1}\", re.search(\"[-]?\\d+[.]?\\d*[+]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def sub(string):\n", + " while(len(re.findall(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string)) != 0):\n", + " g = re.search(\"\\d+[.]?\\d*[-]{1,2}\\d+[.]?\\d*\", string).group()\n", + " if(re.search(\"[-]{1,2}\", g).group() == \"-\"):\n", + " r = re.sub(\"[-]{1}\", \"+-\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " elif(re.search(\"[-]{1,2}\", g).group() == \"--\"):\n", + " r = re.sub(\"[-]{2}\", \"+\", g, 1)\n", + " string = re.sub(g, r, string, 1)\n", + " else:\n", + " pass\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "def mul(string):\n", + " while(len(re.findall(\"[*]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x * y), [Decimal(i) for i in re.split(\"[*]{1}\", re.search(\"[-]?\\d+[.]?\\d*[*]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "def div(string):\n", + " while(len(re.findall(\"[/]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x / y), [Decimal(i) for i in re.split(\"[/]{1}\", re.search(\"[-]?\\d+[.]?\\d*[/]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "def exp(string):\n", + " while(len(re.findall(\"[\\^]{1}[-]?\", string)) != 0):\n", + " string = re.sub(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", str(\"%f\" % reduce((lambda x, y: x ** y), [Decimal(i) for i in re.split(\"[\\^]{1}\", re.search(\"[-]?\\d+[.]?\\d*[\\^]{1}[-]?\\d+[.]?\\d*\", string).group())])), string, 1)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "def evaluate(string):\n", + " string = exp(string)\n", + " string = div(string)\n", + " string = mul(string)\n", + " string = sub(string)\n", + " print(string)\n", + " string = add(string)\n", + " return string" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "output_type": "error", + "ename": "SyntaxError", + "evalue": "unexpected EOF while parsing (, line 1)", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m def parentheses(string):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unexpected EOF while parsing\n" + ] + } + ], + "source": [ + "def parentheses(string):" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "-158456325028528675187087900672.000000+0.8\n" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": "'-158456325028528675187087900672.000000'" + }, + "metadata": {}, + "execution_count": 22 + } + ], + "source": [ + "string = \"8^32*4/-2+0.8\"\n", + "evaluate(string)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [], + "source": [ + "from sympy import symbols, solve" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 26 + } + ], + "source": [ + "x = symbols(\"x\")\n", + "expr = x-4-2\n", + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x - 6\n" + } + ], + "source": [ + "print(expr)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [], + "source": [ + "expr = \"x-4-2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": "[6]" + }, + "metadata": {}, + "execution_count": 29 + } + ], + "source": [ + "sol = solve(expr)\n", + "sol" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": "x-4-2\n" + } + ], + "source": [ + "print(expr)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.6-final" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} \ No newline at end of file From 230e98a745e7327e153ccda0fb25f59d3f45c9d2 Mon Sep 17 00:00:00 2001 From: ltcptgeneral <35508619+ltcptgeneral@users.noreply.github.com> Date: Tue, 12 May 2020 20:48:45 -0500 Subject: [PATCH 12/13] 9 --- analysis-master/analysis/equation.ipynb | 95 ------------------------- 1 file changed, 95 deletions(-) diff --git a/analysis-master/analysis/equation.ipynb b/analysis-master/analysis/equation.ipynb index d43817b7..0d8ef4ea 100644 --- a/analysis-master/analysis/equation.ipynb +++ b/analysis-master/analysis/equation.ipynb @@ -136,101 +136,6 @@ "string = \"8^32*4/-2+0.8\"\n", "evaluate(string)" ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": {}, - "outputs": [], - "source": [ - "from sympy import symbols, solve" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "[6]" - }, - "metadata": {}, - "execution_count": 26 - } - ], - "source": [ - "x = symbols(\"x\")\n", - "expr = x-4-2\n", - "sol = solve(expr)\n", - "sol" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "x - 6\n" - } - ], - "source": [ - "print(expr)" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "expr = \"x-4-2\"" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/plain": "[6]" - }, - "metadata": {}, - "execution_count": 29 - } - ], - "source": [ - "sol = solve(expr)\n", - "sol" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": "x-4-2\n" - } - ], - "source": [ - "print(expr)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { From 8f8fb6c1562702373d1ee06fef3709bdb4cd3f93 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 14 May 2020 23:36:28 -0500 Subject: [PATCH 13/13] analysis.py v 1.2.2.000 Signed-off-by: Arthur Lu --- analysis-master/analysis/analysis.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/analysis-master/analysis/analysis.py b/analysis-master/analysis/analysis.py index c4cf49de..07ff32e6 100644 --- a/analysis-master/analysis/analysis.py +++ b/analysis-master/analysis/analysis.py @@ -7,10 +7,12 @@ # current benchmark of optimization: 1.33 times faster # setup: -__version__ = "1.2.1.002" +__version__ = "1.2.2.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 1.2.2.000: + - changed output of regressions to function strings instead of list of coefficients 1.2.1.002: - renamed ArrayTest class to Array 1.2.1.001: @@ -412,7 +414,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array popt, pcov = scipy.optimize.curve_fit(lin, X, y) - regressions.append((popt.flatten().tolist(), None)) + coeffs = popt.flatten().tolist() + regressions.append(str(coeffs[0]) + "*x+" + str(coeffs[1])) except Exception as e: @@ -428,7 +431,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array popt, pcov = scipy.optimize.curve_fit(log, X, y) - regressions.append((popt.flatten().tolist(), None)) + coeffs = popt.flatten().tolist() + regressions.append(str(coeffs[0]) + "*log(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3])) except Exception as e: @@ -444,7 +448,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array popt, pcov = scipy.optimize.curve_fit(exp, X, y) - regressions.append((popt.flatten().tolist(), None)) + coeffs = popt.flatten().tolist() + regressions.append(str(coeffs[0]) + "*e^(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3])) except Exception as e: @@ -466,10 +471,14 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array params = model.steps[1][1].intercept_.tolist() params = np.append(params, model.steps[1][1].coef_[0].tolist()[1::]) - params.flatten() - params = params.tolist() - - plys.append(params) + params = params.flatten().tolist() + + temp = "" + counter = 0 + for param in params: + temp += "(" + str(param) + "*x^" + str(counter) + ")" + counter += 1 + plys.append(temp) regressions.append(plys) @@ -483,7 +492,8 @@ def regression(inputs, outputs, args): # inputs, outputs expects N-D array popt, pcov = scipy.optimize.curve_fit(sig, X, y) - regressions.append((popt.flatten().tolist(), None)) + coeffs = popt.flatten().tolist() + regressions.append(str(coeffs[0]) + "*tanh(" + str(coeffs[1]) + "*(x+" + str(coeffs[2]) + "))+" + str(coeffs[3])) except Exception as e: