Advertising, Total A Revenue, R 20 6101 6222 6350 6350 6379 25 25 27 28 29 6423
ID: 3603428 • Letter: A
Question
Advertising, Total A Revenue, R 20 6101 6222 6350 6350 6379 25 25 27 28 29 6423 6360 31 6231 (a) Use command ScaterPlot to make a scatter diagram. Comment on the type of relation that may exist between the two variables. (b) Find the Quadratic function of best fit to the data. Express the solution using function notation. (c) Predict the total revenue when the optimal level of advertising is spent. In other words, use your quadratic model to approximate the maximum total revenue R given the present data (think of what vertex represents in this case). Use your current knowledge of Maple commands to present your solution showing all your work. Explain your steps to get a full credit. (d) Graph the scatter diagram and the best fit parabola togetherExplanation / Answer
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void main()
{
float a, b, c, root1, root2;
float realp, imagp, disc;
printf("Enter the values of a, b and c ");
scanf("%f %f %f", &a, &b, &c);
/* If a = 0, it is not a quadratic equation */
if (a == 0 || b == 0 || c == 0)
{
printf("Error: Roots cannot be determined ");
exit(1);
}
else
{
disc = b * b - 4.0 * a * c;
if (disc < 0)
{
printf("Imaginary Roots ");
realp = -b / (2.0 * a) ;
imagp = sqrt(abs(disc)) / (2.0 * a);
printf("Root1 = %f +i %f ", realp, imagp);
printf("Root2 = %f -i %f ", realp, imagp);
}
else if (disc == 0)
{
printf("Roots are real and equal ");
root1 = -b / (2.0 * a);
root2 = root1;
printf("Root1 = %f ", root1);
printf("Root2 = %f ", root2);
}
else if (disc > 0 )
{
printf("Roots are real and distinct ");
root1 =(-b + sqrt(disc)) / (2.0 * a);
root2 =(-b - sqrt(disc)) / (2.0 * a);
printf("Root1 = %f ", root1);
printf("Root2 = %f ", root2);
}
}
}
#include<stdio.h>
#include<math.h>
int main(){
float a,b,c;
float d,root1,root2;
printf("Enter a, b and c of quadratic equation: ");
scanf("%f%f%f",&a,&b,&c);
d = b * b - 4 * a * c;
if(d < 0){
printf("Roots are complex number. ");
printf("Roots of quadratic equation are: ");
printf("%.3f%+.3fi",-b/(2*a),sqrt(-d)/(2*a));
printf(", %.3f%+.3fi",-b/(2*a),-sqrt(-d)/(2*a));
return 0;
}
else if(d==0){
printf("Both roots are equal. ");
root1 = -b /(2* a);
printf("Root of quadratic equation is: %.3f ",root1);
return 0;
}
else{
printf("Roots are real numbers. ");
root1 = ( -b + sqrt(d)) / (2* a);
root2 = ( -b - sqrt(d)) / (2* a);
printf("Roots of quadratic equation are: %.3f , %.3f",root1,root2);
}
return 0;
}
scatter(x,y)
scatter(x,y,sz)
scatter(x,y,sz,c)
scatter(___,'filled')
scatter(___,mkr)
scatter(___,Name,Value)
scatter(ax,___)
s = scatter(___)
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
scatter(x,y)
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
sz = linspace(1,100,200);
scatter(x,y,sz)
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
c = linspace(1,10,length(x));
scatter(x,y,[],c)
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
sz = 25;
c = linspace(1,10,length(x));
scatter(x,y,sz,c,'filled')
theta = linspace(0,2*pi,150);
x = sin(theta) + 0.75*rand(1,150);
y = cos(theta) + 0.75*rand(1,150);
sz = 140;
scatter(x,y,sz,'d')
theta = linspace(0,2*pi,300);
x = sin(theta) + 0.75*rand(1,300);
y = cos(theta) + 0.75*rand(1,300);
sz = 40;
scatter(x,y,sz,'MarkerEdgeColor',[0 .5 .5],...
'MarkerFaceColor',[0 .7 .7],...
'LineWidth',1.5)
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
ax1 = subplot(2,1,1);
scatter(ax1,x,y)
ax2 = subplot(2,1,2);
scatter(ax2,x,y,'filled','d')
theta = linspace(0,1,500);
x = exp(theta).*sin(100*theta);
y = exp(theta).*cos(100*theta);
s = scatter(x,y);
s.LineWidth = 0.6;
s.MarkerEdgeColor = 'b';
s.MarkerFaceColor = [0 0.5 0.5];
> ps.options(paper="letter")
> postscript(file="c:/coursework/contact.scatter.ps")
> plot(age,time,xlab="age",ylab="contact time (seconds)",pch=3)
> title("Scatter Plot of Contact Time vs. Age")
> graphics.off()
> plot(trial,time,type="n",xlab="trial",ylab="contact time (seconds)")
> points(trial[female==1],time[female==1],type="p",pch=4)
> for(i in unique(subj))
> {
> if(female[ntimes*i]==1) {lines(trial[subj==i],time[subj==i],type="l",lty=4)}
> }
> lines(lowess(trial[female==1],time[female==1]),lwd=3)
> title("contact time for females")
data contact;
infile '/home/muskie/correlated.data/tracking.dat' firstobs=2;
input Sex $ Age Shape $ Trial1-Trial4;
run;
data repdat;
set contact;
time=trial1;trial=1;subj=_N_;output;
time=trial2;trial=2;subj=_N_;output;
time=trial3;trial=3;subj=_N_;output;
time=trial4;trial=4;subj=_N_;output;
run;
data _NULL_;
set repdat;
file 'timetrial.repeated.dat';
if _N_=1 then put "time sex age shape trial subj";
put time sex age shape trial subj;
run;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.