2
$\begingroup$

I have noticed some features available on the site Wolfram|Alpha which I am not managing to replicate. Two examples which come to mind are the following.

  1. Given a function $f(x)$, I want to determine its Taylor series, and its radius of convergence also. For example, take $f(x)=\ln(1-x^2)$. On Wolfram|Alpha, I get the following output:

    Figure 1

    where I get the nice "converges when $|x|<1$" detail below. I know that I can obtain the series by running the command Series[Log[1-x^2], {x,0,8}], but I don't know how to get the radius of convergence. The inbuilt command SumConvergence does not allow one to determine the radius, since the general term of the series must be known.

  2. Suppose we have a homogeneous system of linear equations represented by the matrix equation $\mathbf{Ax}=\mathbf0$, e.g. $$\underbrace{\begin{pmatrix} 3&2&1\\7&6&k\\k&4&3 \end{pmatrix}}_{\mathbf A}\begin{pmatrix} x\\y\\z\end{pmatrix}=\begin{pmatrix} 0\\0\\0\end{pmatrix}$$ Both the Solve and LinearSolve commands give only the trivial solution $x=y=z=0$ as the solution to the system. But the website gives the interesting ones too:

    Figure 2

There are a few other situations where I have found the site more useful than the application - but so far these two have been the most frustrating. Is there any way to achieve the two above in Mathematica without having to go online?


EDIT For 2, I attempted to use Reduce by running the following code.

Reduce[{
 {3, 2, 1},
 {7, 6, k},
 {k, 4, 3} } . {x,y,z} == {0, 0, 0}]]

but got the following (better, but still not as good) output:

(z == 0 && y == 0 && x == 0) || ((y == -2 z || y == -((5 z)/4)) && x == 1/3 (-2 y - z) && y != 0 && k == (10 (2 y + z))/(3 y))
$\endgroup$
9
  • $\begingroup$ As per 2. - use Reduce. $\endgroup$
    – corey979
    Commented Mar 26, 2017 at 21:06
  • $\begingroup$ @corey979 I actually tried that, and got the output (z == 0 && y == 0 && x == 0) || ((y == -2 z || y == -((5 z)/4)) && x == 1/3 (-2 y - z) && y != 0 && k == (10 (2 y + z))/(3 y)), but this is less informative (no $z\neq 0$, and no values of $k$ for which the solutions work). $\endgroup$ Commented Mar 26, 2017 at 21:08
  • 2
    $\begingroup$ No. And I need to write this sentence to exceed the limit of 15 characters for a comment to say it to you. $\endgroup$
    – corey979
    Commented Mar 26, 2017 at 21:21
  • 1
    $\begingroup$ How about FunctionDomain f[x_] := Log[1 - x^2]; FunctionDomain[f[x], x] for the region of definition? $\endgroup$
    – bill s
    Commented Mar 26, 2017 at 22:13
  • 1
    $\begingroup$ Try With[{c = Simplify[SeriesCoefficient[Log[1 - x^2], {x, 0, n}], n > 0]}, FullSimplify[SumConvergence[c x^n, n]]] for the first one. For the second one, this might help: mat = {{3, 2, 1}, {7, 6, k}, {k, 4, 3}}; MapAt[NullSpace, {k, mat} /. Solve[Det[mat] == 0, k], {All, 2}]. $\endgroup$ Commented Mar 27, 2017 at 0:29

1 Answer 1

2
$\begingroup$

To shed some light why Mathematica only gives the trivial NullSpace for example 2 in post, I solved this by hand and this is what I found:

$$ A= \begin{pmatrix} 3 & 2 & 1\\ 7 & 6 & k\\ k & 4 & 3 \end{pmatrix} $$

To find the null space, we solve for $x$ in $Ax=0$. Applying Gaussian elimination

