# Tagged Questions

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.

476 views

### How to generate this structure of a list without While and the like?

I need to create a list that holds, for given integer d, the elements $1,\ldots,d,d+2,\ldots,2d,2d+3,\ldots,3d,3d+4,\ldots,d^2$ where $\ldots$ is just denoting ...
38 views

### Plot is empty (probably) due to poor function definition

I am trying to plot my response $x(t)$ as a function of system parameter $M_0$. Here is my code to regenerate my problem ...
98 views

### For loop works at top-level but not in a function

Why does this work: For[i = 1, i <= Dimensions[list][[1]], i++, list = Insert[list, i, {i, 3}]] But this doesn't: ...
166 views

### Sets and sums of different elements

Consider the set S={w,x,y,z}. If the set of all possible sums of any three different elements from S is {-1,3,5,8}, then what is the set S? How could I solve this function using Mathematica?
79 views

### Remove part within square brackets for function

So I've defined a variable as follows: q = {{x[t]}, {Φ[t]}} V=0.5*x[t]^2*m^2+0.5*Φ[t]^2*I I've had to differentiate with respect to time so: ...
76 views

### How to obtain the Derivative of a pure Function of variable number of arguments?

Here is a function f that takes a variable number of arguments: f = Times[##]*Log[1 - Times[##]] & I now want to ...
48 views

### How to calculate a continuous function once and access values later?

I have a function that involves a numerical calculation: h[v_]:=NIntegrate[f[x]*Log[p[x, v]], {x, -Infinity, Infinity}] I need to visualize how well a bunch of ...
52 views

### AbsoluteTiming of nested integration gives strange result

I found somewhat strange behaviour of nested integration timings. Consider the following code: ...
54 views

### Equivalent (?) definitions of function gives different answers

I have a function as follows: ...
41 views

### Why doesn't this function definition work?

I am trying to define a following function (which is a convolution integral) ...
96 views

### Plotting a periodic function [duplicate]

My question is the following: how can I plot a function repeatedly? By following some topics here I found some basic information about using Fourier series. This is what I made: ...
70 views

### Finding roots of a function that includes Bessel functions [duplicate]

I'm fairly new to Mathematica so forgive any stupid mistakes. Here's my function: ...
82 views

### Write complex number in terms of absolute value and phase

I have a long vector and some of the values (19 out of 64) are complex. I got them using the Mathematica Rationalize function, so the complex ones are written in the a+bi form. Is there a function I ...
92 views

### How to turn a subroutine into a function?

I've written a subroutine that takes in 6 matrices and after some manipulation returns back 3 new ones. I will use this subroutine fairly often in this notebook so I think it would be easier to turn ...
103 views

### n fold convolution of a function via a recursion function

I wanted to write a recursion function to calculate the n-th convolution of a function f[x_]. I wrote the function ...
59 views

### Considering special cases in general definitions

I want to calculate some coefficients $\qquad B_k = 2\int_0^1 u(x) \cos(k\pi x)\,dx$ for $0<k\in\mathbb N$ and I am doing this in the following way: ...
56 views

### break down the function

I am using Series function, but I found that it cost too much time. Since the Series function is Taylor expansion and I only need first order, I want to break down the code, so I can make it faster <...
48 views

### Passing a list to a nested vector function

In order to apply a newton-rhapson algorithm to solve a set of nonlinear vector equations such as these, f[x_, y_] = {x^2 - 3*y + 6, (y + 1)^2 - x - 33} I need ...
87 views

### Partial Function Evaluation [closed]

How can I evaluate only part of a stack of function calls? In particular, given f[x_,y_,z_]=x+y+z;, say, I'd like to define a function ...