Questions tagged [design-patterns]
The design-patterns tag has no summary.
32 questions
5
votes
2
answers
202
views
Obtaining Pairs of Consecutive Elements with Conditional Adjustment
I've encountered a particular problem and was wondering if anyone has any insights on how to approach it more efficiently or elegantly.
To be accurate, given the list:
...
2
votes
1
answer
113
views
Pattern Match "Empty" Term in NonCommutativeMultiply
Not sure if this has been asked before, please point me to the post if it has.
Is there a way to treat terms like (b+c), a**(b+c)...
3
votes
2
answers
313
views
How to define the pattern for the sum of some specified terms?
I want to define a function to check whether the expression is the sum of these terms
a*x+b*y^n+c*Exp[k*z]
(* n can be 1*)
These ...
4
votes
2
answers
316
views
Equivalent of Nothing for patterns
Let's say we want a pattern, that matches, when expression contains some terms but it can optionaly contain some other terms. For example:
...
1
vote
2
answers
132
views
How can I collect the sum of any number of gradients without using ReplaceRepeated[]?
Recently, I have run into the problem where I need to collect the the sum of any number of gradients. I have defined a function grad[] to represent the gradient, ...
3
votes
2
answers
1k
views
How can a verbal reasoning question be solved with Mathematica?
Could a "verbal reasoning" problem like the following be solved with Mathematica? What comes next in the series.
KD XP NG VN QJ TL TM
Correct answer is <...
1
vote
2
answers
244
views
How to construct a pattern that match the multiple partial differential of any multi-variable functions?
For example,I want to match a multiple partial derivative of a function $f^{(1,0,1)}[x,y,z]$ which is the same as$\frac{\partial^2{f}}{\partial{x}\partial{z}}$.The only information given is the list ...
1
vote
2
answers
160
views
Unusual performance of the Cases function [closed]
Recently I was surprised by unusual performance of Cases function. The code
...
12
votes
1
answer
883
views
Art on Mathematica: How can I export 4K resolution png images?
This question is solely based upon $[1]$ and therefore, the reading of $[1]$ could be interesting.
How can I export the image created, by the code in the following, with high definition, beautiful, 4K ...
10
votes
2
answers
993
views
Art on mathematica with filled circles and straight paths: how can I reproduce minimalist suns?
I would like to know: how can I construct minimalist images like this one?
3
votes
1
answer
628
views
Fourier Transform of a symbolic expression
Hello I would like to do the Fourier Transform of
H1'[t - L2[t]/c - L2primo[t]/c]
I know that its transform has to be:
...
0
votes
2
answers
177
views
Is there a way to make $g$ changeable independently of $f$ in this code?
My problem is that in the below code, every time I want to change $g$ I also have to change $f$.
Let's say we have three functions: $f$, $h$, and $g$ ($h$ is not really relevant for the question, but ...
26
votes
4
answers
1k
views
Permanently extending the behaviour of functions (like decorators)
Suppose I have a function, e.g.
f[x_] := x^2
It works like this:
f[5]
(* 25 *)
I would like to permanently modify it so ...
31
votes
3
answers
2k
views
How and why to use monadic programming in Mathematica?
This is a methodological question with two parts:
How to use monadic programming in Mathematica?
Why use monadic programming in Mathematica?
In my opinion the questions are inter-related -- we cannot ...
0
votes
0
answers
240
views
Designing a Manipulate Block
I am trying to create a Manipulate block which contains tabels, graphs and explanations.
In the first row I want to add some tables and explanations, but sometimes the tabels are cut. For doing this I ...