4,614 reputation
2949
bio website
location China
age
visits member for 2 years, 3 months
seen 2 days ago

Feel free to correct the grammar mistakes in my posts.


Oct
17
answered Can I generate a “piecewise” list from a list in a fast and elegant way?
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
17
awarded  Benefactor
Oct
17
accepted Has this implementation of FDM touched the speed limit of Mathematica?
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
revised Using NDSolve to solve a system of coupled PDEs
deleted 2 characters in body
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
revised Using NDSolve to solve a system of coupled PDEs
edited tags
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
answered Using NDSolve to solve a system of coupled PDEs
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
revised Coupled Nonlinear Differential Equations Problem
improve the format
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
15
awarded  Electorate
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
13
revised Has this implementation of FDM touched the speed limit of Mathematica?
added 2 characters in body
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
revised Has this implementation of FDM touched the speed limit of Mathematica?
added 2 characters in body
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!