Wolfram Mathematica

Welcome! This is the main Mathematica chat room for mathematic...
Feb 9, 2022 10:23
Do you think I could update my package on there, if nothing else?
Feb 9, 2022 09:32
Hmmm. I just get 404 errors from those wolfram pages
Feb 9, 2022 09:06
Ok, I guess that is the place to put it then. I'm not really using Mathematica anymore
Feb 9, 2022 08:43
@b3m2a1, is the Public Paclet Server still functional? I see a bunch of open issues to add packages and not much activity. I've updated my CompoundMatrixMethod package and was trying to update it on there.
Mar 14, 2021 08:55
@CarlLange Yes, I did notice it was very new. I'll try and find time to test it out in the next few days
Mar 12, 2021 23:26
Does Mathematica have a way to do machine learning on data measurements that themselves have an uncertainty attached to them? I have n observations on p features, each individual value of which can be expressed as a mean +- error. Some of the individual values are much more noisy than others, but I'm currently (in R) completely ignoring this variability and just taking the mean. I know there is Interval, and I've just seen Around today
Dec 17, 2020 13:29
Any idea on whether RemoteBatchSubmit will be usable within a PBS/Torque cluster?
Dec 17, 2020 09:30
The new version looks like it has some really nice functionality. I have barely used Mathematica for 2 years now as I've moved into bioinformatics, but if the bio-sequence functionality increases I might be able to pick it back up for some things
Sep 8, 2020 13:52
@flinty, it was an unhelpful, passive-aggressive comment to make
Mar 26, 2020 14:41
Has anyone used spatial autocorrelation in Mathematica? I have a set of points in 2D space and I'd like to use something like Moran's I or similar index of "clumpyness".
Mar 23, 2020 09:56
@CarlLange Or someone left their account logged in somewhere
Oct 11, 2019 09:28
@b3m2a1, thanks, that Print > Save as PDF works much better (on mac)
Oct 10, 2019 14:50
Hmm. I have a Mathematica notebook, with some code and results (mostly figures). I'd like to export it as a pdf (preferably without the code showing). What is my best way to do that? Just saving as a pdf gives a fixed page width, which cuts half the figures off.
Sep 19, 2019 13:56
@CATrevillian, yes, I agree that is what it looks like it does. Don't know why it doesn't send $i=1$ and $i=2$ to the subkernels and instead chooses 1 and 4.
Sep 19, 2019 04:23
@CATrevillian, put a Print statement in and see what order they are done in. ParallelTable[Print[{i, j}]; Pause[i*j/20], {i, 1, 10}, {j, 1, 10}] seems to send $i=1$ and $i=4$ to the subkernels first for me, slightly strangely. Don't know the answer to the other parts.
Sep 8, 2019 15:08
@CATrevillian I'm not sure off the top of my head whether the Evans function works for PDEs
Sep 8, 2019 15:07
Yeah, my CMM package is for ODEs
Sep 7, 2019 18:32
@CATrevillian, the Evans function is a more general method, it constructs an analytic function whose roots are eigenvalues. The Compound Matrix Method part is applicable for linear ODEs (but not periodic boundary conditions), and removes a lot of the stiffness at the cost of going from order n to order (n choose (n/2)).
Sep 6, 2019 08:31
@CATrevillian I have a package for solving eigenvalue BVPs via the Evans function: github.com/SPPearce/CompoundMatrixMethod
Sep 4, 2019 09:18
@CATrevillian, I haven't investigated it too much, it generally works fine for my eigenvalue package, but I always give it a closed curve.
Sep 3, 2019 09:40
pts = Table[{Cos[\[Theta]], Sin[\[Theta]]}, {\[Theta], 0.2, 1.1 \[Pi],
0.1}];
ListLinePlot[pts,
PlotLabel ->
"Winding Number: " <>
ToString@Graphics`PolygonUtils`PointWindingNumber[pts, {0, 0}]]
Sep 3, 2019 09:39
@CATrevillian There is an undocumented function GraphicsPolygonUtilsPointWindingNumber, which works on non-closed curves. Playing around with it, it looks like it gives a value of 1 for an arc of a circle if it is at least half the circle. My guess is that it is joining the endpoints with a straight line to make a closed curve.
 
