Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

# 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.

1,684 questions
Filter by
Sorted by
Tagged with
4 views

### Function and patterns. FixedPointList doesn't work with function

There is a function: Clear[sort]; sort[{a___, b_, c_, d___}] := {a, c, b, d} /; b > c; It perfectly works with NestList function: ...
49 views

### Overwrite a function after each iteration of a loop [on hold]

I would like to replace one function with another one or, put differently, "overwrite" one function after each iteration of a loop. I am posting here the code without the loop construct but the idea ...
43 views

### How to generate nested expression?

I've found some related questions, but nothing has really helped me to do what I want to do. Given a list of variables L and a parameter ...
56 views

### Define a function for a Log[b] which gives 0 when a==0 [on hold]

I need a function aLogb[a,b] which: 1) Returns a Log[b] when a is a number, except it returns 0 when ...
29 views

### Specifying return in function [closed]

In the following function, I just want to return the piecewise part that I defined, but since I have some instructions before, the function returns a list where the second argument is the piecewise ...
24 views

### Define a delayed function with tested patterns for fitting

This question is a variant of "Define function using variable list" Fitting functions require a model function defined in terms of explicit symbols that should only evaluate given numeric inputs, and ...
43 views

...
29 views

### How to get a function from a list element? [duplicate]

I have a set of arguments in a list like: uy = {21/2 + y/2, 13.6667 + 0.666667 y, 20 + y} Now, I want to assign a function (call it 'f(y)') to an element of that ...
38 views

### Filter out terms that include any combination of F[X] and G[-X]

I have the following problem which is closely linked to a previous question I asked some time ago (Replacement rule for terms that are separated by operators?). In this specific instance, suppose I ...
23 views

### Assign dynamic string in a list to variables in functions

I have 2 lists: ...
95 views

### Unable to find root for user-defined function

I created the function getSolution[xVal,yVal] for a geometry problem I'm working on and wish to solve it for getSolution[2,x]==0. I can plot it clearly showing the roots: However, when I attempt to ...
56 views

### How to Create an Efficient Step Function from Data

I have list of rules from where a DateListStepPlot can be created to visualize the problem: ...
45 views

### Simply define an arbitrary, real function [closed]

I know of a way to define an arbitrary function (say, a[x]) and then apply an assumption to it (say a[x] is real). My code is pasted below. ...
56 views

### Is there a function or a way of getting a remainder or modulus with equations with “surds”?

So I'm working with "surds", or radicals. I have expressions like $$7 + 5\sqrt{2} + 6\sqrt{3} + 7\sqrt{6}\tag{1}$$ and I want to take the "coefficients", for lack of a better word, and take their ...
254 views

### Find constant that allows an integral to be finite

I have a function which is a not-so complicated polynomial, depending on a parameter $c$: $$f(r,c) = \frac{-2 r^4-4 r^3-6 r^2-6 r-3}{8 r^3}-\frac{c \left(-2 r^2-2 r-1\right)}{4 r^3}$$ What I am ...
27 views

### Creating a special product function

I am having trouble working with lists inside functions with Mathematica. Basically, I have a list of numbers and a special way to multiply them. I want to have a function that is able to create a ...
110 views

### A list has been obtained from an outside soft (from COMSOL - to Mathematica). Let us make a continuous function out of it

Using COMSOL I have solved an equation. The solution in the form of nested list with the term {x,y,z} is here. This ...
30 views

### Series expansion of explicit functions

For the following input, zv[u_, v_] := v + zv1[ u, v]/u; mvu[u, v] := D[zv[u, v], u]; Series[mvu[u, v], {u, 0, 1}] the output is ...
31 views

### Derivative of function with large number of arguments

I have a function which depends on more than 30 parameters and I want to symbolically compute the derivatives with respect to the individual parameters. From the documentation of the ...
584 views

### return {} when the function is given {}

I have a function taking an array as argument and giving an output. However, sometimes my argument is {} (the empty array), then how can I get an output {} when my argument is {}? Actually, I want the ...
67 views

### Generalization of code is slower than particular case

I wrote the following Mathematica module: ...
70 views

52 views

### How can I find the minimum and maximum output of a function and specify the valid ranges and steping of each variable? [closed]

I am a software developer, and it has been far too long since the last time I've needed to do any math this complicated. I've forgotten a lot of the proper terminology, which has made finding answers ...
84 views

### Construct a function that maps strings to functions

The main question is the last 5 lines (including codes) of this article. A[x_, y_] := Evaluate[ToExpression["x^2+y^2"]] A[3,4] Then the output becomes ...
46 views

### Using MinValue with NDSolve

A simplified example looks like this. The basic idea is to maximize fHelper by adjusting \[Alpha] for each ...