We’re rewarding the question askers & reputations are being recalculated! Read more.

# 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,678 questions
Filter by
Sorted by
Tagged with
48 views

### What means the definition F[t_?NumericQ] :=…? [duplicate]

I've come along a function defined in this way: F[t_?NumericQ] := NDSolve[{-u''[x] - u[x]/x == -t^2 u[x], u[x0] == x0, u'[x0] == 1}, u, {x, x0, x1}] What does ...
110 views

### Best practices for breaking up functional blocks?

Say I have a main function that does some job, and I'm only interested in the final result of ans, i.e., the local functions are not important and produce no side-...
138 views

### How to create a reliable natural integral operator? [duplicate]

Natural integral is one of the antiderivatives of a function, for which the integration conctant is fixed in a natural way. It is defined as follows: f^{(-1)}(x)=\frac{i}{2\pi}\int_{-\infty}^{+\...
88 views

### Eigenvectors inside a maniupulate function

I am trying to make a physics application and it requires that the eigenvectors be taken for a 3x3 matrix. It is my intention that Mathematica never have to deal with the matrices symbolically. ...
232 views

### Using Table[ ] vs using Do[Append [ ] ] [duplicate]

Is it generally better/faster to use the Table function over using Do[Append []]? For example, I have this piece of code: <...
120 views

### creating some smooth density functions

I would like to create some density functions based on some distance measure $D$. As a base density function lets say I have a Gaussian density $f$ with mean $-1$ and variance $1$. I would like to ...
42 views

### Nested For Loops that result in no output [duplicate]

I am sure that this is not the most elegant code you will have seen, but I am trying to loop through an expression to see if FultonHarrisn] produces any outputs ...
654 views

### How to define a pure function with a Module?

I was not able to use a self defined (using Module and For loops) piecewise function to fit data. It seems that the problem is that I have to define a pure function. I would like to learn how to ...
57 views

It is possible to define function dependently to passed argument type or condition this argument fulfills (somewhat like overloading): ...
142 views

### Strange function definition result [duplicate]

I'm relatively new to Mathematica, and I'm trying to define a function f(k) that would do the following: For any positive integer $k$, a finite sequence $a_i$ of fractions $\frac{x_i}{y_i}$ is ...
171 views

### Converting an expression to function [duplicate]

I have the following problem. I current can automatically create the variable positionPayload, for instance: ...
82 views

### I have several functions and how I know which one is the maximum in a certain range?

What I did are the followings These lines will generate a piecewise function pw which tells me the corresponding variable given an interval as follows: Now, I want to get: names of variable instead ...
45 views

### Trying to define a function using indexed variables

I have a list of indexed variables, for example xx={x,x} and an expression which is a function of those indexed variables, say ...
138 views

### How to directly/conveniently use variable names as filenames?

Purpose To use variable name as file name conveniently. Code Special thanks to @J.M.'s tips! ...
76 views

### Create a list of all functions given a set of arguments

I'm trying to examine some patterns on the permutation of elements in finite element functions. I'd like to create a list of all functions (256 of them) on ...
144 views

### Dynamically show a specific number of the fractional part's digits

What is the fastest way to cut off all n z digits of the fractional part of a real number? (For example 12390.20934230) I came up with this so far: ...
46 views

### Error in If function [closed]

I defined a function which roles as operator and. and[a_, b_] := If[a == true, b, false, "F"]; When the first implement is false the function outputs "F". For ...
92 views

### serious problems with the double factorial of a defined function [duplicate]

I have calculations involving the following sum: Sum[Co f[2n]!! Cos[2(n-l)p] {n, 1, ∞}, {l, 0, n - 1}] where ...
91 views

### Calculate column number from alphabetic column reference in Excel [duplicate]

Here's a fun brain teaser. Can you give me a mathematical equation to calculate the column number of a Microsoft Excel column, given the alphabetic column reference? Let X, Y, & Z represent the ...
111 views

### Calculations in sequence

I have a this calculation, as you can see it is doing a calculation on each list, from list 1 to list 4 of the datafile. My problem is that using Mapthread to do this calculation does not work because ...
31 views

### Define a function when given a graph with points (0,3),(2,5),(10,4),(6,2) [closed]

Define a function when you are given a graph with points (0,3),(2,5),(10,4),(6,2)
154 views

### What is the practical use of the form g[x][y][z]?

Consider two functions, f and g. f is a curried function. It takes a single argument and ...
1k views

### How to correctly call a Module within another Module?

How to embed and call the correct embedded modules inside another Module? Say: ...
689 views

### Creating new functions using the names of existing ones

I have a list of functions {G[x_, y_], F[x_, y_], C[x_, y_]} how I can create the list of new functions such as ...
145 views

### Function just gets mapped without any evaluation [closed]

Variable definitions are as follows: eBEG=0.; epBEG=0.; aNEXT = 0; eNEXT=0.; actStrain=0.; epTRIAL=0.; sigTRIAL=Range; sigEND=Range; Constant definitions ...
145 views

### Programming Multipolar Expansions in Spherical Tensors

We have that a density matrix can be written in a basis of spherical tensors: $\rho =\sum _{K=0}^S\sum_{q=-K}^K \rho _{\text{Kq}}^{(S)} T_{\text{Kq}}^{(S)}$ for example for a 3x3 matrix, $S=1$, ...