syms g(x)
syms c positive
g(x)=exp(-c*x)*x^2;

ezplot(subs(g(x),c,1),[0,4])


AM=input('Give your AM:');

int(g(x),0,AM/10^5)

dg(x)=diff(g(x))
ddg(x)=diff(dg(x))
%ddg(x)=diff(g(x),2);
droots=solve(dg(x)==0)

for k=1:length(droots)
    if subs(ddg(x),x,droots(k))>0
        disp('g(x) has a local minimum at x=')
        droots(k)
        disp(' with g(x)=')
        subs(g(x),x,droots(k))
    elseif  subs(ddg(x),x,droots(k))<0
        disp('g(x) has a local maximum at x=')
        droots(k)
        disp(' with g(x)=')
        subs(g(x),x,droots(k))
    else
        disp('g(x) has a critical point at x=')
        droots(k)
        disp(' but we can not tell (based on the seconf derivative) what is the nature of this point')   
    end
end



call=[1.0:0.1:1.5];
for k=1:length(call)
    b(k,1)=call(k);
    b(k,2)=subs(int(g(x),0,AM/10^5),c,call(k));
end
b