-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ3_ScalarComputations.m
More file actions
55 lines (46 loc) · 1.82 KB
/
Q3_ScalarComputations.m
File metadata and controls
55 lines (46 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% =========================================================================================
% FILE NAME: Q3_ScalarComputations.m
% AUTHOR: [Amey Thakur](https://github.com/Amey-Thakur)
% COURSE REPO: https://github.com/Amey-Thakur/COMPUTATIONAL-METHODS-AND-MODELING-FOR-ENGINEERING-APPLICATIONS
% RELEASE DATE: September 08, 2023
% LICENSE: Creative Commons Attribution 4.0 International (CC BY 4.0)
%
% DESCRIPTION:
% This script performs fundamental scalar algebraic computations to evaluate mathematical
% expressions involving exponents, trigonometric constants, and rational fractions.
%
% PROBLEM STATEMENT (Q3):
% Suppose that x = 5 and y = 2. Use MATLAB to compute the following:
% a. (1 - 1/x^5)^-1
% b. 3*pi*x^2
% c. 3y / (4x - 8)
% d. 4(y - 5) / (3x - 6)
%
% Reference: MATLAB for Engineering Applications, William J. Palm, Chapter 1, Q3.
%
% TECHNOLOGY STACK:
% - Programming Language: MATLAB (R2023a+)
% =========================================================================================
% --- Environment Initialization ---
clc; % Reset Command Window
clear; % Refresh Workspace
% --- Input Variable Definition ---
x = 5;
y = 2;
% --- Mathematical Evaluator ---
% a. (1 - 1/x^5)^-1
result_a = (1 - 1/x^5)^-1;
% b. 3*pi*x^2
result_b = 3 * pi * x^2;
% c. 3y / (4x - 8)
result_c = (3 * y) / (4 * x - 8);
% d. 4(y - 5) / (3x - 6)
result_d = (4 * (y - 5)) / (3 * x - 6);
% --- Results Visualization ---
fprintf('--- Scalar Computation Results (x=5, y=2) ---\n');
fprintf('a. (1 - 1/x^5)^-1 = %8.6f\n', result_a);
fprintf('b. 3*pi*x^2 = %8.4f\n', result_b);
fprintf('c. 3y/(4x-8) = %8.4f\n', result_c);
fprintf('d. 4(y-5)/(3x-6) = %8.4f\n', result_d);
% Professional Scholarly Footer
fprintf('\nTechnical Note: These operations demonstrate MATLAB''s precedence rules (BODMAS/PEMDAS) in scalar arithmetic contexts.\n');