3,983 reputation
1841
bio website
location China
age
visits member for 2 years, 2 months
seen yesterday

Feel free to correct the grammar mistakes in my posts.


Apr
17
comment Compile with array operations
@brama Er……for example, you've used a lot of AppendTo, I'm not sure if it's because you're following the rule of thumb "the more my code inside Compile looks like C code I'd write otherwise, the more I benefit from it", but if it's what your original code looks like, you'd better set some effort on avoiding it. BTW, AppendTo is even disliked inside Compile, see this post for details. A complete discussion for this issue might need a whole book 囧, have you already read Leonid's excellent book?
Apr
17
comment Compile with array operations
@brama See my edit. (Links for CopyTensor are added above Update.)
Apr
16
comment Solving System of Nonlinear with Three Differential Equations
@bobthechemist OK, let me elaborate it into an answer.
Apr
16
comment Dsolve is not solving equation ( 3 system with 2.order diferantial equations)
I think you're looking for @b.gatessucks right? :D
Apr
16
comment Dsolve is not solving equation ( 3 system with 2.order diferantial equations)
Well, so v9 can solve this set of equations? With v8.0.4, I only got the original input returned…
Apr
16
comment Solving System of Nonlinear with Three Differential Equations
Then you must have once mixed up = and ==. You need Clear[Derivative]. Values stored in Derivative can't be cleared by Clear["Global`*"] because it actually means clearing all the variables under context "Global`" while Context[Derivative] gives "System`".
Apr
16
comment Derive a PDE from other PDEs
You can refer to this post: mathematica.stackexchange.com/a/6428/1871
Apr
15
comment Compile with array operations
Precisely speaking, I suggest you to at least avoid function definition based on pattern-matching. (see this post for details. )
Apr
15
comment Compile with array operations
Several observations: 1. qsum = MapThread[Plus, #] &@Rq can be changed to qsum=Total@Rq, 2. qsum = N[Plus @@ Fq] can be embedded into the definition of qf, 3. kr = ReplacePart[#, (\[Alpha] delta/Vf), 1] & /@ kr can be changed to kr[[All, 1]] = \[Alpha] delta/Vf. There still exists warnings but I'd like to stop here, as I mentioned above, I don't think compiling these code makes much sense.
Apr
15
comment Compile with array operations
Can you make some effort on reproducing your problem in a minimal code sample? BTW, I doubt even if you fix your code, it'll be slow since it has made so many external calls in Compile.
Apr
14
comment Plotting Fourier spectrum versus frequency of a signal
Your suggestion for changing sample size to 2048 and using a triangle does work (if I've understood it correct). Maybe you can consider improving your answer when you become more familiar with Mathematica, most people here are not familiar with signal processing after all :D
Apr
11
comment Mathematica does not respect tensor order?
To be more precise, $Assumptions only works on functions with Assumptions option :)
Apr
9
comment Always the same problem with Conjugate
Have you tried ComplexExpand?
Apr
8
comment Plotting Fourier spectrum versus frequency of a signal
If you want to call somebody in the comment, you need to write something like @jenson . BTW, I'm also interested in an explanation for the bad result of FourierDCT. (I roughly know that it's because Sin[x] is a odd function, but don't know how to explain it precisely. )
Apr
8
comment Plotting Fourier spectrum versus frequency of a signal
Er……can you show an example fixing OP's code with the method you suggested here?
Apr
8
comment Need help with C Code Generator
Personally I really feel this limit of Compile unreasonable… BTW, another way to circumvent it is to just use All i.e. matrix[[All, lag - i + 1 ;; columns - i + 1]].
Apr
2
comment Use de Casteljau algorithm to create Bezier Curve in Mathematica
Since I'm also not sure what OP is looking for, I'd like to leave this as a comment :) It's just a simplified version of your decasteljau: de[p_, t_] := Nest[MovingAverage[#, {1 - t, t}] &, p, Length@p - 1]
Apr
1
comment BVP system of nonlinear coupled ODEs
Then you'll have a hard time looking for a proper "StartingInitialConditions"……there're many examples for shooting method in this site, you can have a search.
Mar
27
comment How to find discretezation error of NDSolve
The last part (Spatial Error Estimates) of this tutorial may be helpful?
Mar
26
comment Trying to solve a differential equation with a piecewise initial condition
DSolve can't handle heat conduction equation, consider NDSolve instead if a numerical solution is OK, or you can refer to this post.