0
votes
1answer
73 views

How to write series of Do[ ]'s with a single Table[ ]?

Edited to provide more information (sorry I don't know how to format matrices here) I would like to replace: m = 4; ...
6
votes
2answers
174 views

Evaluation in lambda function

If I have a function, that returns a function, for example: f[a_] := a^2 * # & then f[3] == 3^2 # & Is there a way ...
2
votes
2answers
230 views

How can I iterate my code a 1000 times?

this is my solution to Exercise 5 of http://work.caltech.edu/homework/hw2.pdf Please help me make this more elegant. The exercise is about classifying random Points by a (randomly generated) target ...
2
votes
1answer
78 views

Behavior of ValueQ inside a function

The following code Cases[Function[{x}, x + 1], a_?ValueQ :> Hold[a], ∞, Heads -> True] unexpectedly returns {Hold[x + 1]} According to the manual, ...
2
votes
2answers
477 views

Q-Function representation in Mathematica

I observed that there is no Q-function representation in Mathematica. The definition of Q-Function is: \begin{align} Q(x) &= \frac{1}{\sqrt{2\pi}} \int_x^\infty e^{-\frac{u^2}{2}}du \\ ...
10
votes
5answers
479 views

How to find first list element that differs from average of N previous elements by more than a given amount?

Given a list of real numbers, I need to write a function that returns the value of the first element in the list that differs from the mean of the previous $N$ elements by greater than $P$ standard ...
3
votes
1answer
224 views

NestList with a list inside?

I'm new to Mathematica, and was looking for more efficient ways to implement the Do loop below. a, ...
10
votes
5answers
325 views

Transform a list of functions to a composition

How do I apply a list of functions in a nested way? Example: functionList = {f1,f2,f3} RequiredCommand[functionList,Pi] such that the required command returns ...
0
votes
1answer
672 views

How can I define a Step-Wise function in Mathematica (Not using Heaviside Step Function)? [closed]

I need to define a function, which has very different behaviour in different regions. There are about 13 different regions. A sample of my function is the foloowing table: I want to define it as a ...
2
votes
0answers
77 views
4
votes
6answers
207 views

Filter list with different list in it

I have a list like: {{{4, 14}, 1}, {{4, 15}, 1}, {{4, 16}, 1}, {{4, 17}, 1}, {{4, 18}, 1}, {{4, 14}, 3}, {4,15}, {{4, 16}, 2},{4,18}} Now I want to ...
3
votes
1answer
228 views

Evaluating a function on permutations of its arguments

Say I have a function "temp" of $n+1$ variables, $y,z1,z2,z3,...,zn$. I want to test if my function has certain symmetries like swapping $y$ with square of any $z$, swapping any two of the zs, ...
2
votes
1answer
141 views

#[[1]]//FullForm = 1?

I have a set of symbolic algebraic expressions that I'm trying to get some speed into. To illustrate the issue, I'll use a simple form like { k0 X, k1 Y, k1 Z}, ...
4
votes
3answers
358 views

Generate a Combination of letters by a number

I'm trying to write a function f. example: ...
1
vote
2answers
133 views

How can define a set of nested parameters

I would like to know how I to define a function with a nested set of parameters (or whatever you would like to call it). For example, how would I get the following function ...
0
votes
2answers
124 views

About minimizing calculations when using ComposeList

I have a lot of functions to use in a iterative way, and I need some of the calculation results. For example: ...
6
votes
5answers
252 views

How to nest my own “times” function to get powers

I have a "times" function. I'd like to create a power function using it. It should look like this for an 6th power: ...
2
votes
3answers
161 views

Using Nest inside NestList

I need results like this: {Cos[Cos[x]], Sin[Cos[Cos[x]]],Cos[Cos[Sin[Cos[Cos[x]]]]], Sin[Cos[Cos[Sin[Cos[Cos[x]]]]]], ... } I've tried to use ...
13
votes
3answers
276 views

How to keep some of the results of the NestList

I'm using some iterative arithmetics to calculate wave propagation with the help of NestList. I have to use a small step size for iteration to guarantee the accuracy, which lead to too much data (e.g, ...
2
votes
3answers
199 views

Ways to change an explicit function into a pure function

I'm trying to use FixedPoint to solve a transcendental equations, but the first argument of the FixedPoint should be a pure ...
15
votes
3answers
621 views

Can someone explain this snippet: (#[#] &)[#[#][#] &]

A friend showed me this snippet of code today: (#[#] &)[#[#][#] &] I can sort of see that we're constructing an anonymous function that takes a function ...