Practice problem 3

Problem 3(a)

For testing: we compute :
clearvars
q1 = g(0)
q1 = 0
q2 = g(1.5)
q2 = 0.856188393624901

Problem 3(b)

The function is continuous, so we can use the intermediate value theorem.
From (a) we know that there must be a value such that .
We define (see below).
as = fzero(@G,[0,1.5]) % must use @G
as = 0.551039427609027

Definition of functions g, G

All function definitions must be at the end of the mlx file.
function q = g(a)
f = @(t) exp(-t.^2);
q = integral(f,0,a);
end
function q = G(a)
q = g(a)-0.5;
end