Scientific Computing Cat
Scientific Computing Cat
QUESTION ONE
c. Blockchain [5 marks]
c) Using a diagram, explain the CRoss Industry Standard Process for Data Mining
(CRISP-DM) process model applied in data analytics problems. [10 marks]
The CRISP-DM process model consists of six phases:
1. Business Understanding: Determine business objectives, assess the situation,
and define data mining goals.
2. Data Understanding: Collect initial data, describe data, explore data, and verify
data quality.
3. Data Preparation: Select data, clean data, construct data, integrate data, and
format data.
4. Modeling: Select modeling techniques, generate test design, build models, and
assess models.
5. Evaluation: Evaluate results, review process, and determine next steps.
6. Deployment: Plan deployment, monitor and maintain models, and produce
final report.
d) Write a program in any programming language that can be used to calculate
the circumference of a circle. [10 marks]
```python
# Python program to calculate the circumference of a circle
import math
def calculate_circumference(radius):
return 2 * math.pi * radius
# Example usage
radius = float(input("Enter the radius of the circle: "))
circumference = calculate_circumference(radius)
print(f"The circumference of the circle is: {circumference:.2f}")
```
1. Physics:
o Simulations: Modeling physical phenomena like fluid dynamics,
electromagnetism, and quantum mechanics.
o Astrophysics: Simulating the behavior of celestial bodies and cosmic
events.
o Particle Physics: Analyzing particle collisions and behavior in
accelerators.
2. Chemistry:
o Molecular Dynamics: Simulating the behavior of molecules and
chemical reactions.
o Quantum Chemistry: Modeling electronic structures and reactions at
the quantum level.
o Drug Discovery: Screening and optimizing potential drug candidates.
3. Biology:
o Genomics: Analyzing DNA sequences to understand genetic
variations and functions.
o Proteomics: Studying the structure and function of proteins.
o Systems Biology: Modeling complex biological systems and their
interactions.
Quantum Computing
Key Concepts:
1. Superposition: A qubit can be in a state of 0, 1, or both 0 and 1
simultaneously. This allows quantum computers to process multiple
possibilities at once.
2. Entanglement: Qubits can be entangled such that the state of one qubit is
dependent on the state of another, regardless of the distance between them.
This enables highly correlated computations.
3. Quantum Interference: Quantum computers use interference to amplify
correct results and cancel out incorrect ones, increasing computational
accuracy.
Application Areas
1. Cryptography
o Quantum Key Distribution (QKD): Quantum computing can
enhance secure communication through QKD, ensuring that
encryption keys are exchanged securely.
o Breaking Classical Encryption: Quantum computers can potentially
break widely used encryption methods like RSA and ECC by
efficiently factoring large numbers using algorithms such as Shor's
algorithm. This necessitates the development of quantum-resistant
cryptographic algorithms.
2. Drug Discovery and Material Science
o Molecular Simulation: Quantum computing can simulate molecular
structures and interactions at the quantum level, providing insights
into chemical reactions, protein folding, and drug interactions. This
accelerates the discovery of new pharmaceuticals and materials.
o Material Design: Quantum simulations can help design new materials
with specific properties by modeling complex molecular and atomic
interactions more accurately than classical computers.
QUESTION TWO
1. Python: Widely used due to its simplicity and extensive libraries like NumPy,
SciPy, and Matplotlib for numerical and scientific computing.
2. R: Specialized for statistical analysis and data visualization, with packages like
ggplot2 and dplyr.
3. MATLAB: Popular for numerical computing, simulations, and algorithm
development, with built-in functions and toolboxes.
4. Fortran: Traditionally used in high-performance scientific computing for
numerical and engineering applications.
5. Julia: A high-level, high-performance language for technical computing with
syntax familiar to users of other technical computing environments.
D. Write a program in R or Python Programming that has the following as applied
in data structures:
I. Arrays (5 marks)
```python
import numpy as np
# Create an array
arr = np.array([1, 2, 3, 4, 5])
print("Array:", arr)
```
# Create a matrix
matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
print("Matrix:\n", matrix)
```
# Create a dataframe
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]}
df = pd.DataFrame(data)
print("DataFrame:\n", df)
```
a) Write a program to initialize and store the experiment data, using appropriate
data types for measurements, timestamps, and IDs. [10 marks]
```python
import pandas as pd
from datetime import datetime
```python
# Initialize subscripted variables (arrays) for measurements
measurements = [
[23.4, 25.1, 22.8],
[24.5, 26.0, 23.3],
[22.9, 24.0, 21.8]
]
```python
import numpy as np
def calculate_stats(measurements):
stats = []
for measurement in measurements:
mean = np.mean(measurement)
std_dev = np.std(measurement)
stats.append((mean, std_dev))
return stats
Example usage
stats = calculate_stats(measurements)
print("Mean and Standard Deviation for each experiment:", stats)
```
```python
def
# Example usage
lower_bound = 23.0
upper_bound = 25.5
outliers = identify_outliers(measurements, lower_bound, upper_bound)
print("Experiments with outliers:", outliers)
```
QUESTION FOUR [20 MARKS]
a) Write a code to draw a bar graph to represent the following scores of ten
students: 75, 53, 90, 87, 50, 85, 92, 75, 60, and 95. [10 marks]
```python
import matplotlib.pyplot as plt
c) Write a code to determine the area enclosed between the x-axis and the
curve \(y = x^3 + 2x + 5\) and the ordinates \(x=1\) and \(x=2\). [10 marks]
```python
import scipy.integrate as integrate
#### If statement:
```python
# If statement example
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is 5 or less")
```
b) Write a code to solve for the roots of \(2x^2 - 6x - 3 = 0\). [10 marks]
```python
import numpy as np
1. Syntax: The set of rules that defines the combinations of symbols considered to
be correctly structured programs in a language.
2. Semantics: The meaning of the syntactically correct strings of a programming
language.
3. Variables: Storage locations identified by a name used to hold data.
4. Control Structures: Constructs that control the flow of execution (e.g., loops,
conditionals).
5. Data Structures: Methods to organize and store data (e.g., arrays, lists).
6. Functions/Procedures: Blocks of code designed to perform specific tasks.
7. Input/Output: Mechanisms for receiving input from and sending output to the
external environment.
8. Error Handling: Mechanisms to handle runtime errors and exceptions.
d) Differentiate between high-level programming language and low-level
programming language. Where does Python lie and why? [10 marks]
Reasons:
These characteristics make Python an ideal choice for a wide range of applications,
from web development and data analysis to artificial intelligence and scientific
computing.