xzczd
Reputation
10,440
Next privilege 15,000 Rep.
Protect questions
 Feb 23 comment Is it possible to draw a line on a MatrixPlot that would reflect density of row values? Is the average made by MatrixPlot necessary? If not, how about using ArrayPlot instead? Feb 20 comment Puzzle with Mathematica @gwr I was just trying to make the code as concise as possible. ( Since I failed to think out a better method, I decided to make the answer distinctive in some way :D ) Feb 20 comment Implementation of a matrix formula @J.M. Oh, you're right, row.Transpose[pts, {1, 3, 2}].col can be further simplified to col.(row.pts) in this case, the speed improvement is negligible though. (Transpose is so fast. ) Feb 20 comment Why is ListPlot[] so slow for coordinate pairs? Can we speed it up? @AlbertRetey Your guess is right, at least according to the AbsoluteTime[]-t measurement, but this leads to another problem, that is, the AbsoluteTime[]-t measurement seems to be inaccurate, too, if my sense of time is correct! (Maybe I should pinch a stopwatch?) Feb 18 comment Why is ListPlot[] so slow for coordinate pairs? Can we speed it up? @Kuba Yeah, I noticed it just now, too. Quite surprising I should say, I thought ListPlot is just a Graphics generator! Feb 14 comment Problem with solving an optimal control system with Shooting Method Interesting…I'd like to mention that, v10 seems to be necessary to solve the equation with the simpler solution, in v9.0.1 and v8.0.4 it failed. And the Expand seems to be redundant, at least according to my test on Wolfram Cloud. BTW, how did you find the good initial guess for the not-that-simple solution? Feb 13 comment Error propagation code @DineshKumar Glad it helps. If you feel satisfied with my answer, you can vote it up by clicking the gray triangles and accept it by clicking the checkmark sign. Feb 13 comment How to handle a special Neumann-like boundary condition in NDSolve? @LCFactorization ?NumericQ is necessary to suppress the warning, if you don't mind the warning, simply use solL[xl_]. There're many examples for the usage of ?NumericQ in this site, you can have a search. Feb 13 comment How to handle a special Neumann-like boundary condition in NDSolve? @LCFactorization It's just derivative symbol, when xL gets a numeric value, solL[xl] will evaluate to a InterpolatingFunction. As to the reading material part, have you ever read Leonid Shifrin's excellent book? Here's the unfinished Chinese edition: tieba.baidu.com/p/3230448463 Feb 12 comment How to handle a special Neumann-like boundary condition in NDSolve? @LCFactorization See my edit. If you still have difficulty in understanding, evaluate solL[14] alone and check the output. Notice that precisely speaking, $x_0$ is not undetermined, but to be determined. Feb 12 comment How to handle a special Neumann-like boundary condition in NDSolve? @LCFactorization f is just a function that creates function. I create this function for conciseness. These 2 lines can be replaced by sol1[x0_?NumericQ] := NDSolveValue[{eqn, bcl, bcr[[1]]}, y, {x, -14, 0}]; sol2[x0_?NumericQ] := NDSolveValue[{eqn, bcl, bcr[[2]]}, y, {x, -14, 0}];, now it's a little easier to understand, right? Feb 11 comment NDSolve: problem due to boundary conditions Just tried ep=zb=10^-4, though some warning pops up, the "shape" of result looks quite similar to that with ep=zb=10^-2, what's the unexpected part?: i.stack.imgur.com/aw0xw.png Feb 11 comment Differential equations with rational functions as solution Write the solution out in terms of unknown coefficients, substitute, expand and collect terms, and solve the resulting system of equations is the only approach I can think out, and I think it should work when the degree isn't too high. Can you show an example that is hard to handle with this approach? Feb 11 comment NDSolve: problem due to boundary conditions Can you show a concrete example for the numerical errors? Have you tried a higher WorkingPrecision? Feb 11 comment Partial differential equation with infinity limit Is it - D[U0[t], t] or + D[U0[t], t]? And where's the initial condition ($u(y,0)=?$)? Feb 10 comment Can't clear variables with subscripts Feb 9 comment Table with List iterator return unpacked list Interesting, another possible evidence: With[{xx = Range[1., 10., 0.01]}, Table[w + ky, {w, Range[1., 10., 0.01]}, {ky, xx}]] // DeveloperPackedArrayQ Feb 9 comment Table with List iterator return unpacked list Mathematica never promised to give you a packed array :D, anyway, it's a interesting observation. Feb 8 comment How to define a complicated function inside the body of Compile? @MichaelE2 Yeah, actually the memory cost is the only thing in my mind, because I think that's what OP is concerned. However, after checking FullForm@f`, I noticed my answer is incorrect, it also inserts 3 copies of the (compiled) function into the body! So far I can't think out a way to define a sub routine as OP desires… Feb 7 comment How to define a complicated function inside the body of Compile? @MichaelE2 I guess it… depends on how the big nasty function is defined :D