Ik University
Assignment 1
Tibet Hatipolu
211BM2018
27.09.2015
Question 1: (20 Pts.) Calculate the following mathematical expressions by using one-line MATLAB
commands.
Question 2:
Answers: First i define the variables a,b,c and x then i define the equation after that i defined
the Delta and the roots.
>> syms a b c x
>> a*x^2+b*x+c==0
ans =a*x^2 + b*x + c == 0
>> a=4
a=4
>> b=-12
b = -12
>> c=-8
c =-8
>> D=b^2-4*a*c
D =272
>> x1=(-b+sqrt(D))/2*a
x1 =56.9848
>> x2=(-b-sqrt(D))/2*a
x2 =-8.9848
Question 3:
Answers: >> %First i will define the formula and the variables.
>> syms A B C x y
>> A*x+B*y+C==0
ans =C + A*x + B*y == 0
>> x=2
x =2
>> y=-4
y =-4
>> A=5
A =5
>> B=2
B =2
>> C=-1
C =-1
%Then i define the distance formula and i take the output.
>> d=(A*x+B*y+C)/sqrt(A^2+B^2)
d = 0.1857