线性代数 python_Python | 申请学校CPI记录(线性代数)

本文介绍了如何使用线性代数的基本概念和Numpy库进行学生CPI成绩的数据分析,包括计算最高、最低、平均CPI及班级成绩的差异,展示了线性代数在实际问题中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

线性代数 python

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 this tutorial, we are going to learn how to apply vectors for simple applications such as marks of the students. Numpy provides us a complete package of inbuilt functions that provide us a free hand to perform different manipulations with our vector to our application.

线性代数是使用向量空间和矩阵的线性方程组的数学分支。 换句话说,向量是n维空间中只有一列的矩阵。 因此向量是线性代数的重要组成部分之一。 在本教程中,我们将学习如何将向量应用于简单的应用程序,例如学生的成绩。 Numpy为我们提供了完整的内置函数包,使我们可以自由使用矢量对应用程序执行不同的操作。

Firstly, we will store the CPIs of all the students of class X in a school, and after that, we are going to analyze the Class Statistics using inbuilt functions.

首先,我们将存储学校中所有X类学生的CPI,然后,我们将使用内置函数来分析Class Statistics。

  1. Highest CPI from the class

    同类中最高的CPI

  2. Lowest CPI from the class

    同类中最低的CPI

  3. Average CPI of the class

    班级平均CPI

  4. Variance of the class

    班级差异

Following is the python code for demonstration,

以下是用于演示的python代码,

# Linear Algebra Learning Sequence
# Basic Application

import numpy as np

stun = int(input('Number of students in all section of Class X : '))

srl = np.arange(stun)

cpi = np.array([])
for i in range(stun):
    print('Enter the CPI of',i,' student  : ')
    cp = float(input())
    cpi = np.append(cpi, cp)
    
for i in range(stun):
    print('Student ',srl[i]+1, ': ', cpi[i])

print('Highest from class X : ', np.max(cpi))
print('Lowest from class X : ', np.min(cpi))
print('Average from class X : ', np.mean(cpi))
print('Variance from class X : ', np.var(cpi))    

Output:

输出:

Number of students in all section of Class X : 5
Enter the CPI of 0  student  : 
4.2
Enter the CPI of 1  student  : 
4.3
Enter the CPI of 2  student  : 
3.2
Enter the CPI of 3  student  : 
3.3
Enter the CPI of 4  student  : 
5.5
Student  1 :  4.2
Student  2 :  4.3
Student  3 :  3.2
Student  4 :  3.3
Student  5 :  5.5
Highest from class X :  5.5
Lowest from class X :  3.2
Average from class X :  4.1
Variance from class X :  0.692


翻译自: https://www.includehelp.com/python/application-to-school-cpi-records-linear-algebra.aspx

线性代数 python

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值