Nasser
Reputation
32,259
99/100 score
 May 20 comment Is there a way to separate variables between multiple notebooks? @ShutaoTang I do not know. But if you ask at Mathworks Answers forum or at comp.soft-sys.matlab someone there should know. May 18 comment Discrepancy in the series expansion of $\log(z/(z-1))$ in Mathematica 5 Yes, I think M should have the sign function there. I verified with Maple, Maple gives this: series(log(z/(z - 1)), z=0); ln(z)+I*csgn(I*z)*Pi+z+(1/2)*z^2+(1/3)*z^3+(1/4)*z^4+(1/5)*z^5+.... notice the I*csgn(I*z) there, which is explained more here May 18 comment ParametricNDSolve without initial condition? But help shows how to use the result? The examples all show how to use it. Is the question about how to use the result or something else? May 18 comment Choosing FEM element type and mesh refinement fyi, I copied the code from the notebook. To do this in the future, convert the cells to InputForm and then copy as text and paste here as code. May 15 comment Internal coupling of Fortran and Mathematica codes I have no experience with FORTRAN programming Well, you can ask about how to write the Fortran in the Fortran forum. (btw, it is Fortran now, not FORTRAN, the name was changed 25 years ago to indicate modern Fortran :). As I mentioned above, all what you have to do is compile it to an exe (use gfortran, or ifort or any Fortran compiler). Then run it from Mathematica using the RunProcess command. All of this is really straight forward. All what you have to do is write the data from Mathematica (there are number of ways to export data from M) to a text file and read the data from Fortran. May 14 comment $\mathbf L\mathbf D\mathbf L^\top$ Cholesky decomposition Here is the LAPACK Fortran implemenation using what is called Bunch-Kaufman diagonal pivoting method for LDL^T factorization for real symmetric (not necessarily positive definite) matrix. I think Mathematica should have an LDL special decomposition. Matlab has one here. May 14 comment Internal coupling of Fortran and Mathematica codes If the Fortran program is a stand alone, you can generate the output from your Mathematica script and export the output to a text file, then at the end of the script use the RunProcess command to invoke the Fortran executable, but change the Fortran program to read its input from the text file generated by the Mathematica script. Make sure they reside in the same directory to make it easier to locate the file used to communicate between them. direct Fortran function calling would need using mathlink and is more complicated. Apr 13 comment Drawing nodal lines of wave equation @Pickett it is not an answer, that is why it is a wiki. Apr 13 comment string and subscript in label fyi, I am not sure that using tab "\t" is recommend for spacing, as it might generate different space amount depending on the platform or some other system configuration. I think Spacer[n] is supposed to generate the exact space on all systems. (mac, linux, windows) Apr 13 comment Writing a circular matrix +1 just for the coloring part :) Apr 13 comment How can I perform this integration in Mathematica? @Dimitrios I updated answer Apr 13 comment Time series package in mathematica 9 If you mean this time series, then it is third part app, that you need to buy. So it is separate. I did not know about a time series package. Do you have a link? Apr 12 comment Problems solving/plotting a differential equation It's just the good ol' mass-spring-damper system. Well, it is a special spring you have and not the good old one. You have non-linear spring, so this makes it hard to find closed form solution. Are you saying Mathematica solved this analytically before? Apr 12 comment How to map over inner keys of nested Associations? Your code has syntax errors Apr 12 comment How to switch from array to string? Nice. Btw, this does not give the same form the OP wanted due the "," being there between the numbers. May be just need small modification? Apr 12 comment Function in Mathematica 10.1, but not in CDF Player 10.0.2 But I have been using a function of that name for many years That is one of the reason why one should not define user level functions that starts with UpperCase ! Apr 12 comment Create an array with certain conditions and use it to fill a matrix Are we talking about this part: (2*math.pi*k*sigma/L)*(2*math.pi*k*sigma/L) ? Is this not the same as (2*math.pi*k*sigma/L)^2? This is what I mean. As for the table command index, yes, I see you have it going to int(n/2+1) and I used n so you just need to change the index. to one that corresponds to rounding n/2 and adding 1 to it. See help on Round, Ceiling, Floor etc.. Apr 12 comment Create an array with certain conditions and use it to fill a matrix You should not be translating code as is from Python to M. You should try to translate the algorithm itself if possible. Many operations in M can be done with one or 2 lines, instead of using For and so on. M is functional programming language, while Python is procedural build in an OO framework (like Java is). Apr 12 comment Animator not always working under 10.0/1 I think there was such an error, I saw it on one or 2 of my demos. But now it is gone, at least I tried your code in 10.1 and it works with no problem on my windows 7. But the error message you show, I've seen before and even reported it. I had no idea why it came from. Code used to work ok before 10, and then on some demos I saw the above message. Apr 12 comment Create an array with certain conditions and use it to fill a matrix You mean you want to translate power_spectrum_k = np.zeros(n, float) to Mathematica? I would use Table command, as in Table[0,{n}], for the whole thing, may be n=10; Table[Exp[-(2 Pi k w/L0)^2], {n}] ps. why not use ^2 instead of writing the same expression 2 times?