2,995 reputation
1629
bio website
location China
age
visits member for 1 year, 8 months
seen 10 hours ago

Feel free to correct the grammar mistakes in my posts.


Oct
26
comment Can I generate a “piecewise” list from a list in a fast and elegant way?
About 3 times faster than my c11 now :).
Oct
26
comment Can I generate a “piecewise” list from a list in a fast and elegant way?
I'm sorry but this approach is even slower than my c1 and no simpler than it.
Oct
26
comment Can I generate a “piecewise” list from a list in a fast and elegant way?
@Kuba Well, I should say it's more general… maybe the new list is generated by $f(a)$ and $g(a)$, or even $f(a1, a2)$ and $g(a1, a2)$…
Oct
26
comment How to collect result continuously (interruptible calculation) when running parallel calculations?
Oh, I overlooked the existence of CheckAbort… thanks for your explanation!
Oct
25
comment NIntegrate receiving a function with NumericQ which returns a list
I can't think out a work-around with the existence of _?NumericQ, but what do you really want? Just a explanation for the failure? A numerical integration without symbolic processing for a list of expressions? Or something else?
Oct
25
comment How to collect result continuously (interruptible calculation) when running parallel calculations?
Well… isn't the Reap and ParallelSow redundant in the last sample? I think Catch has only caught the output of ParallelTable here.
Oct
24
comment Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$
I guess I've found the reason why ParallelMap fails: have you distribute definitions for a parallel computation with DistributeDefinitions first? If not, see this page in the document.
Oct
22
comment Elementwise, compilable min function
The UnitStep approach is quite fast! But it only works for 2 lists, can it be extended to any number of lists?
Oct
22
comment How can I deal with a non-numerical value for a derivative at $t = 0$ when using NDSolve?
@3c. I'm sorry that I can't think out a efficient algorithm which can start from any i so far… But also notice that the rough range for the current algorithm can be quite extensive. (What I used is $[-10, 10]$ at beginning.)
Oct
21
comment How can I deal with a non-numerical value for a derivative at $t = 0$ when using NDSolve?
@3c. you seem to misunderstand the syntax of NestWhile, for the first round of iteration, # in the first argument means the second argument of NestWhile i.e. #[[1]] represents {f[0], 1/100}[[1]], #[[2]] represents {f[0], 1/100}[[2]] so the calculated expression is {First@SortBy[f@h[First@f[0], 1/100], g], 1/100/10}.
Oct
19
comment How can I deal with a non-numerical value for a derivative at $t = 0$ when using NDSolve?
@3c. I've changed the last part of the code, I think it's easier to understand now. Feel free to ask if you still feel it obscure.
Oct
8
comment In what situation is the use of Directive required?
Directive is still unnecessary for this case, VertexLabelStyle -> {{FontFamily -> "Helvetica", Bold, 14}} will work.
Sep
9
comment Why the EuclideanDistance of these 2 exact points generates the warning N::meprec?
@Nasser I'm afraid that $MaxExtraPrecision = Infinity; won't work, at least it generates the warning General::nomem: The current computation was aborted because there was insufficient memory available to complete the computation. in my computer 囧.
Sep
9
comment Why the EuclideanDistance of these 2 exact points generates the warning N::meprec?
Oh… I should have check the document of Abs
Sep
4
comment How to find first list element that differs from average of N previous elements by more than a given amount?
In fact you can also use the 3rd argument of Select to take the first matched sublist.
Sep
4
comment How to find first list element that differs from average of N previous elements by more than a given amount?
Your 2 samples give different answer…
Aug
2
comment substituting Green's function in non homogeneous diff eq
@user8822 Are you sure that the first line of the code gives Green's funtion? It's a little different from the one showed under the Example here
Aug
1
comment NMaximize and Conditional Loop
@DanielLichtblau But in this sample, a is only a Head
Jul
28
comment How can I calculate the perimeter of an equation-defined curve?
@chris So I'm still looking forward to a general numeric solution though b.gatessucks had solved it analytically :)
Jul
28
comment How can I calculate the perimeter of an equation-defined curve?
Oh, parametric representation… I should have not given up the effort for getting analytic solution so easily…