📚 IB AQA Computer Science: Formula Summary Handbook | IB AQA 计算机:公式汇总手册
This handbook compiles essential formulas and calculations frequently encountered in IB and AQA Computer Science curricula. It covers data representation, file size estimation, Boolean algebra, algorithm efficiency, networking, and more, providing a quick reference for both problem solving and exam preparation.
本手册汇总了 IB 和 AQA 计算机课程中常见的关键公式与计算方法,涵盖数据表示、文件大小估算、布尔代数、算法效率、网络等方面,为解题和备考提供快速参考。
1. Data Storage Unit Conversions | 数据存储单位换算
The size of digital data is measured in bits and bytes. Industry uses both decimal (SI) and binary (IEC) prefixes. For precise calculations, it is crucial to distinguish between them.
数字数据的大小以比特和字节为单位。业界同时使用十进制(SI)和二进制(IEC)前缀。为了精确计算,区分它们非常重要。
Common base conversions: 1 byte = 8 bits. In decimal units: 1 KB = 10³ bytes, 1 MB = 10⁶ bytes, 1 GB = 10⁹ bytes. In binary units: 1 KiB = 2¹⁰ bytes = 1024 bytes, 1 MiB = 2²⁰ bytes = 1,048,576 bytes, 1 GiB = 2³⁰ bytes.
常用基本换算:1字节 = 8比特。十进制单位:1 KB = 10³ 字节,1 MB = 10⁶ 字节,1 GB = 10⁹ 字节。二进制单位:1 KiB = 2¹⁰ 字节 = 1024 字节,1 MiB = 2²⁰ 字节 = 1,048,576 字节,1 GiB = 2³⁰ 字节。
- Decimal (SI) formula: size in larger unit = size in smaller unit ÷ 10³ for each step (KB → MB → GB).
- 十进制 (SI) 公式: 较大单位值 = 较小单位值 ÷ 10³,每步除以 10³(KB → MB → GB)。
- Binary (IEC) formula: size in larger unit = size in smaller unit ÷ 2¹⁰ for each step (KiB → MiB → GiB).
- 二进制 (IEC) 公式: 较大单位值 = 较小单位值 ÷ 2¹⁰,每步除以 1024(KiB → MiB → GiB)。
bytes to bits: b = B × 8
字节转比特: 比特数 = 字节数 × 8
2. Binary and Hexadecimal Conversions | 二进制与十六进制转换
Binary numbers are base‑2, hexadecimal base‑16. Understanding conversions is fundamental for memory addresses, colour codes, and machine code.
二进制是基数为 2 的计数系统,十六进制基数为 16。理解它们之间的转换对于内存地址、颜色编码和机器码至关重要。
Binary to Decimal: Value = dₙ₋₁ × 2ⁿ⁻¹ + dₙ₋₂ × 2ⁿ⁻² + … + d₀ × 2⁰, where dᵢ is the i‑th bit (0 or 1).
二进制转十进制: 值 = dₙ₋₁ × 2ⁿ⁻¹ + dₙ₋₂ × 2ⁿ⁻² + … + d₀ × 2⁰,其中 dᵢ 是第 i 位比特(0 或 1)。
Decimal to Binary: repeated division by 2, reading remainders from bottom to top.
十进制转二进制: 反复除以 2,余数从下往上读取。
Binary to Hexadecimal: group binary digits into nibbles (4 bits) from the right, then convert each nibble to a hex digit (0‑9, A‑F).
二进制转十六进制: 从右向左每 4 位一组(半字节),然后将每个半字节转换为一个十六进制数字(0‑9, A‑F)。
Hex digit value: A=10, B=11, C=12, D=13, E=14, F=15
十六进制数字值: A=10, B=11, C=12, D=13, E=14, F=15
3. Image File Size Calculation | 图像文件大小计算
Uncompressed bitmap image size depends on resolution and colour depth. Colour depth (bit depth) is the number of bits used to represent the colour of a single pixel.
未压缩位图图像的大小取决于分辨率和颜色深度。颜色深度(位深度)是用于表示单个像素颜色的比特数。
File size (bytes) = (width × height × colour depth in bits) ÷ 8
文件大小(字节) = (宽度 × 高度 × 颜色深度,单位比特) ÷ 8
If multiple colour channels exist (e.g., RGB), colour depth is typically channels × bits per channel. For example, 24‑bit colour uses 8 bits per channel for red, green, and blue.
如果存在多个颜色通道(如 RGB),颜色深度通常是通道数 × 每通道比特数。例如,24 位颜色使用红、绿、蓝各 8 比特。
| Colour Depth | Number of Colours |
| 1 bit | 2 (2¹) |
| 8 bit | 256 (2⁸) |
| 24 bit (True Colour) | ~16.7 million (2²⁴) |
Note: metadata and headers are excluded in this base formula; real files are slightly larger.
注意:此基本公式不包括元数据和文件头;实际文件会略大一些。
4. Sound File Size Calculation | 声音文件大小计算
Uncompressed digital audio file size depends on sample rate, bit depth, duration, and number of channels (mono = 1, stereo = 2).
未压缩数字音频文件的大小取决于采样率、位深度、时长和声道数(单声道 = 1,立体声 = 2)。
File size (bytes) = (sample rate in Hz × bit depth × duration in seconds × channels) ÷ 8
文件大小(字节) = (采样率(Hz)× 位深度 × 时长(秒)× 声道数) ÷ 8
Sample rate is measured in Hertz (Hz), e.g., 44.1 kHz = 44,100 samples per second. Bit depth is the number of bits per sample, often 16 or 24.
采样率以赫兹(Hz)为单位,例如 44.1 kHz = 44,100 次采样每秒。位深度是每个采样所用的比特数,常见值为 16 或 24。
5. Network Data Transfer Time | 网络数据传输时间
To estimate the time needed to send a file over a network, the file size must be in bits and the transfer rate in bits per second (bps).
要估算通过网络发送文件所需的时间,文件大小必须转换为比特,传输速率单位为比特每秒(bps)。
Transfer time (seconds) = file size (bits) ÷ transfer rate (bps)
传输时间(秒) = 文件大小(比特) ÷ 传输速率(bps)
Common transfer rates: 100 Mbps = 100 × 10⁶ bps, 1 Gbps = 1,000 × 10⁶ bps. Protocol overhead (TCP/IP headers, about 5–10%) is often added for more realistic calculations.
常用传输速率:100 Mbps = 100 × 10⁶ bps,1 Gbps = 1,000 × 10⁶ bps。为更贴近实际,通常还需考虑协议开销(TCP/IP 包头,约 5–10%)。
Additional formula: Propagation delay = distance ÷ speed of signal (approx. 2×10⁸ m/s in copper). This is usually negligible for local networks but significant over satellite links.
补充公式:传播延迟 = 距离 ÷ 信号速度(铜线中约 2×10⁸ m/s)。在局域网中一般可忽略,但在卫星链路中较为显著。
6. Address Bus and Memory Calculation | 地址总线与内存计算
The number of uniquely addressable memory locations is determined by the width of the address bus. Each addressable location typically holds one byte, but word‑addressable architectures may differ.
可寻址内存单元的数量由地址总线的宽度决定。每个可寻址单元通常存储一个字节,但按字寻址的架构可能不同。
Number of addressable locations = 2ⁿ (where n = address bus width in bits)
可寻址位置数 = 2ⁿ (n 为地址总线位宽)
If each location stores one byte, the total addressable memory (in bytes) = 2ⁿ. For example, a 32‑bit address bus can address 2³² bytes = 4 GiB.
若每个位置存储一个字节,则可寻址内存总量(字节)= 2ⁿ。例如,32 位地址总线可寻址 2³² 字节 = 4 GiB。
If the memory uses a word size larger than 1 byte, total capacity = 2ⁿ × word size (in bytes).
若内存字长大于 1 字节,则总容量 = 2ⁿ × 字长(字节)。
7. Boolean Algebra Laws and Identities | 布尔代数定律与恒等式
Boolean algebra simplifies logic expressions using a set of algebraic laws. The operations AND (·), OR (+), and NOT (¬) follow these identities:
布尔代数通过一系列代数定律简化逻辑表达式。与 (·)、或 (+)、非 (¬) 运算遵循以下恒等式:
| Law / Identity | AND form | OR form |
|---|---|---|
| Identity | A · 1 = A | A + 0 = A |
| Null | A · 0 = 0 | A + 1 = 1 |
| Idempotent | A · A = A | A + A = A |
| Complement | A · ¬A = 0 | A + ¬A = 1 |
| Commutative | A · B = B · A | A + B = B + A |
| Associative | (A·B)·C = A·(B·C) | (A+B)+C = A+(B+C) |
| Distributive | A·(B+C) = A·B + A·C | A+(B·C) = (A+B)·(A+C) |
| Absorption | A·(A+B) = A | A+(A·B) = A |
| De Morgan’s | ¬(A·B) = ¬A + ¬B | ¬(A+B) = ¬A · ¬B |
Double negation: ¬(¬A) = A. These laws are essential for simplifying circuits and logical queries.
双非律:¬(¬A) = A。这些定律对于简化电路和逻辑查询至关重要。
8. Logic Gate Expressions | 逻辑门表达式
Each basic logic gate can be represented by a Boolean expression. The symbols ¬, ·, +, and ⊕ denote NOT, AND, OR, and XOR respectively.
每种基本逻辑门都可以用一个布尔表达式表示。符号 ¬、·、+ 和 ⊕ 分别表示非、与、或、异或。
| Gate | Expression | Comments |
|---|---|---|
| NOT | Y = ¬A | Inverter |
| AND | Y = A · B | Logical product |
| OR | Y = A + B | Logical sum |
| NAND | Y = ¬(A · B) | Universal gate |
| NOR | Y = ¬(A + B) | Universal gate |
| XOR | Y = A⊕B = A·¬B + ¬A·B | Exclusive OR |
| XNOR | Y = ¬(A⊕B) = A·B + ¬A·¬B | Equivalence |
Combine these gates to build half‑adders, full‑adders, and sequential circuits.
将这些门组合可构建半加器、全加器和时序电路。
9. Algorithm Complexity and Big-O Notation | 算法复杂度与大O表示法
Big‑O notation describes the upper bound of an algorithm’s time or space requirements as the input size n grows.
大O表示法描述随着输入规模 n 的增长,算法时间或空间需求的上界。
| Complexity | Name | Example |
|---|---|---|
| O(1) | Constant | Array index access |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Linear search |
| O(n log n) | Linearithmic | Merge sort |
| O(n²) | Quadratic | Bubble sort |
| O(2ⁿ) | Exponential | Recursive Fibonacci |
Ignore constants and lower‑order terms: 3n² + 2n + 5 is O(n²). Space complexity uses the same notation for memory usage.
忽略常数项和低阶项:3n² + 2n + 5 是 O(n²)。空间复杂度同样使用此表示法衡量内存使用。
10. Compression Ratio | 压缩比
Compression reduces file size; the compression ratio measures the effectiveness of the compression algorithm.
压缩可减小文件体积;压缩比用于衡量压缩算法的效率。
Compression ratio = uncompressed size ÷ compressed size
压缩比 = 未压缩大小 ÷ 压缩后大小
A ratio of 4:1 means the compressed file is one‑quarter the size of the original. Space saving (%) = (1 – 1/ratio) × 100%. For lossy compression (images, audio), the ratio is a trade‑off with quality.
压缩比为 4:1 表示压缩后的文件是原始大小的四分之一。空间节省百分比 = (1 – 1/压缩比) ×
Published by TutorHao | IB Computer Science Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导