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 the correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and _ characters, which are keyboard shortcuts for the Wolfram Language named functions Apply, Map, Slot, Function, and Blank.
0
votes
2
answers
81
views
Difference between % and the variable it is representing?
I have this code. The problem I have is with the % in the Manipulate (after Grid). If I replace % with data, then the values are not evaluated anymore? But how come? Isn't the % refering to data?
Cle …
2
votes
2
answers
130
views
Romberg integration with NestList or FoldList?
I am using a NestList like this:
NestList[((4 #2 - #1)/3) & @@@ Partition[#, 2, 1] &, T, Length[T] - 1]
But the function that is applied on the Partition is not complete, it should include informat …
4
votes
4
answers
851
views
How can I write this using fewer variables?
Amateur here! I made a short piece of code that creates a line that turns in the positive direction (up or to the right) if the sum of the digits of the outcome of a function (x^2 in this case) is eve …
1
vote
0
answers
64
views
Simple list manipulation [closed]
I have two lists: {1,2,3} and {a,b,c} and I want this result: {{1,a},{2,b},{3,c}}. What is the right command? How does one call such an operation?
0
votes
2
answers
87
views
SameQ shorthand [closed]
I thought that === is shorthand for SameQ? Then why do these two expressions yield True for one and False for the other?
SameQ[((k^2 (k + 1)^2)/4 + (k + 1)^3) == (((k + 1)^2 (k + 2)^2)/4)]
((k^2 (k + …
4
votes
1
answer
844
views
Meaning of (a : _ : 1)
This is an example from Leonid Shifrin's tutorial:
testexpr = Expand[(1 + x)^10]
newexpr =
Replace[testexpr, {(a : _ : 1)*x^(y_?EvenQ) :> a*f[x^y],
a_ /; FreeQ[a, x] :> f[a]}, 1]
Basic questi …
7
votes
2
answers
3k
views
Difference between != and =!=
I (think I) understand the difference between == (semantic) and === (syntactic). So when comparing != and =!= I was expecting a similar difference. So can anyone explain why the third line in this cod …
1
vote
0
answers
73
views
Why is my array not displayed in TableForm? [duplicate]
Why is the array produced by the following not displayed in TableForm?
NumberForm[Table[Sum[(-1)^n 1/n!, {n, 0, i}], {i, 10}] // N, 12] // TableForm
{0., 0.5, 0.333333333333, 0.375, 0.366666666 …
0
votes
0
answers
145
views
Indicate level with Replace [duplicate]
Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 1]
Level 1 of Replace works here as expected with output {List,List}
Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 2]
But with le …
25
votes
5
answers
4k
views
How do I increase the readability of this code?
Below is some code I am working on; being a beginner. How can I increase the readability of the part behind Manipulate?
I can't read my own code anymore, because it is simply too long and unordered. …
2
votes
1
answer
122
views
Rule vs RuleDelayed in the context of StringReverse [duplicate]
{"test", 3} /. s_String :> StringReverse[s]
{"test", 3} /. s_String -> StringReverse[s]
The second line gives the error:
StringReverse: String expected at position 1 in StringReverse[s]
Questi …