Ran Wei/Maths Series
中文
Mathematical Foundations for Computer Science and AI — Ran Wei

Entry diagnostic

Twelve ungraded tasks help you choose algebra and Python preparation. Attempt them before revealing the solutions; a wrong answer identifies a useful next step.

0.5 hours

By the end you can

  • Identify which algebra topics need review.
  • Distinguish unfamiliar notation from a calculation error.
  • Check that you can execute a short Python script.

Before you start

No prior modules. Pencil and paper; a Python interpreter only for the final three tasks.

Contents
1

How to use the diagnostic

Allow about thirty minutes. Try each task before showing its solution. Mark it “explained,” “needs practice,” or “unfamiliar.” There is no pass/fail gate. If any of Tasks 1–5 needs practice, use the linked algebra section; Tasks 6–9 identify topics taught in the main series, while Tasks 10–12 check lab readiness.

2

Arithmetic and algebra

Task 1 Fractions

Compute 3/4−2/33/4-2/3, showing a common denominator.

Show answer

9/12−8/12=1/129/12-8/12=1/12. Review fractions if you added denominators or cannot explain the equivalent fractions.

Task 2 Signs

Evaluate −32-3^2 and (−3)2(-3)^2 and explain why they differ.

Show answer

−9-9 and 99. In the first, the negative sign is outside the square; in the second it belongs to the base. Review operation order.

Task 3 Equations

Solve 3x+5=173x+5=17 and verify your answer in the original equation.

Show answer

Subtract five, then divide by three: x=4x=4. Check 3(4)+5=173(4)+5=17. Review equations if the reversible steps are unclear.

Task 4 Expansion

Expand (x+2)(x−3)(x+2)(x-3) without omitting cross terms.

Show answer

x2−3x+2x−6=x2−x−6x^2-3x+2x-6=x^2-x-6. Review polynomials.

Task 5 Exponents

Solve 2x=82^x=8 and name the inverse operation.

Show answer

x=3x=3. A base-two logarithm asks for the exponent producing eight. Review powers and logarithms.

3

Mathematical language

Task 6 Domains

Give the real domain of 1/(x−2)1/(x-2).

Show answer

All real inputs except x=2x=2, because that value makes the denominator zero. Study Module 01 functions.

Task 7 Indexed notation

Expand ∑i=14i\sum_{i=1}^4 i and calculate the total.

Show answer

1+2+3+4=101+2+3+4=10. The bounds are inclusive and the index takes integer values. Study Module 01 sums.

Task 8 Negation

Negate “every item is valid.” Is “every item is invalid” the negation?

Show answer

The negation is “at least one item is invalid.” “Every item is invalid” is stronger: some valid items could remain while the original universal claim is false. Module 02 will teach this distinction; it is currently planned. No logic prerequisite blocks Module 01.

Task 9 Claims and counterexamples

Does f(a+b)=f(a)+f(b)f(a+b)=f(a)+f(b) hold for every real function? Give a valid example supporting your answer.

Show answer

No. Choose f(x)=x2f(x)=x^2, a=2a=2, b=3b=3: 25≠1325\ne13. Study Module 01 contracts and claims. A function can satisfy additivity, but not every function does.

4

Python readiness

Task 10 Trace a loop

Predict the printed values:

for i in range(3):
    print(i)
    print(i * i)
Show answer

The six lines are 0,0,1,1,2,4 in that order. Both indented prints belong to each iteration. Review the Python notation guide.

Task 11 Define a function

Write a function returning the square of its input and call it with minus three.

Show answer

Use def square(x): with indented return x*x; square(-3) returns nine. Printing alone does not supply the returned value. Review functions.

Task 12 Run and diagnose

Run the orientation script from your terminal. Identify its final exception message and explain why the script still finishes.

Show answer

It reports a caught ZeroDivisionError with “division by zero.” The explicit except handles the deliberate fault. If the file cannot be opened, check the terminal’s working folder and the filename first. Use the setup instructions and error guide.

5

Choose preparation and continue

Use the algebra refresher for missed school-mathematics tasks and the Python primer for lab setup. New notation is taught in Module 01; you do not have to answer all twelve questions correctly before beginning it.