日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 向量取整数_随机整数向量| 使用Python的线性代数

發布時間:2025/3/11 python 15 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 向量取整数_随机整数向量| 使用Python的线性代数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python 向量取整數

Prerequisite:

先決條件:

  • Defining a Vector using list

    使用列表定義向量

  • Defining Vector using Numpy

    使用Numpy定義向量

Random Integer Vector is a type of vector having a random integer value at each entry. Such types of vectors have a huge importance in Simulation and Machine Learning. Random Integer Vector can be defined by its Upper Limit, Lower Limit, and Length of the Vector (i.e. number of entries).

隨機整數向量是在每個條目處具有隨機整數值的向量類型。 這種類型的向量在仿真和機器學習中具有極其重要的意義。 隨機整數向量可以通過其上限 , 下限和向量的長度(即條目數)來定義。

In this article, we are going to create a random integer vector using inbuilt function numpy.random.randint().

在本文中,我們將使用內置函數numpy.random.randint()創建一個隨機整數向量。

Syntax:

句法:

numpy.random.randint(low, up, length)low - lower limit for choosing random integer value up - upper limit for choosing random integer value length - Length of the desired vector

Application:

應用:

  • Machine Learning

    機器學習

  • Probability

    可能性

  • Constraint Based Programming

    基于約束的編程

  • Monte Carlo Simulation

    蒙特卡羅模擬

  • 隨機整數向量的Python程序 (Python program for random integer vector)

    # Linear Algebra Learning Sequence # Random Integer Vectorimport numpy as np# Example 1, length 20 t1 = np.random.randint(0,30,20) print('Example : ', t1)# Example 2, length 20 t2 = np.random.randint(0,100,20) print('\n\nExample : ', t2)# Example 3, length 20 t3 = np.random.randint(0,300,20) print('\n\nExample : ', t3)# Example 4, length 30 t4 = np.random.randint(40,45,30) print('\n\nExample : ', t4)

    Output:

    輸出:

    Example : [ 6 2 14 27 23 12 15 7 23 18 17 16 13 12 19 7 27 21 28 23]Example : [65 41 80 12 12 91 10 77 31 66 29 98 11 40 41 52 7 18 80 26]Example : [126 14 190 21 259 268 168 88 252 270 243 112 237 2 38 112 229 106 85 48]Example : [44 40 42 40 42 42 44 43 43 42 41 42 42 44 42 41 41 40 40 42 43 40 42 40 44 44 40 43 40 40]

    翻譯自: https://www.includehelp.com/python/random-integer-vector.aspx

    python 向量取整數

    總結

    以上是生活随笔為你收集整理的python 向量取整数_随机整数向量| 使用Python的线性代数的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。