$$ \begin{pmatrix} 3 & 2 & 1\\ 7 & 6 & k\\ k & 4 & 3 \end{pmatrix} \overset{R_{2}=R_{2}-\frac{7}{3}R_{1}}{\underset{R_{3}=R_{3}-\frac{k}{3} R_{1}}{\longrightarrow}} \begin{pmatrix} 3 & 2 & 1\\ 0 & \frac{4}{3} & k-\frac{7}{3}\\ 0 & 4-\frac{2}{3}k & 3-\frac{k}{3} \end{pmatrix} $$

Now $R_{3}=R_{3}-\frac{\left( 4-\frac{2}{3}k\right) }{\frac{4}{3}}R_{2}$ gives

\begin{equation} \begin{pmatrix} 3 & 2 & 1\\ 0 & \frac{4}{3} & k-\frac{7}{3}\\ 0 & 0 & \frac{1}{2}k^{2}-\frac{9}{2}k+10 \end{pmatrix} \tag{1} \end{equation}

Last row gives

$$ \left( \frac{1}{2}k^{2}-\frac{9}{2}k+10\right) z=0 $$

Two cases to consider in (1)

case 1 If $\frac{1}{2}k^{2}-\frac{9}{2}k+10\neq0$ then $z=0$. Second row now gives $\frac{4}{3}y+\left( k-\frac{7}{3}\right) z=0$, or $y=0$. First row gives $x=0$. Hence in this case the NullSpace is

$$ \begin{pmatrix} x\\ y\\ z \end{pmatrix} = \begin{pmatrix} 0\\ 0\\ 0 \end{pmatrix} $$

case 2 If $\frac{1}{2}k^{2}-\frac{9}{2}k+10=0$, then $z=t$, a free parameter, which can be any value. Second row in (1) now gives \begin{align*} \frac{4}{3}y+\left( k-\frac{7}{3}\right) t & =0\\ y & =-\frac{3}{4}t\left( k-\frac{7}{3}\right) \end{align*} And first row gives

\begin{align*} 3x+2y+z & =0\\ 3x & =-2\left( -\frac{3}{4}t\left( k-\frac{7}{3}\right) \right) -t\\ x & =\frac{1}{2}t\left( k-3\right) \end{align*}

Hence in this case, the NullSpace is

$$ \begin{pmatrix} x\\ y\\ z \end{pmatrix} =t \begin{pmatrix} \frac{1}{2}\left( k-3\right) \\ -\frac{3}{4}\left( k-\frac{7}{3}\right) \\ 1 \end{pmatrix} $$

Since $\frac{1}{2}k^{2}-\frac{9}{2}k+10=0$, the solution is $k=5,k=4$. Substituting these values into the above gives the NullSpace as

$$ \begin{pmatrix} x\\ y\\ z \end{pmatrix} = t\left\{ \begin{pmatrix} 1\\ -2\\ 1 \end{pmatrix} , \begin{pmatrix} \frac{1}{2}\\ -\frac{5}{4}\\ 1 \end{pmatrix} \right\} $$

For any $t$. For only $t=0$, this gives the result gives by Mathematica.

So Wolfram Mathematica only considered the case 1 above, and did not consider case 2. Wolfram Alpha, which has additional A.I. engine, seems to have looked more into this.

$\endgroup$
5
  • 1
    $\begingroup$ Here's how to use Mathematica for constructing the reduced form: UpperTriangularize[First[LUDecomposition[{{3, 2, 1}, {7, 6, k}, {k, 4, 3}}]]]. $\endgroup$ Commented Mar 27, 2017 at 4:50
  • $\begingroup$ @J.M. Thank you. $\endgroup$
    – Nasser
    Commented Mar 27, 2017 at 5:04
  • $\begingroup$ @J.M. btw, this only works for square matrices. For non-square matrices, I had to write an M function to do this. $\endgroup$
    – Nasser
    Commented Mar 27, 2017 at 5:20
  • $\begingroup$ Indeed, it is unfortunate that Mathematica does not have something built-in for performing Gaussian elimination on rectangular matrices. $\endgroup$ Commented Mar 27, 2017 at 5:28
  • $\begingroup$ Thanks for this solution. I was intersted in case 2, and particularly the values of k. $\endgroup$ Commented Mar 27, 2017 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.