fun1 = @(x) ...), using fzeroroots solvedouble.
int to
integrate or diff to differentiate the right hand side. (Remember
in MATLAB the natural logarithm is log and the inverse tangent function
is atan). You may also have to simplify your answer, to confirm the results clearly.
int):
\begin{equation}
\int_{-\infty}^\infty \frac{\sin x}{x} dx,\qquad \int_0^1 \frac{1}{1+x^2} dx,\qquad \int_0^{\infty} e^{-x^2} dx,\qquad
\int_0^1 \frac{\ln(x+1)}{x^2+1}dx,\qquad
\int_0^1 \frac{x^{11}-1}{\ln x} dx.
\end{equation}
symsum (symbolic sum) to validate the following sums (use inf for \(\infty\))
\begin{equation}
\sum_{n=1}^\infty \frac{1}{3^nn} = \log\frac{3}{2},\qquad
\sum_{n=1}^\infty \frac{n}{3^n} = \frac{3}{4},\qquad
\sum_{n=1}^\infty \frac{1}{n^4} = \frac{\pi^4}{90}.
\end{equation}
symprod to evaluate the following infinite product (notice the
starting value of \(n\) in each expressions):
simplify by specifying how many steps (the
default step is just one), because the output
could still be complicated.
When using simplify you may have to tell matlab to try more steps
before giving up.
simplify with many steps of simplification). you can use double to convert symbolic
numbers to floating numbers, and use vpa if you want to show more digits.
\begin{equation}
\prod_{n=2}^\infty \left(1-\frac{1}{n^3}\right)
=\frac{\cosh (\pi\sqrt{3}/2)}{3\pi},\qquad
\prod_{n=1}^\infty \left(1+\frac{1}{n^4}\right)
=\frac{\cosh (\pi\sqrt{2}) - \cos (\pi \sqrt{2})}{2\pi^2}.
\end{equation}
polar or the parametric form in Cartesian coordinate using plot. You have to generate a vector for the angle \(\theta\), say
from \(0\) to \(2\pi\), and then the radius \( r(\theta)=1-\sin \theta\).
plot: \( x=\ln |t|\sin (t) \cos (t) ,\quad y=|t|^{0.3}\sqrt{\cos(t)}\) for \( t\in [-1,1]\).
Choose the vector for the parameters to be
t = [2.^(-20:-4) 0.1:0.01:1];t = [-t(end:-1:1) t];. (Try to see what happens
when you choose t = -1:0.01:1; or t = linspace(-1,1,101)). meshgrid and contour (choose the range of
the grid from -10 to 10 in both direction first and then refine it if you like)
\begin{equation}
x^2 + \left[ y - \frac{2(x^2+|x|-6)}{3(x^2+|x|+2)} \right]^2 = 36.
\end{equation}
x = linspace(-8,8,101); % vector for x-coordinates y = linspace(-8,8,101); % vector for y-coordiantes [X,Y] = meshgrid(x,y); % Get the grid points, matrices for (X,Y) % you have to specify the contour of one single level, and have to repeat the value in the command % "contour" like [0,0] for the zero contour
abs for the absolute value, and choose the proper
range of the axis for the implicit plot.
axis equal to make the aspect ration equal.
sym2poly (you will get a vector for the coefficients of the polynomial, instead of calculating them by yourself), and then evaluate the polynomial using polyval.
The function is plotted more accurately in which way, when evaluated as \((x-1)^{13}\)
or as the polynomial expansion?
syms z; p = sym2poly((z-1)^13); % get the coefficients for the polynomial (z-1)^13 x = linspace(0.9,1.1,51); % plot the data from polynomial evaluation, using the style "*" or "."