I want to use Stochastic Gradient Descent method on its own (not for neural networks) to minimize an objective function in Mathematica. I couldn’t find any SGD routine implemented in Mathematica (12.0) so far. Is it an option in one of the routines?

Thanks.

## Tag Archives: mathematica

## Is the stochastic gradient descent minimization implemented in Mathematica?

## Mathematica on Surface Pro X (ARM64)?

I’ve been having trouble installing Mathematica on my Surface Pro X, which is an ARM based machine. I was under the impression that Mathematica worked on Arduino devices, which is somehow similar. I’ve opened a support ticket but never heard back.

Anything I’m missing ? I think I tried 11.3, I used to have access to previous version through my professional account, but I’ve only access to a download manager that doesn’t allow for installation of previous versions.

For clarification, the main desktop app does not launch, but the kernel does (and yes, it does compute 1+1=2, but sadly the lack of graphical interface prevents me from plotting anything, so it’s not that useful).

Many thanks

## How to automatically add the edge width of a hand-drawn graph to the respective imported morphological graph in Mathematica?

I am still relatively new to Mathematica, but with the great help of this forum, I managed to transform a doodled sketch into a graph, see attached file. I have used this code:

```
doodle = Import["filename.jpg"];
graph =
MorphologicalGraph@
SkeletonTransform@
Thinning@Closing[ColorNegate@Binarize@doodle, DiskMatrix[2]];
```

However, what I would like to do now is to output a value for each edge that reflects how thick or thin the edge was (on average over its length) in the original doodle sketch. Is this possible at all? If so, how do I do it?

## Search using Query fails accessing ChemSpider with Mathematica

Performing a search with “Formula” works as expected. Search with “Query” fails. Printout attached to better document the problem.

## Mathematica Function Taxicab Numbers

I have spent days trying to compile this code and I cannot generate a list of taxicab numbers for the Hardy-Ramanujan Theory. Here is the module I wrote earlier:

```
Ramamanujan_Number[N_] :=
Module[{taxicablist = [], int_count = 0, i, j, k},
For[i = 0, i < N, i++;
For[j = 1, j < N - 1, j++; For[k = 1, k < N - 1, k++;
If[j^3 + k^3 == i, int_count += 1]];
If[int_count == 2, AppendTo[taxicablist, i];
]]]]
Print[taxicablist]
Ramananujan_Number[10000]
```

What minor changes do I need to make in order to generate a list in this function?

## How to get the implicit solution of this PDE (Maple can but I don’t manage with mathematica)?

I asked this question about the analytical solution of the PDE :

$ $ \partial_t c=\partial_x((c-a)(c-b)\partial_xc) $ $

And I was given the answer that Maple gives the following implicit form as a solution :

$ $ \eqalign{&{k_{{1}}}^{2}{k_{{2}}}^{2}{c}^{2} + \left( 2\,{k_{{1}}}^{4}k_{{2}}k_{{3

}}-2\,{k_{{1}}}^{2}{k_{{2}}}^{2}a-2\,{k_{{1}}}^{2}{k_{{2}}}^{2}b

\right) c\cr &+ \left( 2\,{k_{{1}}}^{6}{k_{{3}}}^{2}-2\,a{k_{{1}}}^{4}k_{{

2}}k_{{3}}-2\,b{k_{{1}}}^{4}k_{{2}}k_{{3}}+2\,ab{k_{{1}}}^{2}{k_{{2}}}

^{2} \right) \ln \left( -{k_{{1}}}^{2}k_{{3}}+ck_{{2}} \right)\cr & -2\,{k

_{{2}}}^{4}t-2\,k_{{1}}{k_{{2}}}^{3}x-2\,{k_{{2}}}^{3}k_{{3}}-2\,k_{{4

}}{k_{{2}}}^{3}

=0}

$ $

But when I’m doing the $ DSolve$ on Mathematica (I don’t have Maple) I get no solution !

So my question is : can Mathematica give me that implicit solution ? Can Maple do things that Mathematica cannot ?

## Why mathematica just returns Hold of my Input?

Example:

Solve[x^2 + a x + 1 == 0, x]

Output: Hold[Solve[x^2 + a x + 1 == 0, x]]

What is the problem?

Any child can solve this in its head

## How to solve this NDSolve problem in Mathematica

I found a confused problem in solving a ODE problems with NDSolve in Mathematica, the code is as follows:

I have tried ‘Clear[Derivative]’ and restart the kernel but these methods don’t work.

Here is the question:

Here is my mathematica code:

```
Clear[Derivative];
ClearSystemCache;
r = 0.3; a = 3; delta = 0.45; M0 = 0.975; T = 20;
u[t] = 0.5*l[t]*delta*M[t];
eql1 = M'[t] == r*M[t] Log[1/M[t]] - u[t]*delta*M[t];
eql2 = l'[t] == -2 *a *M[t] - l[t]* r *Log[1/M[t]] + l[t]*r -
l[t]*u[t]*delta;
condition = {M[0] == M0, l[T] == 0};
sol = NDSolve[Flatten@{{eql1, eql2}, condition}, {M, l}, {t, 0, 20}]
```

However this has problems, here is the problem result

```
Power::infy: Infinite expression 1/0. encountered.
Infinity::indet: Indeterminate expression 0. \[Infinity] encountered.
Power::infy: Infinite expression 1/0. encountered.
Infinity::indet: Indeterminate expression 0. \[Infinity] encountered.
Power::infy: Infinite expression 1/0. encountered.
General::stop: Further output of Power::infy will be suppressed during this calculation.
Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.
General::stop: Further output of Infinity::indet will be suppressed during this calculation.
NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.
```

The result picture is here

I can’t figure out why there be “non-numerical value for a derivative at t == 0″, there shouldn’t be non-numerical value at t==0, the whole M[t] should be >0 when t<=20. I have spent a lot of time on this problem and still could not find an answer, please help me.

Best regards!

## How can I access data from a redis database in Mathematica?

I have a program which writes data to a redis database and would like to visualize that data live in Mathematica. I only found DatabaseLink which seems to support only SQL databases. Is there a more direct way to do this than implementing my own C mathematica module?

## Voigt notation in Mathematica

In the computational mechanics software (Abaqus, Ansys, Comsol, etc), Voigt notation is always used to represent a symmetric tensor by reducing its order.

Now I would ask How can we get the Voigt Notation from second order tensor or fourth order tensor in **a very efficient** way in Mathematica.

e.g. second order tensor: Array[Subscript[a, ## & @@ Sort[{##}]] &, {6, 6}] // MatrixForm

PS: ‘(Manual) using hand writing’ is not a good way.

Reference Links: https://en.wikipedia.org/wiki/Voigt_notation