Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.
1
vote
1answer
66 views
How does one specify Neumann conditions for NDSolve?
I have a series of functions defined in my notebook, and then want to use this to solve a diffusion-reaction type equation. At the moment, something like this works:
...
5
votes
0answers
86 views
Design considerations behind `O` (a.k.a. BigOh, a.k.a. Landau Order)
This works without any warnings: O[Log[x]].
This raises a warning: O[x^2].
I have a few questions around this:
Why is it a ...
0
votes
1answer
96 views
0
votes
0answers
75 views
Why doesn't Dot work on typeset vectors?
When I try to do scalar product of vectors I get the following message:
Is there a specific way to input the vectors? I'm doing it as the Basic Math Assistant palette suggests, typing {, Ctrl+,, } ...
0
votes
2answers
57 views
Getting value of clock [duplicate]
I have the following code:
a = Dynamic[Floor[Clock[2]]] (*So this basically alternates between 0 and 1*)
If[a==1, Print["true"]]
But this doesn't work, it ...
4
votes
2answers
266 views
List reversion inspired by Python
In python, if you wish to reverse a list, here is the trick:
range(10)[::-1] => [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
Note: ...
0
votes
0answers
45 views
How to programmatically comment out multiple source files?
How to programmatically comment out the entire content of multiple .m source files assuming they start with correct Mathematica syntax? I need it to be robust so ...
4
votes
0answers
53 views
Is there a way to check whether two notebooks share the same variables?
When I code in Mathematica, I often re-use code from old notebooks which fulfilled a specific purpose; for example, one testing for soft matches in strings, or one that identifies outliers on a graph ...
2
votes
2answers
99 views
How to make Mathematica returns the exact expression I typed
I'm using Mathematica to compare some constants. Before playing around with those constants, I would like to check that I didn't make any mistake in typing them. So my question is the following: "What ...
1
vote
1answer
67 views
Syntax for integrating over limits specified by a Table
I wish to use NIntegrate to compute multidimensional integrals. However, I don't want to manually input the limits for the dimensions. I want to store the ...
2
votes
0answers
60 views
Transfer of symbols between contexts
As many others (I guess) I'm struggling with the handling of contexts within Mathematica. I'm working on a new package definition with the usual syntaxt specified by the Mathematica documentation:
...
0
votes
1answer
80 views
0
votes
1answer
54 views
Why does Eigenvalues[matrix I defined] not work? [duplicate]
This is the code I have in my mathematica notebook. I want to find the eigenvalues of the matrix I created called Hmatrix as defined below. However when I type Eigenvalues[Hmatrix] I get the Hmatrix ...
1
vote
1answer
105 views
Why does the first derivative of a piecewise continuous function turns out with discontinuities?
I have this piecewise continuous function which is also continuously differentiable over time :
...
4
votes
3answers
125 views
Keep function range as a variable
Plot[2*x^2 - x + 2, {x, -1, 1}] plots a function of x from -1 to 1. As far as I can see, I cannot "save" this range in a variable:
...