1.

What is the difference between sqrt(10) and sqrt(sym(10))?(a) There is no difference(b) sqrt(sym(10)) is incorrect(c) There is no function as sqrt(d) sqrt(10) returns exact value while sqrt(sym(10)) returns 10^(1/2)This question was addressed to me in an international level competition.The question is from Solving Equations topic in division MATLAB Basics of MATLAB

Answer»

The correct ANSWER is (d) sqrt(10) returns exact value while sqrt(sym(10)) returns 10^(1/2)

To explain I would say: ‘sqrt()’ is a predefined FUNCTION used to FIND a square root of large numbers to reduce the complexity of equation. sqrt(sym(10)) introduces 10 as a symbolic object to the MATLAB workspace.

Thus it will return 10^(1/2) as a symbolic expression and won’t DIVULGE the exact root. This helps often to reduce an equation before INCREASING program complexity in MATLAB.



Discussion

No Comment Found

Related InterviewSolutions