5,293 reputation
2959
bio website
location China
age
visits member for 2 years, 6 months
seen 20 hours ago

Feel free to correct the grammar mistakes in my posts.


Dec
31
comment Alternatives to FiniteElement as Spatial Discretization Method for NDSolve
If user21 doesn't appear under your question, then @ won't remind him… and I think that behavior is irrelevant to this problem.
Dec
25
comment Alternatives to FiniteElement as Spatial Discretization Method for NDSolve
For the second part of question, in that era, Mathematica just can not handle this type of problem, at least cannot handle it elegantly. A typical answer is this. In fact this is one of the reasons causing my self-learning of FDM and FEM.
Dec
25
comment InverseFourierTransform of simple function takes forever
Seems this hasn't been done: Hello, welcome! I suggest the following: 1) As you receive help, try to give it too, by answering in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
Dec
23
comment How to make a graph of this function?
Are you sure your expression will produce a graph? With[{m = 5}, InverseFourierTransform[FourierTransform[Total[(NestList[Cos, x, m] t^Range[0, m])/Range[0, m]!], t, w] Sqrt[-I w], w, t]] already gives ComplexInfinity.
Dec
23
comment How to make a graph of this function?
Just to make sure. Do you really want Nest[Cos, x, m] rather than Derivative[m][Cos][x]?
Dec
23
comment Divide all but the maximal element in a list by 10?
Hello, welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
Dec
23
comment InverseFourierTransform of simple function takes forever
@Hugh Somewhat inspired by your observation, I found a work-around. See my answer below :D
Dec
22
comment The change of precision doesn't work in ParallelDo. Is it a bug in Parallel?
BTW, please don't use "bugs" tag until the community has confirmed it.
Dec
22
comment The change of precision doesn't work in ParallelDo. Is it a bug in Parallel?
Hello, welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
Dec
22
comment InverseFourierTransform of simple function takes forever
@Hugh Just tried your code. The answer seems to be incorrect. (The correct one is given by bbgodfrey in the answer below.)
Dec
22
comment Compiling If statement
And though not well documented, the multiple issues have been well discussed in this site actually. I really suggest you to have a look at those posts tagged with "compile" first. You may also interested in this page, though it's based on v4, the 6 principles mentioned therein are still valid today. (The only difference might be that the number of compiliable functions has increased a little. Also see here for an up-to-date list.)
Dec
22
comment Compile a Module wich has a loop with undetermined bound
@yashar As mentioned by Michael E2 above, that's mainly because Tr isn't compiled. Something like test[int_] := Module[{m}, m = Table[i, {i, 1, 2 int}]; Do[m[[i]] = i*i, {i, 1, int}]; Return[m]] and test3[10^4]; // AbsoluteTiming is enough to show the difference.
Dec
18
comment Why is C-compiled (but not WVM-compiled) code so slow in Manipulate?
This seems not to work, at least on v8.0.4, vista 32bit.
Dec
18
comment Why is C-compiled (but not WVM-compiled) code so slow in Manipulate?
Quite interesting. The reason is exactly your special setting $CompilationTarget = "C", and the problem won't appear if CompilationTarget -> "C" is used! Don't why though……BTW, the solution from @Szabolcs also works.
Dec
17
comment Derivative of Vectoral NDSolve Interpolated Function / Rule Solutions,/., and Vector NDSolve
Well, I'm afraid this doesn't solve OP's problem. The true reason is that the mm outputs a list while it is one InterpolatingFunction, so list manipulations like First, Most etc. won't work anymore!
Dec
17
comment How to use slots and patterns to reduce repetitive calculation?
@JerryGuern According to my test, Expand will speed up the code only if the option "SymbolicProcessing" -> False isn't added.
Dec
15
comment Fast export of large numerical data
For the first question, you need revived = Import["matrix.h5", "Data"].
Dec
15
comment Monte Carlo Volume Calculation and Speed Up
If you add RuntimeAttributes -> Listable inside Compile, then you can use f[RandomReal[{0, 1}, n], RandomReal[{10, 13}, n]] instead of f@@@Transpose@…… and get a 7X speed up. (Parallelization -> True may also help a little. )
Dec
15
comment Water Hammer - Numerically solving system of PDEs
@Ivan To be honest, I'm not able to… the only thing I know is that "Pseudospectral" seems to be quite effective on certain kind of PDEs (specifically speaking, PDEs related to fluid dynamics and quantum mechanics, according to the examples appearing in this site so far), but I never studied why. Maybe you can consider asking it in scicomp.stackexchange.com ?
Dec
15
comment How to use slots and patterns to reduce repetitive calculation?
Oh, sorry, I should have read more carefully. See my answer.