xzczd
Reputation
Next privilege 15,000 Rep.
Protect questions
 Jan 16 comment Heat convection differential equations from 1952 - Mathematica “fails to converge” It's never asked in this site before, so I wrote a self-answered question just now :) Jan 16 comment How do I solve a PDE with a strange boundary condition? @drN Feel free to use it :D Jan 16 comment How to do this Function with compile Is the length of sublists of l1 and l2 always 2? Jan 16 comment Solving Coupled Differential Equation to Get Smooth Asymptotic Solution What do you mean by saying "I have tried to get the solution to be smoothly asymptotic to zero at infinity, but I can't get that", in my view the resulting graph already meets this standard. Jan 16 comment Trouble with shooting method for a 4th-order stiff ODE I think it's just the nature of your equation: Some choices of {a, b} can't lead to a solution extending to infinity. Just observe this: mid = sol[0.6, 0.6]; {{lb, rb}} = mid["Domain"]; Plot[mid[t], {t, lb, rb}, PlotRange -> All] Jan 16 comment Heat convection differential equations from 1952 - Mathematica “fails to converge” Approximating max with 50 seems to be too large for Pr = 0.6 (and Pr = 0.72 in v9), max = 20 solves the problem. I guess max = 50 can also be used if one manually sets the initial guess of "Shooting" method carefully. BTW, I observed similar problem when solving Young-Laplace equation and found using the asymptotic solution at far field as the boundary a good solution. Does this set of equation owns a analytic asymptotic solution at far field? Jan 15 comment Superscript standalone text For your specific example, you can simply use \[Degree]C Jan 14 comment Why does Outer sometimes return a packed array, and sometimes not? Er… personally I think this question is a little scattered, maybe you can consider divide it into 2 or 3 questions? Jan 14 comment What is the default ColorFunction for MatrixPlot? @JasonB Can this be related to the version? I'm in v9.0.1. What if you try pattern Blend[__] & instead? Jan 14 comment Manipulating Some Lists in Compile If I understand the pseudo code correctly, it's just creating t described above? Then how about func[z_, nei_] := Module[{t = ConstantArray[0, Length@Flatten@z]}, t[[Rest@nei]] = 1; Partition[t, Length@z]]; func[Z, Neighbors[[2]]] Jan 14 comment Manipulating Some Lists in Compile If you insist on compiling the topple[r], at least provide the definition of r, emptl, degZ, ijTok, L, NeighNodeand tcount, without all these one can not tell how to compile the function. Jan 14 comment Manipulating Some Lists in Compile Well, to be honest, I think you're in the wrong way. Compile is the toy of experienced Mathematica user and one should gain a good enough understanding for "coding in Mathematica" before trying it. I think you'd better describe what you're trying to do in a more clear way so we can help figuring out if there's a better way to code. Jan 14 comment Manipulating Some Lists in Compile "return another list that created with t and Z", how is the "another list" created? I think you'd better describe your problem more clearly. Jan 13 comment Get position from one list and choose element of another list in Compile Actually if one insists on AppendTo then Map will fail, not sure about the exact reason though. Jan 13 comment Get position from one list and choose element of another list in Compile Then are you just looking for a compiled function or you want to insist on AppendTo, Map etc.? If the former, then how about f = Compile[{{l, _Integer, 1}}, Module[{list = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}}}, list[[l]]]]; t = f[{1, 2, 1}]? Jan 13 comment Get position from one list and choose element of another list in Compile You're practicing to use Compile? If not, why not simply use t = list[[l]] ? Jan 11 comment Trouble with shooting method for a 4th-order differential equation @W.Robin 1. FindRoots2D is essentially a function that uses points on the plot of equation as starting points to find the accurate roots of equation with FindRoot so it should be as effective as "FindRoot with a bunch of good starting points", if you still feel worried, just plug the roots back to the equation to check if they're correct . 2. Check this post. BTW, you may also give a try to other answers under the FindAllCrossings2D question. Jan 11 comment Trouble with shooting method for a 4th-order differential equation @W.Robin The first pile of warning isn't a problem, it's because FindRoots2D (You've chosen this one, right?) uses Compile to speed up while our B.C.s aren't compilable, and FindRoot (on which the FindRoots2D is built) has failed at some bad start point, anyway this doesn't influence the result. The second pile is just from a simple mistake. You need Show to combine 2 graphics: Show[ContourPlot[ Evaluate[{bc1[a, b] == 0, bc2[a, b] == 0}], {a, 0.4, 0.8}, {b, -0.05, 0.25}], Graphics[{PointSize@Medium, Blue, Point /@ roots}]] Jan 11 comment Trouble with shooting method for a 4th-order differential equation @W.Robin Check this post. Jan 10 comment Trouble with shooting method for a 4th-order differential equation @W.Robin 1. I think this method still belongs to shooting method, the power series is just to find a more accurate approximation of $y′(x_0)$ and $y‴(x_0)$. 2. This post may be helpful, BTW, if you simply set Method -> "ExplicitRungeKutta" the resulting plot will be as good as the default.