博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
线性代数 向量长度_用户定义长度的向量| 使用Python的线性代数
阅读量:2531 次
发布时间:2019-05-11

本文共 1568 字,大约阅读时间需要 5 分钟。

线性代数 向量长度

Prerequisite:

先决条件:

Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. In other words, a vector is a matrix in n-dimensional space with only one column. So vector is one of the important constituents for linear algebra. In previous tutorials, we defined the vector in code itself. In this tutorial, we will just extend one step more to make a code in a way that users can define a vector.

线性代数是使用向量空间和矩阵的线性方程组的数学分支。 换句话说,向量是n维空间中只有一列的矩阵。 因此向量是线性代数的重要组成部分之一。 在以前的教程中,我们在代码本身中定义了向量。 在本教程中,我们将进一步扩展一步,以使用户可以定义矢量的方式编写代码。

Keypoint: For a code to generate a user-defined vector, we need one major parameter i.e. N. N represents the number of elements in a vector.

关键点:为了使代码生成用户定义的向量,我们需要一个主要参数,即N。 N表示向量中元素的数量。

Python代码定义用户定义长度的向量 (Python code to define a vector with user defined length)

# Vectors in Linear Algebra Sequnce # Vector with User Defined Lengthn = int(input("Enter the length of the vector you want to define: "))v = []for i in range(n):    v.append(int(input('Enter the element: ')))    print("Vector you defined = ", v)

Output:

输出:

RUN 1:Enter the length of the vector you want to define: 5Enter the element: 12Enter the element: 23Enter the element: 31Enter the element: 22Enter the element: 56Vector you defined =  [12, 23, 31, 22, 56]RUN 2:Enter the length of the vector you want to define: 6Enter the element: 33Enter the element: 123Enter the element: 9Enter the element: 10Enter the element: 98Enter the element: 13Vector you defined =  [33, 123, 9, 10, 98, 13]

翻译自:

线性代数 向量长度

转载地址:http://tixzd.baihongyu.com/

你可能感兴趣的文章
开发 笔记
查看>>
ajax跨域,携带cookie
查看>>
阶段3 2.Spring_01.Spring框架简介_03.spring概述
查看>>
阶段3 2.Spring_02.程序间耦合_1 编写jdbc的工程代码用于分析程序的耦合
查看>>
阶段3 2.Spring_01.Spring框架简介_04.spring发展历程
查看>>
阶段3 2.Spring_02.程序间耦合_3 程序的耦合和解耦的思路分析1
查看>>
阶段3 2.Spring_02.程序间耦合_5 编写工厂类和配置文件
查看>>
阶段3 2.Spring_01.Spring框架简介_05.spring的优势
查看>>
阶段3 2.Spring_02.程序间耦合_7 分析工厂模式中的问题并改造
查看>>
阶段3 2.Spring_02.程序间耦合_4 曾经代码中的问题分析
查看>>
阶段3 2.Spring_03.Spring的 IOC 和 DI_2 spring中的Ioc前期准备
查看>>
阶段3 2.Spring_03.Spring的 IOC 和 DI_4 ApplicationContext的三个实现类
查看>>
阶段3 2.Spring_02.程序间耦合_8 工厂模式解耦的升级版
查看>>
阶段3 2.Spring_03.Spring的 IOC 和 DI_6 spring中bean的细节之三种创建Bean对象的方式
查看>>
阶段3 2.Spring_04.Spring的常用注解_3 用于创建的Component注解
查看>>
阶段3 2.Spring_04.Spring的常用注解_2 常用IOC注解按照作用分类
查看>>
阶段3 2.Spring_09.JdbcTemplate的基本使用_5 JdbcTemplate在spring的ioc中使用
查看>>
阶段3 3.SpringMVC·_07.SSM整合案例_02.ssm整合之搭建环境
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第1节零基础快速入门SpringBoot2.0_3、快速创建SpringBoot应用之手工创建web应用...
查看>>
阶段3 3.SpringMVC·_07.SSM整合案例_04.ssm整合之编写SpringMVC框架
查看>>