Figure 1: Question 2 show code, possible partial credit . Instead of a unit circ
ID: 3703246 • Letter: F
Question
Figure 1: Question 2 show code, possible partial credit . Instead of a unit circle described by the equation r2+92 # 1. it is al o possible to have curves 2 described by the equation Here a, ? > 0 and ? * ß in general-The curve with (:: 1.7 and ? 3.2 is plotted in Fig.1. You are roquired to numerically calculate the area enclosed by the curve r7+21 1. Let's not panic and be stupid and think this is a tro-dimensional integral 2. Observe that the curve is symmetric around both the z and y axes 3. Hence we calculate the area in the first quadrant r,g2 0 and multiply the result by 4 . The Cartesian plane is divided into four quadrants 5. See Fig, 1. (a) First quadrant: top right?26. 320. (b) Second quadrant: top left 0,y20 (c) Third quadrant: botton left r so,s d) Fourth quadrant: bottom right0,ys The area A under the curve in the finst quadrant is given boy the following integral: (2.2) Write down the equation for p(a) in the first quadrant. Prove that the integral in eq. (2.2) is a proper integral (a) midpoint rule, (b) trapezoid rule, (c) Simpson's rule. .Compute the value of Ai using Use -1000 subintervals for all three calculations 2. You are permitted to use the code displayed in the online lecture notes. ·The total area A is given by A = 4A1. ·State your computed values for the total area A to for decimal places. Denote your values by A, A As . Do not worry if the three resalts you obtain are not egual to four decimal placesExplanation / Answer
PROGRAM CODE:
#include<conio.h>
#include<graphics.h>
int firstquad(int a,int b,int c);
int midpoint(int x ,int y, int ,r);
void main()
{
clrscr();
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"C:TCBGI");
int x,y,r;
cout<<"enter circle coordinates";
cin>>x>>y>>r;
circle(x,y,r);
firstquad(x,y,r);
midpoint(x,y,r);
getch();
closegraph();
}
int firstquad(int x,int y,int r)
{
int n;
n=x+r; //coefficients of x and y are 1 as it is a unit circle and thus the equation
int y1=n;
if(y1!=NAN)
cout<<" the given integral is a proper integral";
else
cout<<" it is not a proper integral";
return y1;
}
int midpoint(int x,int y,int r)
{
int d=3-(2*r);
if(d>0)
{
x=x+1;
y=y-1;
cout<<x<<y<<"is the mid point";
}
else{
x=x+1;
y=y;
cout<<x<<y<<"is the mid point";
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.