{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 人工智能与机器学习-实验1\n", "\n", "## Part.II Numpy练习\n", "\n", "|学号 |姓名 |\n", "|----------|--------|\n", "| | |" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. 数组\n", "\n", "创建一个长度为10全为0的一维数组,然后让第5个元素等于1。" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. 向量内积\n", "\n", "随机生成2个长度为$10^6$的向量,分别用numpy函数和for循环计算其内积。并比较耗时情况。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. 矩阵乘法\n", "\n", "生成一个$4\\times5$和一个$5\\times4$的矩阵,并计算它们的乘积。" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4. 函数\n", "\n", "函数$f$定义如下,其中$x$是任意实数:\n", "$$\n", "f(x)=\\frac{\\sin⁡(x+1)(x+1)}{2e^x}\n", "$$,\n", "\n", "生成一个数组$a\\in \\mathbb{R}^5$,计算$b = f(a)$。" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5. 平均值\n", "\n", "随机生成一个5行10列的矩阵,然后每行元素减去该行的平均值" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "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.9" } }, "nbformat": 4, "nbformat_minor": 2 }