Notes, summaries, assignments, exams, and exercises for Mathematics for Other courses

R Programming Fundamentals, SQL, and Advanced Clustering Methods

Mathematics238.95 KB

Section A: R Basics and Data Types (Weeks 1-4)

Model Questions and Answers

Q: Create a vector v (3, NA, Inf, -Inf). Explain adding 5 to v.

A: The operation is element-wise. Missing values (NA) propagate, resulting in NA. Infinite values (Inf, -Inf) remain infinite.

v <- c(3, NA, Inf, -Inf)
print(v + 5)
# Output: [1]  8 NA Inf -Inf

Q: Given vector a, write code to count and replace NAs.

A: Assuming a <- c(10, 15, NA, 20).

  • Count NAs: sum(is.na(a)) → 1.
  • Replace NAs (e.g., with 0): a[is.na(a)] <- 0.

Q: Explain the difference between a[a > 12] and a[which(a > 12)].

A: Both select elements greater than 12 (15, 20). However:

  • a[a > 12] → [1] 15 NA (Uses logical indexing; preserves the position of NA in the original vector as NA).
  • a[which(
...
Continue reading "R Programming Fundamentals, SQL, and Advanced Clustering Methods" »

Document Similarity Metrics: Jaccard, Cosine, and Hamming Calculations

Mathematics128 KB

Document Similarity Metrics: Jaccard, Cosine, and Hamming Calculations (Q99)

Documents (after lowercasing and tokenizing words, removing punctuation):

  • D1: “the night is dark and the moon is red”
  • D2: “the moon in the night is red”
  • D3: “i can see moon is red the night is dark”

Step A — Construct Word Sets / Vectors (Unified Vocabulary)

Vocabulary (unique words across D1–D3): {the, night, is, dark, and, moon, red, in, i, can, see} (11 words)

i) Jaccard Similarity (Set of Words)

Set(D1) = {the, night, is, dark, and, moon, red}

Set(D2) = {the, moon, in, night, is, red}

Set(D3) = {i, can, see, moon, is, red, the, night, dark}

Compute pairwise Jaccard:

  • D1 ∩ D2 = {the, night, is, moon, red} → size 5; D1 ∪ D2 size = 8 → J(D1,D2)=5/8=0.625
  • D1
...
Continue reading "Document Similarity Metrics: Jaccard, Cosine, and Hamming Calculations" »

Neural Network Fundamentals and Regularization Techniques

Mathematics205.18 KB

Chapter 1 - 

Linearity: As long as the values that vary (assuming any other values R
constant) R not themselves involved in anything more than
○addition&
○scalar multiplication


Chapter 2 -

Shallow network

y = f[x, ϕ]  
y = ϕ₀ + ϕ₁ a[θ₁₀ + θ₁₁x] + ϕ₂ a[θ₂₀ + θ₂₁x] + ϕ₃ a[θ₃₀ + θ₃₁x]

y = ϕ₀ + ϕ₁h₁ + ϕ₂h₂ + ϕ₃h₃

QwgRhv4EiRW0RvTacrkAAAAASUVORK5CYII=

Universal Approximation theorem - with enough hidden units, a shallow
neural network can describe any continuous function on a
compact subset ofto arbitrary precision 

Terminology - The hidden units themselves are sometimes referred to as neurons. Rhe values of the inputs to the hidden layer (i.E., before the ReLU functions are applied) are termed pre-activations. The values at...

Continue reading "Neural Network Fundamentals and Regularization Techniques" »

Engineering Economics: Net Value Function Calculations and Applications

Mathematics10.91 KB

Question Bank #1 – Net Value Functions

L03 – Engineering Economics & Net Value Applications

Review Questions

Recall the nanoRIMS example discussed in lecture. If the net value of buying the nanoparticles is $0 (the reference), determine the net value per week of having a grad student make the nanoparticles based on the following information:

  • Benefit = $896/week
  • Cost:
    • Cost of consumable supplies per week: Ingredients & electricity to make one batch as accurately as a grad student does is $5/100 mL * 200 mL/week = $10/week
    • Cost of time: Grad student time is $15/hr * 9 hours/100 mL * 200 mL/week = $270/week
    • Cost of space: Occupying a whole fume hood space for 16 hours during working time is $12.50/hr * 16 hrs/week = $200/week
    • Cost of any device:
...
Continue reading "Engineering Economics: Net Value Function Calculations and Applications" »

Consider the following bond issues: Bond A: 5% 15-year bond Bond B: 5% 30-year bond Neither bond has an embedded option. Both bonds are trading in the market at the same yield. Which bond will fluctuate more in price when interest rates change? Why

Mathematics597.67 KB

Residual claim: shareholders get only what is left-over after everyone has been paid. Discount rate: the rate at which present and future values are traded off. Future value of cash flow: C x (1+ r)^n. R= (FV/PV)^1/n - 1. Present value= C/(1+ r)^n. Compound interest: exponential growth in wealth, initial amount of money + the interest that has been added the previous years. Perpetuity, Growing Perpetuity, Annuity: multiple payments overtime, same amount, regular interest. NsiVhHlHiJkAAAAASUVORK5CYII=ARZztg+LFFEoAAAAAElFTkSuQmCCNPV: the difference between and investment's value and its cost. Positive NPV=investment yes; NPV=0 project earns the required rate. HHnusUVC0Zbt27arOPfdcsxDbvFpd77rrLkVciKQEM4O76CypfHESHecs0Y1vC8VRpAcQRwowalyFBIE8EBAGIQ9Upc12hQDupDHnxGcCDEItpQZFBRJGgYVJFqfazpBlDuhVsK8t9s3YmzAIzTjr8s6CgCAgCAgCgkAMAqKkGAOQPBYEBAFBQBAQBJoRAWEQmnHW5Z0FAUFAEBAEBIEYBIRBiAFIHgsCgoAgIAgIAs2IgDAIzTjr8s6CgCAgCAgCgkAMAsIgxAAkjwUBQUAQEAQEgWZEQBiEZpx1eWdBQBAQBAQBQSAGAWEQYgCSx4KAICAICAKCQDMiIAxCM866vLMgIAgIAoKAIBCDgDAIMQDJY0FAEBAEBAFBoBkREAahGWdd3lkQEAQEAUFAEIhBQBiEGIDksSAgCAgCgoAg0IwICIPQjLMu7ywICAKCgCAgCMQgIAxCDEDyWBAQBAQBQUAQaEYEhEFoxlmXdxYEBAFBQBAQBGIQ+D9dawnmr27i1AAAAABJRU5ErkJggg== . IRR measures the average return on the investment: accept project if IRR is greater than the discount rate(minimum return you want). LJpYK4NR1Bwor62WY+31yZkAl6ZXI7ayvjwDbiQCbo24jxWbMZByqTA5mgVya3s7YyDmwjDvwLNZ4w3mHp5DcAAAAASUVORK5CYII=Payback

...
Continue reading "Consider the following bond issues: Bond A: 5% 15-year bond Bond B: 5% 30-year bond Neither bond has an embedded option. Both bonds are trading in the market at the same yield. Which bond will fluctuate more in price when interest rates change? Why" »

MATLAB Signal Processing: Digital and Analog Filter Design

Mathematics2.29 KB

Digital Signal Processing

Load the data file: load('exam.mat');

Parameters

  • x = xBPFI; % Input signal
  • Fs = 10e3; % Sampling frequency
  • Ts = 1/Fs;
  • t = (0:length(x)-1) * Ts; % Time vector
  • n_f = 10000;
  • f = (0:n_f-1)*Fs/n_f; % Frequency vector

Input Signal Analysis

Plotting the input signal in the time and frequency domains:

plot(t,x); xlabel('t (s)'); ylabel('x(t) (V)'); title('Input signal in TIME');
X = fft(x,n_f)/length(x);
figure(); subplot(2,1,1); plot(f,abs(X)); xlabel('f (Hz)'); ylabel('|X(f)| (V)'); title('Input signal in FREQUENCY');
subplot(2,1,2); plot(f,angle(X)); xlabel('f (Hz)'); ylabel('\angleX(f) (rad)');

Bandpass Filter Design

Configuring the filter parameters and applying a Hamming window:

  • Tbw = 150; fpl = 2400; fcl = (fpl-Tbw/2)/Fs; wcl = 2*
...
Continue reading "MATLAB Signal Processing: Digital and Analog Filter Design" »

Actuarial Mathematics: Annuity and Loan Practice Problems

Mathematics45.25 KB

Actuarial Science Practice Problems

Problem 11: Investment Option Comparison

11. $50,000 is invested in two options:

  • Option A: Invested into a fund with an annual effective rate i.
  • Option B: Purchase of an annuity-immediate with 24 level annual payments at a rate of 10%.

Option B is equivalent to Option A with an interest rate of 5%. The accumulated value for Option A is 50,000(1+i)24. For Option B: Z * 9k= = Option A. Find i.

Problem 14: Monthly Deposits and Future Value

14. Smith deposits $1,000 at the end of each month with a nominal rate i(12) = 0.12. The first deposit is on 1/31/2010, and the last is on 12/31/2034. From 2035 to 2059, the accumulated value Y is: Z Z Z

Problem 15: Interest Rate Changes and Balances

15. Since 6/30/2014, a deposit of $100...

Continue reading "Actuarial Mathematics: Annuity and Loan Practice Problems" »

Essential Time Management and Scheduling Vocabulary

Mathematics2.48 KB

Unit 7: Scheduling and Time Management

  • Date: A numbered day in a month. *What's the date today?
  • Schedule: To plan your tasks. *We have to schedule the flight.
  • Paper Diary: A traditional notebook to write down tasks and important dates. *I use the diary more than the electronic planner.
  • Electronic Planner: A digital device used to store information.
  • Wall Calendar: A paper display showing 12 months divided into weeks and days. *I have to erase an appointment on the wall calendar.
  • Up to Date: Containing the latest information. *I bought a diary to stay up to date.
  • Appointment: A formal arrangement to meet or visit.
  • Erase: To remove something. *I have to erase an appointment on the wall calendar.
  • Deadline: A specific time or day by which something must
...
Continue reading "Essential Time Management and Scheduling Vocabulary" »

Essential Accounting Terminology and Definitions

Mathematics4.08 KB

Essential Accounting Terminology

Core Concepts

  • Accounting: Practice, activity, action.
  • Accountancy: Theory, technique.
  • Accountant: Person, profession.
  • Account: Record, ledger, report, put the $ on.

Key Roles and Statements

Roles

  • CFO: Chief Financial Officer.
  • Accountant
  • Bookkeeper

Financial Statements

  • Balance Sheet: Financial statement showing the financial situation of the company.
  • Profit & Loss Statement: Financial statement to show the profit earned or losses incurred in a determinate period.

Debits, Credits, and Balances

  • DEBIT: When you move the $ out.
  • CREDIT: Transfer the $ to another account.
  • To Debit Account: To take $ out of account.

Assets and Liabilities

Assets

  • Assets: Any property owned by a person or firm.
  • Intangible Asset: Asset that you cannot
...
Continue reading "Essential Accounting Terminology and Definitions" »

Time Study, Sampling, and Business Management Concepts

Mathematics3.42 KB

Time Study in Work Measurement

The study of time as one of the major work measurement techniques was formalized by Taylor.

Technical Insolvency

A firm is in a state of technical insolvency when the economic profit generated by its assets is not sufficient to meet the interest on its debts.

Quota Sampling

Quota sampling falls under the category of non-probability sampling.

Commercial Experimentation Technique

Analysis of Variance

The technique used in most commercial experimentation is Analysis of Variance.

Strategic Behavior and Social Groups

The set of shared values of a social group determines your preference for a particular type of strategic behavior.

Investment Risk

If a certain level of risk exists between two alternative investments, preference...

Continue reading "Time Study, Sampling, and Business Management Concepts" »