Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 2,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "import numpy as np\n",
  10. "A=np.array([[1,2],[3,4],[5,6],[7,8]])"
  11. ]
  12. },
  13. {
  14. "cell_type": "code",
  15. "execution_count": 3,
  16. "metadata": {},
  17. "outputs": [
  18. {
  19. "data": {
  20. "text/plain": [
  21. "array([[1, 2],\n",
  22. " [3, 4],\n",
  23. " [5, 6],\n",
  24. " [7, 8]])"
  25. ]
  26. },
  27. "execution_count": 3,
  28. "metadata": {},
  29. "output_type": "execute_result"
  30. }
  31. ],
  32. "source": [
  33. "A"
  34. ]
  35. },
  36. {
  37. "cell_type": "code",
  38. "execution_count": 4,
  39. "metadata": {},
  40. "outputs": [],
  41. "source": [
  42. "B=np.array([[1,2,3],[4,5,6],[7,8,9]])"
  43. ]
  44. },
  45. {
  46. "cell_type": "code",
  47. "execution_count": 5,
  48. "metadata": {},
  49. "outputs": [
  50. {
  51. "ename": "ValueError",
  52. "evalue": "shapes (4,2) and (3,3) not aligned: 2 (dim 1) != 3 (dim 0)",
  53. "output_type": "error",
  54. "traceback": [
  55. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  56. "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
  57. "\u001b[0;32m<ipython-input-5-189f80e2c351>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mA\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mB\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  58. "\u001b[0;31mValueError\u001b[0m: shapes (4,2) and (3,3) not aligned: 2 (dim 1) != 3 (dim 0)"
  59. ]
  60. }
  61. ],
  62. "source": [
  63. "np.dot(A,B)"
  64. ]
  65. },
  66. {
  67. "cell_type": "code",
  68. "execution_count": null,
  69. "metadata": {},
  70. "outputs": [],
  71. "source": []
  72. }
  73. ],
  74. "metadata": {
  75. "kernelspec": {
  76. "display_name": "Python",
  77. "language": "python",
  78. "name": "conda-env-python-py"
  79. },
  80. "language_info": {
  81. "codemirror_mode": {
  82. "name": "ipython",
  83. "version": 3
  84. },
  85. "file_extension": ".py",
  86. "mimetype": "text/x-python",
  87. "name": "python",
  88. "nbconvert_exporter": "python",
  89. "pygments_lexer": "ipython3",
  90. "version": "3.6.7"
  91. }
  92. },
  93. "nbformat": 4,
  94. "nbformat_minor": 4
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement