Computer Science
| |||||||
---|---|---|---|---|---|---|---|
Handouts | Online | References & Tools | pbl |
物理 Physics: Falling Objects | 光學 Optics: Ray Tracing | 數值分析 Numerical Analysis: Roots | |
Work Sheets | Gravity Work Sheet | Ray Tracing Work Sheet | Root Finding Work Sheet |
Thinking | Write UML to represent problem (or a simplification) clearly | ||
Functions | From UML to commented pseudo-code. Deciding between writing one's own functions and using library or other people's functions Start with the simple Program m0.c (simple program), which you can compile/link/run with m0.txt or m0gdb.txt (to add information for debugger). Modify it according the UML diagram. Your code should be commented pseudo-code that calls functions. | ||
UML → mg1com.c | UML → mo1com.c | UML → mr1com.c | |
Variables | mg1com.c → mg2fixed.c (Implement w/Fixed Point) mg1com.c → mg3float.c (Implement w/ Floating Point) |
1. mo1com.c → mo2float.c (Implement w/ Floating Point)
2. mo2float.c → mo3com.c(Add commented code to use coordinate system) 3. Finally mo3com.c → mo4float.c(Implement coordinate system code w/floating point) | mr1com.c → mr2float.c (Implement /Floating Point) |
Pointers | Use Pointers & addresses to get input using stdio.h function fscanf() For Physics and Optics Problem, get 2 piece of input with a single fscanf() call. | ||
mg3float.c → mg4ptr.c | mo4float.c → mo5ptr.c | mr3ptr.c → mr3ptr.c | |
Flow | mg4ptr.c → mg5loop.c & mgdt.csv (Purpose: Repetition + File Entry → Less typing errors) | 1. mo5ptr.c → mo6if.c (Conditional: Correcting Lens Equation)
2. mo6if.c → mo7split.c + molib.c + molib.h (Split User Functions into three files) 3. mo7split.c → mo8loop.c (Repetition for multiple lens) | mr3ptr.c → mr4loop.c (Add Conditional + Repetition to zoom into root automatically) |
Arrays | mg5loop.c & mgdt.csv → UML → mg6array.c (Formatted Output table: Can Easy check data) | mo8loop.c, molib.c, molib.h, mo8.bat → UML → mo9array.c (Separate input, calculation & output phases) | 1.mr4loop.c → mr5array.c (Generalize equation that we can solve) (alternate version of mr4loop-alt.c)
2.(Bonus) Try to write code to take the n-root-p where n is an integer mr5array-nrootp.c |
Records | mg6array.c, mgdt.csv → mg7rec.c Use a record to link the observables and their time coordinates | mo9array.c, molib.c, molib.h → moArec.c Connect lens: lf and lx in record Opt → moBrec.c getOptR: Make pointer free version | mr5array.c → mr6rec.c Use a record to link the x,y data |
Text | Physics mg7rec.c & mgdt.csv → | Optics moArec.c, moBrec.c → | Numerical Analysis mr6rec.c → |