Questions tagged [coding-style]
Questions on how to write code in a better or different style, using Mathematica's capabilities for coding in multiple styles.
157 questions
5
votes
1
answer
447
views
How to understand or define the programming paradigm of Mathematica? [closed]
Recently, I have been struggling with the task of writing a Mathematica programming tutorial for my graduate students. My goal is to teach my students how to use Mathematica for complex scientific ...
-1
votes
2
answers
119
views
Code in one line without using compound expression [closed]
data = Range[10]^2
Table[Style[data[[n]], FontSize->data[[n]]], {n, Length[data]}]
I understand that the above can also be coded in one line. But I could do so ...
2
votes
1
answer
257
views
NDSolve: how to solve "ndnum error"
I have a problem of finding the shape of a current. please see the details here NDSolve does not accept the boundary condition
I wrote a code but it gives the "ndnum" error. I tested the ...
0
votes
0
answers
107
views
NDSolve does not accept the boundary condition
I am new at Mathematica and trying to solve a nonlinear PDE with the help of NDSolve.
H, the height of the current is a function of x and t. Based on the context I know the current has a parabolic ...
1
vote
1
answer
156
views
Customising the editor: (real) monospace font and dark theme (and more)
I don't know how to make the code editor in Mathematica present the code in a real 'monospace' font, with a dark, customisable theme (syntax highlighting and so on). This is something that keeps me ...
0
votes
1
answer
156
views
How to make code for boundary value problem?
I am trying to make graphs given by using this code but I failed. Please correct this code.
...
1
vote
3
answers
148
views
Labeling point coordinates in path graph using VertexLabels
Question: How do we label point coordinates in Pathgraph using VertexLabels.
Suppose we have a list of points ...
1
vote
3
answers
396
views
Creating an interactive plot that zooms into the function
Suppose we want an interactive plot for the code:
...
7
votes
4
answers
942
views
How to elegantly implement this one useful object-oriented feature in Mathematica?
I wrote some Mathematica code that defines a function I want to use repeatedly (f) inside another function (finit) that pre-...
0
votes
0
answers
144
views
Codewars and Mathematica [duplicate]
I looked up the Wolfram Language on Codewars as the site is great to improve coding.
WL is not among the listed languages (I checked the beta versions as well). I assume this is because the language ...
9
votes
1
answer
206
views
Best practices or hidden drawbacks to define multiple-argument functions
I was wondering if there were any important differences or stylistic considerations for deciding between different ways to define functions of multiple variables, e.g.
...
2
votes
2
answers
412
views
Would it be poor advice to assign roman numerals as top variables?
For example like so.
x = 10;
xi = 11;
xv = 15;
Is there an automated way to spit these numbers out maybe 1-1000.
8
votes
6
answers
909
views
Smart way to remove rules from lists, leaving just values, specifically from FindMinimum output
I would like to know if there is a direct way to remove the rules from a list of rules.
I know that, simply, this can be done with:
...
8
votes
4
answers
590
views
How can I efficiently define functions with different names but doing the same stuff?
Recently I have met with with this interesting question:How can I efficiently define functions with different names but doing the same stuff? Somebody may want to ask me why I want to do things like ...
1
vote
2
answers
169
views
How to organise definitions that contain named parameters?
I have lots of definitions of (usually numeric) quantities that depend on parameters; they're mostly matrices (in the actual code, there are many more definitions):
...