Created using Colaboratory

This commit is contained in:
Abdalaziz Rashid 2020-08-05 21:04:39 +03:00
parent c7c6719b4f
commit 3121276389

View file

@ -1663,7 +1663,7 @@
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 935
"height": 955
},
"outputId": "b5eac008-4f8f-4980-dd8d-7d1ac386bb32"
},
@ -1735,10 +1735,194 @@
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "h_qpqwJg8bjw",
"colab_type": "text"
},
"source": [
"# Results"
]
},
{
"cell_type": "code",
"metadata": {
"id": "adbL8tHJ7s5a",
"id": "P5il9KC_8dB4",
"colab_type": "code",
"colab": {}
},
"source": [
"import pprint\n",
"import re\n",
"results = None\n",
"with open(\"/content/AI-Feynman/output_no_units_parallel.log\") as F:\n",
" results = F.readlines() "
],
"execution_count": 268,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "5DLXAa-E8uyD",
"colab_type": "code",
"colab": {}
},
"source": [
"new = str(results).replace('\"', \"\").strip().replace(\"\\n\", \"\").replace(\"'\", \"\")\\\n",
".replace(\" \", \"\").replace(\"\\\\n\", \" \")\\\n",
".replace(\"','\", \"\").replace(\"asin\", \"sin\").split(\"INFO:root:\")\n",
"\n",
"new = [re.sub(r\"(dtype=\\WU\\d*|dtype=object)\", \"\", item) for item in new]"
],
"execution_count": 301,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "AypjKO0n9CMy",
"colab_type": "code",
"colab": {}
},
"source": [
"new = [re.sub(r\"(I+.\\d*.\\d*:array)\", \"\", item.replace(\" ,\", \"\").replace(\"{\", \"\")\\\n",
" .replace(\"}\", \"\"))\\\n",
" .split(\",\") for item in new if len(item) > 10]\n",
" #re.sub(r\"(I+.\\d*.\\d*:array)\", \"\", item.replace(\" ,\", \"\").replace(\"{\", \"\")\\\n",
" # .replace(\"}\", \"\").replace(\"(\", \"\").replace(\")\", \"\"))\\\n",
" # .split(\",\")"
],
"execution_count": 303,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "TvYwdwzjh2QQ",
"colab_type": "code",
"colab": {}
},
"source": [
"import sympy\n",
"import matplotlib.pyplot as plt\n",
"from sympy import init_printing\n",
"from sympy import pprint\n",
"\n",
"init_printing(use_latex=True)\n"
],
"execution_count": 350,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "8bqA0DqRegPN",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"outputId": "2e66e9ea-fc55-46db-ffd2-e4fa8d89bdba"
},
"source": [
"results = []\n",
"for item in new:\n",
" res = []\n",
" for ex in item:\n",
" if len(ex) > 3:\n",
" tmp.append(ex)\n",
" result.append(ex.replace(\"]\", \"\"))\n",
" results.append(result[-1])\n",
" pprint(sympy.sympify(result[-1]))\n",
" print(\"\\n\", \"@\" * 60, \"\\n\")"
],
"execution_count": 355,
"outputs": [
{
"output_type": "stream",
"text": [
"4⋅π⋅x₀\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"x₀ + 1\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"-0.125 \n",
"───────\n",
" 2 \n",
" x₀ \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
" 1 \n",
" ── \n",
" x₀ \n",
" - 1\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
" 0.5\n",
"⎛ 2 ⎞ \n",
"⎝x₀ - 0.1591549430918953⋅x₀ + 0.01⎠ \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
" 0.5 \n",
"──────\n",
"x₀ + 1\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"sin(0.785437643527985⋅sin(0.1013211780033⋅cos(x₀)))\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"6.283185307179586⋅x₀\n",
"────────────────────\n",
" x₁ \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
" 0.5\n",
"⎛ 2 2 ⎞ \n",
"⎝x₀ + x₁ + 1⎠ \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"1.0⋅x₁\n",
"──────\n",
" x₀ \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"0.168816319869⋅x₂⋅(x₀ + x₁)\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"-4⋅π⋅(cos(x₁ - x₂) - 1) \n",
"────────────────────────\n",
" 2 \n",
" x₀⋅(x₁ - x₂) \n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n",
"x₀⋅(x₁⋅cos(x₂) + 1)\n",
"\n",
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n",
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "N5qkbSYTx3S7",
"colab_type": "code",
"colab": {}
},