### lab08 | ENGG1811 Lab 08: Simulation and its applications

lab08

ENGG1811 Lab 08: Simulation and its applications

Objectives

After completing this lab, students should be able to

• Write Python scripts, functions and for-loop
• Understand and use the following Python numpy package features: array, array indexing, max, min, where
• Gain a better understanding of simulation and how it can be used for design and decision making

### UNSW ENGG1811 Python复习要点–Numpy基础教程

NumPy的主要对象是同种元素的多维数组。这是一个所有的元素都是一种类型、通过一个正整数元组索引的元素表格(通常是元素是数字)。

### UNSW1811Python 辅导第6期 集合了Lab13 SAMPLE+两次Ass讲解

1811考试倒计时，我们的老师针对LAB13的4个问题进行分析整理，并加上前两次ass，精心准备了辅导课程，并已开展了两次Lab13+ass的课程。Final期间，已经陆陆续续为大家开展了5次辅导课程，接下来的时间里，还会有一至两次大课，并接受小班课程，为大家的考试加油！需要参加辅导的同学，可以填写以下的报名表，根据大家的时间安排课程。

# 为什么要用numpy

• Python中提供了list容器，可以当作数组使用。但列表中的元素可以是任何对象，因此列表中保存的是对象的指针，这样一来，为了保存一个简单的列表[1,2,3]。就需要三个指针和三个整数对象。对于数值运算来说，这种结构显然不够高效。
• Python虽然也提供了array模块，但其只支持一维数组，不支持多维数组，也没有各种运算函数。因而不适合数值运算。
• NumPy的出现弥补了这些不足。

### UNSW ENGG 1811 Python问题集锦之Python+Numpy——数组运算

(1)数组加法：array([20,31,42,53])=array([20,30,40,50])+array([0,1,2,3])

```from numpy import *
a=array([20,30,40,50])
b=arange(4)
a+b```

### UNSW 1811 Engineering Python Training 考前培训报名中… …

Final 将近，针对numpy以及其他python知识点，大牛们为大家做了份整理，下周末准备给大家开设一个培训，如有需求，请先填写报名信息。

### Introduction

We often think bacteria are bad. The truth is that there are many different types of bacteria in this world. Some bacteria are harmful to humans but some bacteria in our bodies help us to live. Have you ever considered the possibility that bacteria can also be “factory workers”? Engineers and scientists are working on using bacteria to produce certain chemicals and materials. An example is to use bacteria to produce fuel for us. In engineering, we often want to optimise the process, so we may want to make the bacteria to produce as much fuel as possible in a given time. However, there are often constraints in nature. The truth is that fuel is toxic to bacteria, so we need to find a way for the bacteria to make a lot of fuel but at the same time keep them alive! This biofuel production process is the theme of this assignment.