Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions on writing non-trivial programs in Mathematica. Do not use this tag for questions on plotting/graphics or for questions on doing mathematics with Mathematica, where the focus is more on the math than the program.
3
votes
Splitting up delimited data in lists
I know, late to the party, but after my answer for the Brainf*** parser, I have been thinking in terms of state machines. In this case, each instance of the pattern "section " ~~ __ signals a change i …
9
votes
Accepted
Can a Table iterator "leak" into a Module?
I know the reason for the second giving you the error: i has been set to 1. Under normal operations, this will not happen as Table has the Attribute HoldAll, so even if i has a value, Table should be …
4
votes
Developing domain specific languages and computational knowledge engines using Mathematica
This is not a direct answer to you question, but you may be reinventing the wheel. Have you considered incorporating the Wolfram-Alpha engine directly into your system? They have a number of products …
6
votes
Accepted
How to force Return[] to return from an arbitrary point (like in C++)?
As pointed out in the comments, Return only exits from the inner most construct. So, even though foo[4] hits the True clause in the first If statement, that only exits Do. Instead of using Return, use …
8
votes
Accepted
How do I 'Join' two Structured Datasets?
Provided that your Datasets are effectively just a list of Associations then you should use JoinAcross, as follows:
dsCompetitions = Dataset@{<|"id" -> 1, "name" -> "bob", "eventTypeId" -> 4|>,
< …
17
votes
My program to model exterior ballistics doesn't doesn't produce the plot I expect
I am answering because I was curious as to what exactly was the problem, and from my investigation, it is clear you need to learn basic debugging techniques. So, I will walk you through how I did it. …
4
votes
Programming Multipolar Expansions in Spherical Tensors
To transform back from spherical tensors to Cartesian tensors, the unitary transform is
$$\mathbf{U}_l = \frac{1}{\sqrt{2}}\left\{ \begin{align}
Y^{-m}_l + (-1)^m Y^m_l &,\ m >0\\
\sqrt{2} Y^0_l &,\ …
28
votes
Accepted
How do I generate the upper triangular indices from a list?
The solution is straightforward: Subsets, specifically
Subsets[{1,2,3}, {2}]
gives
{{1, 2}, {1, 3}, {2, 3}}
To generate the lower indices, just Reverse them
Reverse /@ Subsets[{1,2,3}, {2}]
…
13
votes
Accepted
Weird behavior of conditions when using OptionsPattern and OptionValue
Note: This is an incomplete analysis and leads to the wrong conclusion about the cause of the difficulty. Mr.W's answer below correctly identifies the culprit as Condition.
The problem you are faci …
1
vote
Is Package development (via InitializationCells) compatible with creating new Notations (via...
Ignoring Leonid's arguments on whether OO is a good idea, or not, I would like to suggest something a bit different. Instead of using MakeExpression, set a DownValue on CenterDot directly:
a_ \[Cente …
12
votes
Any built-in function to generate successive sublists from a list?
I am not sure this wins any speed contests, but it is a purely functional solution:
FoldList[#1~Join~{#2} &, {First@#}, Rest@#]& @ {a, b, c, d, e}
(* {{a}, {a, b}, {a, b, c}, {a, b, c, d}, {a, b, c, …
26
votes
How to make Mathematica variables declarative instead of just-in-time?
You are looking for $NewSymbol which is run every time a new symbol is created. For example, let say you only want x, y, and z as symbols, then declare them initially
In[63]:= {x, y, z}
(*Out[1]= {x, …
56
votes
2
answers
3k
views
How do you set attributes on SubValues?
SubValues, as discussed in a previous question, are declared as follows
f[x_][y_] := {ToString[Unevaluated[x]], ToString[Unevaluated[y]]}
But, attempting to use SetAttributes on f only affects the …