3,746 reputation
1838
bio website
location China
age
visits member for 2 years, 1 month
seen 5 hours ago

Feel free to correct the grammar mistakes in my posts.


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.
Mar
26
comment ExpToTrig transforms solution to 4th order ODE into unwanted form
How about HoldForm@Evaluate@DSolve[a y''''[x] + b*y[x] == 0, y[x], x] /. E^x_ :> (Cos[-I x] + I Sin[-I x]) ?
Mar
25
comment Do you really want to quit the kernel? Yes!
For a better understanding of the second solution, I think it's better to mention this answer :)
Mar
21
comment Shooting method problem
Your code contains simple mistakes. the third argument of NDSolve should be {x, 0, 10}. What's the meaning of Map here? The equation in your code is different from the one at beginning: is it u''[x] - u'[x]/x or u''[x] - u'[x]? Your i.c. is inconsistent with what you choose in your "StartingInitialConditions", is it u[0.001]==0 or u[0.001]==1? The x[t] in your Plot should be u[t]. After correcting all this, your code can easily give a result with no error.
Mar
17
comment How do I solve a PDE with a strange boundary condition?
@george2079 Wow, this time it seems to be true! If so, it'll be the best news for me about v10 :D
Mar
11
comment Shooting method for solving 3rd Oder ODE with RK method
Seems that since you add a - after my name, I didn't receive the message for your comment. I chose the initial condition y''[0] == 1 for I didn't notice it's just assumed and the actually boundary is f'[Infinity] == 1, then, if you want to apply shooting method, you may be interested in this and this post.
Mar
11
comment Are there some other ways to solve a second PDE except DSolve?
You can refer to this answer.
Mar
11
comment Spherical harmonic derivative
The problem seems to be caused by the Gamma function generated by the direct derivation. Observe the result of Derivative[2, 0][SphericalHarmonicY[3, 3, #, #2] &] and try Limit[Derivative[2, 0][SphericalHarmonicY[3, 3, #, #2] &] /. Gamma[a_] -> Gamma[a + c], c -> 0][th, ph] // Simplify. Not sure if it's a bug or just the property of SphericalHarmonicY.
Mar
11
comment Finding differences between Pi with varying number of decimals
Nice update. It's a pity that I can't upvote twice for one post :)