# Search results

1. ### MATLAB Can one repeat a matlab script from the beginning?

The m files work as functions, so all you need to do is to call that function. I.e., if you called the file game.m, just replace the fprintf('I do not know how to restart, sorry!\n\n') by game EDIT: That will restart the script right from the beginning. If you want it to restart somewhere else...
2. ### Mathematica Mathematica: f[a,b,c] = a*g[b,c], force evaluate

Glad you solved it. I find optimizing Mathematica code tricky, as there generally is several ways of doing the same thing, and it's often not obvious why one should be quicker than the other. Anyway, there's this guide 10 tips for writing fast Mathematica code. You might find it helpful too.
3. ### Mathematica Mathematica: f[a,b,c] = a*g[b,c], force evaluate

You want to tell Mathematica that your functions are to be treated as functions, g[b_, c_] := b/c f[a_, b_, c_] := a*g[b, c] Note the underscores after the function variables. Also see the tutorial.
4. ### Mathematica Mathematica : Easy? Function that returns and increases counter.

Aha. Yeah, I wondered if the product solution was too simple to suggest but then I remembered that I once spent an hour perfecting a recursive algorithm in java to format a text string before someone reminded me that I could just have used a string replace function. Nice solution, by the way.
5. ### Mathematica Mathematica : Easy? Function that returns and increases counter.

Would something like Product[v[a[j]].d[a[j]], {j, 1, 3}] work for you?
6. ### MATLAB Vector concatenation without using a for loop (MATLAB)

If they are stored in a matrix (as then tend to be when read from a file with e.g. dlmread), you can reshape the matrix into a vector with the cleverly named command 'reshape'.
7. ### Mathematica Mathematica: Solve error

The Plot3D command should be useful.
8. ### Mathematica Mathematica: Solve error

Since you have an undetermined parameter, Mathematica tries to find an analytic solution, which I don't think will work in this case. If you know the value of r, then a numerical solution is possible (assuming x is a real number).
9. ### LaTeX Latex mathbb with number does not show correctly

Yeah, the mathbb command as defined in the amsfonts package (probably amssymb as well) only works with uppercase letters. It's using the wrong font, basically. You could solve this by using the bbm package and then using the mathbbm command (it is defined for both upper and lower case...
10. ### LaTeX Brace in latex question

I meant that if you want to post LaTeX code giving you trouble and display the actual code instead of its result, you can write it like code you don't want the forum to process goes here[\code] but with the backslash replaced by a slash. Sorry about that. Yeah, LaTeX distinguishes between...
11. ### LaTeX Brace in latex question

The array environment should do the trick. \left. \begin{array}{c} A\\ B\end{array}\right\} $\left. \begin{array}{c} A\\ B\end{array}\right\}$ or something like that. The "\left." means that there is an invisible thing to the left of whatever you try to enclose with the brackets. The...
12. ### Simplifying many body operator expressions

Hello all, Is there any really good software, package or otherwise, that is helpful for simplifying long operator expressions, particularly with (anti-commuting) electron operators? For example, I'd like to be able to transform Hamiltonians, project onto subspaces with specific occupation...
13. ### Mathematica Solving trig equation Mathematica repeats results

Mathematica considers it a double root. Compare with Solve[x^2 == 0, x].