Questions tagged [function-construction]
For questions on writing functions (pure or using Set/SetDelayed) for any purpose, including the features that may be incorporated in those functions, such as options, patterns and conditions.
2,539 questions
1
vote
1
answer
104
views
How can we define a multiplet field (for example, the Higgs doublet) as a matrix in Mathematica?
I want to define a multiplet field with two components (two modes) and write an action for it in Mathematica
1
vote
1
answer
52
views
Issues with Plot/Delayed Assignment/Replacement [duplicate]
I would like to plot the $|x\rangle$-representation wave functions of the first few energy eigenstates of a harmonic oscillator. The formula is $$ \varphi_n(x)=\left[\frac{1}{2^n n!}\left(\frac{\hbar}{...
0
votes
0
answers
42
views
Defining multilinear function series expansion
I want to define an abstract multilinear function mlfunc in arbitrary arguments with the standard algebraic and analytic properties.
Implementing algebraic ...
1
vote
1
answer
83
views
How to check if two edges have consistent orientation in all simple cycles of a graph?
How can I check whether two edges (tagged "c" and "d") have consistent orientation (either always the same ...
3
votes
2
answers
283
views
How to find x ranges where a function is one-to-one and its output is in a given range?
I have a list of functions like this:
...
4
votes
1
answer
136
views
Is there any efficient way to find cycle matroid of a graph?
Is there any efficient way to find cycle matroid of a graph?
A cycle matroid is basically all sets of edges in a graph that does not form a cycle.
The code below works pretty well for small graphs, ...
12
votes
4
answers
576
views
Recursive anonymous functions with |-> notation
We can define anonymous functions like this:
#^2+#+1 &
or like this
x |-> x^2+x+1
When we want to define a recursive ...
2
votes
5
answers
286
views
How to determine if a user-defined function, passed as an option, has a specific number of arguments
Let's say that I have a function f which is passed a user-defined function g which is originally passed as an option to some ...
0
votes
2
answers
114
views
How to extract the correct branch of a ConditionalExpression that a given range belongs to?
This function has two separate branches (not connected together):
func = ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1];
Given a range of ...
3
votes
1
answer
87
views
How to generate all graphs that decompose into a given list of subgraphs at articulation points?
Given a list of directed edge-tagged graphs gList like this:
...
5
votes
4
answers
345
views
How to find all possible splits of a list into sublists sharing exactly one element?
Given a list, I want to find all possible ways to split it into sublists such that:
Each sublist has length greater than 1.
Any two consecutive sublists share exactly one common element.
All elements ...
0
votes
0
answers
74
views
The cases of Piecewise function are not recognized when calculated in Table
Before describing the problem, a short background on how it pops up.
I am solving a PDE problem on the [0,1]x[0,1] domain. To this end, I want to find the decomposition of some derivatives of the ...
4
votes
2
answers
186
views
How can I reconstruct a graph from a list of fundamental cycles?
Assume that I have a list of simple cycle EdgeTaggedGraph objects called fundamentalCycles. I would like to construct a graph <...
7
votes
5
answers
600
views
Problem with a function calling another function
This is my code:
...
4
votes
3
answers
184
views
How to apply a list of binary operators to a list of arguments respecting standard operator precedence?
I have a list of binary functions such as {Plus, Times, Subtract} and a list of symbols like {a, b, c, d}. I want to construct ...