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,507 questions
2
votes
1
answer
128
views
Partial derivative of function with restricted pattern like _List doesn't evaluate
I am having trouble where Mathematica won't evaluate my partial derivatives. I have the function below.
...
3
votes
1
answer
94
views
How can I generate unique partitions of a list into sublists of specific sizes (no overlap)?
I need to partition a list of elements into sublists of specific sizes, ensuring:
The order of elements within each sublist doesn't matter.
There is no overlap between sublists (each element appears ...
4
votes
0
answers
76
views
Why doesn't NMaximize handle this improper function definition?
First, consider this toy example:
expr = (1 - x)/(x^2 + y^2);
Clear[f];
f[x_?NumericQ, y_?NumericQ] := expr
"Wait, this function definition is wrong! "...
1
vote
6
answers
646
views
How to select a random element from a list without repetition until all elements are used?
I have a list, for example:
list = Range[10];
I would like to randomly select one element from this list each time I run the code. However, once an element has ...
3
votes
2
answers
151
views
Random Password Generator question
How to generate password
Re the above post. I am a beginner. I wish to know if I can restrict the random words chosen to a specific length.. for e.g. 6-lettered words. The generated word may look like,...
6
votes
3
answers
288
views
How to Reorder Piecewise Function Compositions
I'm conducting compositions of piecewise functions and Mathematica is producing correct output but I want to reorder the output on the interval [0,1]. For example the code below
...
1
vote
2
answers
151
views
ParametricRegion doesn't recognise BezierFunction as 3D
Problem
I'm trying to make a MeshRegion from a bezier surface defined from an array of control points. Consider
...
5
votes
2
answers
247
views
Complicated nested function construction with two lists of arguments
Given arguments arg1 and arg2 and function f I want the output to be ...
2
votes
2
answers
94
views
How to automatically generate implicit regions from conditional expressions?
I need help writing a function that can automatically convert the following conditional expressions into implicit regions in Mathematica.
Given a list of conditional expressions:
...
0
votes
0
answers
42
views
Needing to efficiently repackage series coefficients into a more complicated formal sum
I have the following simple program:
PolyLogarithm[n_, z_, c_] := Sum[r^(-n)*z^r, {r, 1, c}];
...
3
votes
3
answers
420
views
How to Precompute and Simplify Function Definitions?
I'm defining a function in Mathematica as follows:
f[x_] := x+x-x //FullSimplify;
In this setup, every time f is called, FullSimplify is executed, which can be ...
4
votes
8
answers
400
views
Gather on first list, apply to second list
I have two lists. The first list is L1={z,x,y,x,x,y} and the second list is L2={a,b,c,d,e,f} in which all elements are distinct. ...
0
votes
2
answers
178
views
Formula to generate a specific sequence
I'm not a mathematician, but lately, I've been watching many math videos on YouTube, and I have an idea I can't find any reference. The problem is:
Given that four agents ordered descendants, giving ...
0
votes
1
answer
58
views
1
vote
1
answer
70
views
How to Compute the Hermitian Conjugate of Non-Commutative Products Symbolically in Mathematica?
I am working on symbolic quantum mechanics calculations in Mathematica, where I need to compute the Hermitian conjugate of expressions involving non-commutative operators. For instance, I have ...