Jul 18, 2019 08:28
Yes, the phi matrix is larger than the original matrix, it is size n choose 2 instead of n
Jul 18, 2019 08:27
@xiaohuamao, my implementation requires a linear ODE, not sure whether the Evans function can be used in nonlinear, probably not.
Jul 18, 2019 05:08
But your second order equation doesn't use that anyway.
Jul 18, 2019 05:03
The Compound Matrix Method part takes the differential equation underlying the Evans function and lifts it into a higher dimensional manifold (Grassmanian). This helps stop the unstable manifolds from dominating the numerical integration
Jul 18, 2019 04:58
Yes, you do in solving the ODE, but not directly into a matrix form
Jul 18, 2019 04:57
You don't discretize directly is the reason that spurious solutions tend not to occur in the same way
Jul 18, 2019 04:57
@xiaohuamao, to be honest I'm not an expert in the pure maths background. The introduction was written by my PhD supervisor, I used the technique in my thesis and then used it again last year.
Take a look at http://www.macs.hw.ac.uk/~simonm/talks/strath.pdf, and the paper https://gdz.sub.uni-goettingen.de/id/PPN243919689_0410?tify=%7B%22view%22:%22info%22,%22pages%22:%5B171%5D%7D
Jul 17, 2019 20:11
it compiles the fiunction the first time, which takes maybe a second, so any speed up in evaluation gets swallowed by that if it only is evaluated a few times.
Jul 17, 2019 20:10
@xiaohuamao, it may well be that it is not faster at all for your second order equation.
Jul 17, 2019 20:10
Did you try PerformanceGoal->"Speed"?
Jul 17, 2019 08:10
at least when you use it just as pfun = .... anyway. Possibly need to put pfun[[Lambda][Lambda]_, [Delta][Delta]_, [Phi][Phi]_] = pfun[[Lambda][Lambda], [Delta][Delta], [Phi][Phi]] = ...... in that code
Jul 17, 2019 08:09
I suspect it may not make much difference in timing in your case to use that over the previous function, but it may speed it up. It will automatically cache evaluation values, which is nice.
Jul 17, 2019 07:58
pfun[\[Lambda]\[Lambda]_, \[Delta]\[Delta]_, \[Phi]\[Phi]_] :=
ParametricEvansFunction[
Thread[lhs == \[Epsilon] {\[Alpha][x], \[Beta][
x]}] /. {\[Lambda] -> \[Lambda]\[Lambda], \[Delta] -> \
\[Delta]\[Delta], \[Phi] -> \[Phi]\[Phi]}, {\[Alpha][xL] ==
0, \[Alpha][xR] == 0}, variables, {x, xL, xR}, \[Epsilon]];

FindRoot[pfun[1, 0.9, \[Pi]][e], {e, 0}]
Jul 17, 2019 07:57
@xiaohuamao, you need to set the values of the constants inside the pfun function as it evaluates more things first than Evans/ToMatrixSystem
Jul 17, 2019 07:55
it is making C code to evaluate
Jul 17, 2019 07:55
I don't know about that error, that is related to the use of Compile
Jul 16, 2019 19:55
hmm, I need to figure out what exactly the issue is
Jul 16, 2019 19:51
doesn't stop it working and finding the roots, but means something is not right
Jul 16, 2019 19:51
so the values are ~O(10^15), rather than O(1)
Jul 16, 2019 19:50
so clearly something isn't quite right
Jul 16, 2019 19:50
Although my normalisation is not working properly there :(
Jul 16, 2019 19:50
or `pfun2 = ParametricEvansFunction[
Thread[lhs == \[Epsilon] {\[Alpha][x], \[Beta][x]}], {\[Alpha][
xL] == 0, \[Alpha][xR] == 0}, variables, {x, xL, xR}, \[Epsilon],
PerformanceGoal -> "Speed"]`
FindRoot[pfun2[a], {a, 0}] // AbsoluteTiming
Jul 16, 2019 19:47
and then use that function with one argument, the potential eigenvalue:
FindRoot[pfun[a], {a, 0}] // AbsoluteTiming
Jul 16, 2019 19:47
so just one call to ParametricEvansFunction
Jul 16, 2019 19:47
Then you set up the function with:
\[CapitalDelta] = 1; \[Delta] = 0.9 \[CapitalDelta]; \[Phi] =
1.1 \[Pi]; \[Lambda] = 1; cutoff = 20; Nless = 10; tolr = 1*^-6;
xL = -cutoff; xR = cutoff;
m[x_, pm_] = (\[CapitalDelta] + \[Delta] (Tanh[x/\[Lambda] - 1] -
Tanh[x/\[Lambda] + 1])/(2 Tanh[1])) Exp[
I pm \[Phi] (Tanh[x/\[Lambda]] + 1)/2];
Fop1[F_] := D[F, x];
lhs = {-I Fop1[\[Alpha][x]] + m[x, 1] \[Beta][x],
I Fop1[\[Beta][x]] + m[x, -1] \[Alpha][x]};
variables = {\[Alpha], \[Beta]};
pfun = ParametricEvansFunction[
Jul 16, 2019 19:46
@xiaohuamao:
Needs["CCompilerDriver`"];
compileType = If[Length[CCompilers[]] > 0, "C", "WVM"];
Options[ParametricEvansFunction] = {PerformanceGoal -> "Speed"};
cmmRepRules = \[FormalPhi][a_?ListQ] :>
Signature[a] \[FormalPhi][Sort[a]];
cmmRepRules2 = {pL[a_?ListQ][q_] :> Signature[a] pL[Sort[a]][q],
pR[a_?ListQ][q_] :> Signature[a] pR[Sort[a]][q]};

(*Generation of the derivatives of the matrix minors,looping over \
rule to sort the lists of indices*)

minorsDerivs[list_?VectorQ, len_?NumericQ] :=
Jul 16, 2019 19:31
@xiaohuamao, sorry, i forgot that time. I wrapped the two functions into one, and hopefully sped it up. Also much better handling of cases where you approach and singular limit (like equations with 1/r) terms.
Jul 16, 2019 08:04
I have a newer version of the package that I'm working on, if you want to try that