Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HEY GUYS IN THE QUESTION IT IS SAID THAT C++, JAVA OR FORTRAN IS OK, BUT I WOULD

ID: 2993843 • Letter: H

Question


HEY GUYS IN THE QUESTION IT IS SAID THAT C++, JAVA OR FORTRAN IS OK, BUT I WOULD PREFER C++ , ITS EASIER FOR ME. PLEASE SOLEVE THE QUESTION COMPLETELY AND EMAIL ME AT vaibhavroy_1992@hotmail.com. CORRECT ANSWERS WILL BE RATED WITH 2100 PTS.

For this assignment, you will need to write some short codes to complete the following problems. You are free to write in any language from C++, Java, Fortran. The only restrictions on your codes are that they must write your output to a file, and numbers in your results must be properly formatted with an appropriate number of significant figures. Use exponential notation where appropriate. Please turn in both hard and electronic copies of both your codes and your results. Your codes and results may be combined into a single file for electronic submission, provided that it is clear which results correspond to which code. Root finding has its place in several applications in the areas of vibration (modal analysis of wing flutter), acoustics (microphone and speaker placement for acoustic signature measurements), and computational fluid dynamics (matching governing equations to proper numerical schemes for aerodynamic calculations). Determine the highest real root, out to exactly three decimal points, of the polynomial f(x) = 1.5x3 - 8.1x2 + 18.6x - 10 graphically (no code required; simply plot; you may use any function of any software to do this) using fixed-point iteration (five iterations, x0 = 1) using Newton-Raphson (five iterations, x0 = 1) using Secant method (five iterations, x.1 = 0, x0 = 1) Compute the approximate percent relative errors out to exactly four decimal points for each iteration of your solutions as described in the notes. There are many applications where numerical integration is required in aerospace engineering. Examples include integrating a pressure distribution about an airfoil to find lift and drag, integrating a time-dependent drag profile on a rocket to determine time of flight and burnout altitude, and integrating a probability distribution function to find the average fuel drop diameter in an aircraft engine. In many instances, the function to be integrated may be a set of discrete data points rather than being analytical, but the technique is similar. Integrate the following function both analytically and numerically: Use both the trapezoidal and Simpson's 1/3 rules to numerically integrate the function out to exactly seven decimal points. For both cases, start with n = 1, then double the number of segments until your last computation includes 512 segments. Compute the percent relative errors, out to exactly four decimal points, for the numerical results (as compared to the analytic answer). % Error = Numerical Answer - Analytic Answer/Analytic Answer

Explanation / Answer

#include"iostream"

#include"conio.h"

#include <fstream>


int main()

{

std::cout<<"Enter the desired order of matrix (Maximum 10) ";

int n;

std::cin>>n;

std::cout.precision(2);

// Now enter matrix 1

std::cout<<" Enter elements of matrix 1 ";

int i,j;

float m1[10][10];

for(i=0;i<n;i++)

for(j=0;j<n;j++)

std::cin>>m1[i][j];

// Now enter matrix 2

std::cout<<" Enter elements of matrix 2 ";

float m2[10][10], add[10][10], sub[10][10], mt1[10][10], mt2[10][10];

for(i=0;i<n;i++)

for(j=0;j<n;j++)

std::cin>>m2[i][j];

//Now ADD two matrix and store in add

for(i=0;i<n;i++)

for(j=0;j<n;j++)

add[i][j]=m1[i][j]+m2[i][j];

//Now SUBTRACT mat2 from mat1 and store in sub

for(i=0;i<n;i++)

for(j=0;j<n;j++)

sub[i][j]=m1[i][j]-m2[i][j];

//Find transpose and store in mt1 and mt2

for(i=0;i<n;i++)

for(j=0;j<n;j++)

mt1[i][j]=m1[j][i];

for(i=0;i<n;i++)

for(j=0;j<n;j++)

mt2[i][j]=m2[j][i];

//Multiply the matrices

float sum,mul[10][10];

int k;

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

sum=0;

for(k=0;k<n;k++)

sum=sum+m1[i][k]*m2[k][j];

mul[i][j]=sum;

}

}


//All the required calculations are fininshed, now we print the result

  

std::ofstream myfile; //Put it in a file as well

myfile.open ("Result.txt");

//Multiplication matrix

//myfile.precision(2);

std::cout<<" Multiplication is ";

myfile<<" Multiplication is ";

  

for(i=0;i<n;i++)

{for(j=0;j<n;j++)

{std::cout<<mul[i][j];

myfile<<mul[i][j];

std::cout<<" ";

myfile<<" ";

}

std::cout<<" ";

myfile<<" ";

}

//Addition

std::cout<<" Addition is ";

myfile<<" Addition is ";

for(i=0;i<n;i++)

{for(j=0;j<n;j++)

{std::cout<<add[i][j];

myfile<<add[i][j];

std::cout<<" ";

myfile<<" ";

}

std::cout<<" ";

myfile<<" ";

}

//Subtraction

std::cout<<" Subtraction is ";

myfile<<" Subtraction is ";

  

for(i=0;i<n;i++)

{for(j=0;j<n;j++)

{std::cout<<sub[i][j];

myfile<<sub[i][j];

std::cout<<" ";

myfile<<" ";

}

std::cout<<" ";

myfile<<" ";

}

//Transpose 1

std::cout<<" Transpose of MATRIX 1 is ";

myfile<<" Transpose of MATRIX 1 is ";

  

for(i=0;i<n;i++)

{for(j=0;j<n;j++)

{std::cout<<mt1[i][j];

myfile<<mt1[i][j];

std::cout<<" ";

myfile<<" ";

}

std::cout<<" ";

myfile<<" ";

}

  

//Transpose 2

std::cout<<" Transpose of MATRIX 2 is ";

myfile<<" Transpose of MATRIX 2 is ";

  

for(i=0;i<n;i++)

{for(j=0;j<n;j++)

{std::cout<<mt2[i][j];

myfile<<mt2[i][j];

std::cout<<" ";

myfile<<" ";

}

std::cout<<" ";

myfile<<" ";

}

  

  

myfile.close();

  

system("pause");

return 0;

}