4,904 reputation
2954
bio website
location China
age
visits member for 2 years, 4 months
seen 13 hours ago

Feel free to correct the grammar mistakes in my posts.


Oct
17
comment Numerical solution to two non-linear coupled differential equations
OK, after wasting some time searching in WolframAlpha, I'm pretty sure your equations are simply wrong. What you're modeling is something traveling among Jupiter, earth and sun, 6.67384*10^-11 is the Universal Gravitational Constant, 1.89813*10^27, 5.9722*10^24, 1.98844*10^30 the mass of them, 5.20336, 1 the semimajor axis, 5.19273, 0.99986 the semiminor, Unit: au = 1.496 10^11 m, which is forgotten by you. (I failed to figure out how the 4200 comes from. ) If you had added all these information your post, others will notice the problem much easier.
Oct
16
comment How to Use Mathematica as a C/C++ compiler
Do you mean you want to use Mathematica as a C compiler or an IDE? If you're unclear about this concepts, have a look at this. BTW, Mathematica can't be used as a C compiler, it can be used as an IDE for C, but it won't be convenient. If what you want is just to save disk spaces, you can consider lightweight text editor like notepad++ etc.
Oct
16
comment Using NDSolve to solve a system of coupled PDEs
@RobertMoerman You mean the current plot doesn't match the physical prediction and the plot should be two traveling waves from the origin? If so, My tools at hand can't solve this problem. I just noticed that, strictly speaking, the i.c. and b.c. aren't consistent, can this be a reason for the undesired behavior? BTW, you don't need to accept an answer so fast, it'll be better to wait for 24 hours or more so others may give better answers. And, I just checked the wiki of Gross-Neveu model but got nothing valid, maybe you can talk about this a little more in your question.
Oct
16
comment Numerical solution to two non-linear coupled differential equations
You can add "@xzczd" in your post so I'll get a reminder. You don't need to substitute those values before posting your code here, just see what that OP did in the Edit of his question, that'll make your post look better.
Oct
16
comment Numerical solution to two non-linear coupled differential equations
What causes this error is the incorrect square bracket usage in the definition of xdp and ydp : Square rackets are only used to enclose the arguments of functions, correcting this only cause new problem though. But what I really want to say is, Your equation is about planetary orbit, right? If you give those parameters proper names and add some background information of your problem, your post will be much cleaner and draw more attention. (This is a relatively good example. )
Oct
16
comment Using NDSolve to solve a system of coupled PDEs
Hello, welcome to Mathematica.SE! Then please show us the complete code sample, without the definition of V, L, etc. we can't reproduce your problem. BTW, InterpolatingFunction can't be transferred with a simple copy&paste even inside Mathematica. And you may want to have a look at this tool for your code formatting.
Oct
15
comment Smooth Peter de Jong attractor
I'd like to mention that, the "CompileOptions" set in $CCompiler will significantly influence the speed of the code in this case. For GCC, Mathematica uses "CompileOptions"->"-O2" by default, but when I changed it to "CompileOptions"->"-Ofast", I got a 2X speed-up! BTW, with my dual core old machine, your C++ code is even a little slower than the Mathematica code with -Ofast.
Oct
14
comment Has this implementation of FDM touched the speed limit of Mathematica?
@RunnyKine More likely to be a defect of TDM-GCC, I think. Today I learned the basic syntax of C++ for several hours and rewrited the piece of code with it in order to find out if 12s touches the limit of my hardware. The result is, with optimization flag -O3 or -Ofast, the C++ version only costs about 8s in my computer: that's a 1.5X speedup just as you got. So the compiler failed to dig out all the potential of the code.
Oct
11
comment Has this implementation of FDM touched the speed limit of Mathematica?
@AlexeyBobrick No, it won't. ParallelDo isn't in the list, the result of CompilePrint also shows it's indeed not compiled.
Oct
11
comment Has this implementation of FDM touched the speed limit of Mathematica?
@RunnyKine With TDM-GCC 4.8.1, Vista 32bit, ez[[j]] = Compile`GetElement[ez, j]…… even makes the code a bit slower. The Compile`GetElement trick is really amazing, now the code only takes about 13s for steps = 10^7 in my computer, as fast as the Julia version (with the @inbounds macro added). And if I set "CompileOptions"->"-Ofast" when loading the compiler, the timing will reduce to about 12.3s!
Oct
10
comment C compiler options passed by Mathematica
Can it be an issue of compiler installation? Maybe quotation isn't used in some places when the compiler is installed, and it doesn't cause any problem when called from command line but does when called from Mathematica?
Oct
10
comment Bad performance of LengthWhile?
Response from Wolfram company: ……Thank you for your message and the link of the post. I have filed a report on this performance issue of LengthWhile and thank you for bringing it to our attention.……
Oct
10
comment C compiler options passed by Mathematica
"C:\Program is not recognized……" seems that the white space in the path isn't recognized correctly. I'm not sure about the reason. Did you forget to add double quotation marks somewhere?
Oct
10
comment Has this implementation of FDM touched the speed limit of Mathematica?
@AlexeyBobrick I'm sorry but this won't work, as the document said, Parallelization -> True only works together with RuntimeAttributes -> {Listable}, it just makes a Listable compiled function paralleled, while it's not the case of this question.
Oct
9
comment Has this implementation of FDM touched the speed limit of Mathematica?
@AlexeyBobrick Just scaned this document and tried several flags in "CompileOptions" (-O3, -Ofast, etc.) but didn't get a speed-up… Could you give an example? (BTW -Ofast does help in speeding up this code :D)
Oct
9
comment C compiler options passed by Mathematica
@RolfMertig I guess the \\bin isn't the issue. Just found a 64-bit machine and tested OP's settings, I only changed the "CompilerInstall‌​ation" to mine i.e. "C:\\TDM-GCC-64\\bin", and it works well. BTW, why you think your test code failed to compile? What's the output of your greeter?
Oct
9
comment C compiler options passed by Mathematica
I have TDM-GCC installed in my computer. What's the output if you run CCompilers[Full]?
Oct
9
comment Has this implementation of FDM touched the speed limit of Mathematica?
Just a side note, it's not necessary to make numbers inside Sin explicitly real and use "InlineExternalDefinitions" -> True, and in some computer (for example mine) one may need to use something like And @@ PossibleZeroQ[result2 - result // Chop] to test the result. Then, this answer is really… surprising, it seems to be the first example in this site showing devectorizing can speed up code inside Compile.
Oct
9
comment C compiler options passed by Mathematica
Does $CCompiler = {"Compiler" -> CCompilerDriver`MinGWCompiler`MinGWCompiler, "CompilerInstallation" -> "C:\\Program Files\\mingw-builds\\x64-4.8.1-posix-seh-rev5\\mingw64\\bin", "CompilerName" -> Automatic}; help?
Oct
9
comment Has this implementation of FDM touched the speed limit of Mathematica?
@AlexeyBobrick AFAIK, compilation is hard to combine with these techniques, which are much slower than compilation when used separately.