Skip to content

Instantly share code, notes, and snippets.

@nathanmargaglio
Last active November 4, 2019 15:55
Show Gist options
  • Save nathanmargaglio/c537b5cb675947060b22acbac56b8362 to your computer and use it in GitHub Desktop.
Save nathanmargaglio/c537b5cb675947060b22acbac56b8362 to your computer and use it in GitHub Desktop.
Basic Numpy Test
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Basic Numpy Test",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/nathanmargaglio/c537b5cb675947060b22acbac56b8362/basic-numpy-test.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "tOyED3G0vig8",
"colab_type": "code",
"colab": {}
},
"source": [
"import numpy as np\n",
"\n",
"T = 10\n",
"r = np.random.rand(T)\n",
"gamma = 0.99\n",
"\n",
"G = 0\n",
"for t in range(T):\n",
" G += r[t] * gamma**t"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "PrtLX17yIEA-",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "1382059b-4ca4-4654-ba93-e5de3b14017d"
},
"source": [
"print(G)"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"3.944324612047748\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment