[Solved] MATH 233: Scientific Computing Assignment 1 Hello World

$25

File Name: MATH_233__Scientific_Computing_Assignment_1_Hello_World.zip
File Size: 518.1 KB

SKU: [Solved] MATH 233: Scientific Computing Assignment 1— Hello World Category: Tag:
5/5 - (1 vote)
  1. What is your experience with C++ (before doing the homework) ?
  2. Read the introduction of C++ for Scientific Computing , write, compile and run your own Hello World code.
  3. Read sections 2 to 8. Suggestion: run and modify the example codes.
    • Give one reason to use C++ over Matlab.
    • What are the pros and cons of using the double type to represent real numbers ?
    • How would you decide to use int versus long ?
    • What does the & operators does ? What about the * ?
    • How would you declare a 345 array of real numbers, assuming that we want double precision ? How would you do it if at the time of compilation the array size N M L was not known ?
    • If A is an array of double of size N, how do you access its first and last element ?
  4. (a) Imagine you want to implement a function Legendre(double x, int n) which return the value of the nth Legendre Polynomial evaluated at x for 0 < n < Which control structure would you use ? why ?
    • Implement the Legendre(double x, int n) Your function should return an error message if n > 6 or n < 0.
    • Implement a function sampledLegendre(double a, double b, int N, int n) which return the vector of size N containing the values of the nth Legendre Polynomial at the uniformly distributed points x0 = a,,xN1 = b.
    • How can you verify your code ?
    • If we call AnN the output of sampledLegendre(-1,1, int N, int n), what is the limit as N of the scalar product ? (You might wanna use what you just implemented to get some intuition)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] MATH 233: Scientific Computing Assignment 1 Hello World[Solved] MATH 233: Scientific Computing Assignment 1 Hello World
$25