# Tagged Questions

2answers
79 views

### Wrapping Interval Notation for Take

I'm trying to implement the solution to a math problem in Mathematica, but my code can't handle a particular boundary case. I think that I could implement a function that would do what I want it to, ...
1answer
56 views

### Remove curly brackets _completely_ to map a function to the elements of a list [duplicate]

Most list manipulations can be done with Flatten, Partition and Take. I didn't managed to ...
4answers
169 views

### Compare elements in a list

Assume that there are three different points in x-y coordinate like: p1={4, -1}; p2={5, -2}; p3={1, 5}; In order to compare these points to each other in a ...
3answers
110 views

### Speeding Up Replacing of Labels in Large Matrix?

I am Mathematica novice and am trying to find a fast way to replace labels in some rather large matrices (512x512 or 1024x1024) that have resulted from segmenting images with WatershedComponents or ...
3answers
612 views

### DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
0answers
53 views

### deleteduplicates Delete elements of a list [duplicate]

I have a math problem about Mathematica, I am looking help from you. I hope that you could help me. The Math Problem: list= { {0,0,1},{1,0,0},{0,1,0} ,{1,2,3}}; ...
1answer
87 views

### Using Map in a function definition

I want to calculate the hessian of a matrix. So each element gets replaced by a 2 by 2 matrix. ...
2answers
85 views

### Defining a function as a sum of several Gaussians

I have a function that is a summation of several Gaussians. Working with a 1D Gaussian here, there are 3 variables for each Gaussian: A, ...
2answers
193 views

### How to pass a list as function argument?

I have the following function lFreqPhylo[a_, Q_, b_, p_] := Sum[Log[freqFunction[r[[p]][[i]], L[[p]][[i]], a, Q, b, {i, 1, nbranches[[p]]}]; The objects L, r ...
1answer
69 views

### Apply function to output of previous function

I am trying to write a function that takes 3 tuples. Each tuple contains two lists which are first divided. This results in 3 lists. Then I want to take the Mean of all the columns. I can do this ...
0answers
78 views

### Why does Part behave like it transposes lists? [closed]

From the documentation of Part: Part[expr,i,j,...] is equivalent to expr[[i]][[j]]... ...
1answer
113 views

### How to define a list that contains all primes less than x?

how can I define my own list in which I have all primes less than x?
0answers
43 views

### Plot two functions of two variables against each other [duplicate]

I have two functions f1(n,m) and f2(n,m) but the issue is that f1 generates many values say ...
0answers
109 views

### A problem with functions and Infinite expression 1/0 encountering

Following code (function) makes integrals and then replace f[x] with Cos functions and calculate the definite parametric ...
1answer
106 views

### A problem with set values

The following code is just an example to clearly explain my problem. Assume that : ...
3answers
211 views

### Finding a better way to define a matrix

I first defined a 171x171 matrix containing only zeros and then replaced 18 specific rows with nonzero entries. The other $153$ rows will be average of $2$ of the existing $18$ rows. Rows $2$ ...
3answers
177 views

### How to update a list in a function in each iteration

There is a list with numbers 1 to 8 ( p1 ) and another list (j) which contains 4 numbers which shows different 4 positions of ...
1answer
87 views

### Populating an array with outputs of a function [closed]

I have searched, but didn't find much help on my issue. I have an optical physics problem that I'm working on .. ...
2answers
110 views

### How to work with lists of functions

I have some lists of interpolated functions and I want to know if there is an easy way to operate with them. A simplified example: ...
1answer
79 views

### mathematica apply list of functions to the same arguments [closed]

How can I apply list of functions to the same arguments? e.g. ApplyFun[{fun1,fun2,fun3},{arg1,arg2}] I looked here and could not find: ...
0answers
28 views

### Problem with slot in If statement [duplicate]

I am struggling with slots, In this case I have a function int which gives either true or false. When it gives true, I want ...
1answer
63 views

### How to use ImageMultiply[] over a list of strings?

I'm trying to do the following: ...
4answers
259 views

### Using an ellipse as a threshold for Nearest function

The Nearest function can receive as a threshold parameter a radius to look for elements inside that. From the documentation: ...
2answers
102 views

### Handling output that was returned unevaluated from a function

When evaluating functions, including those described in this post, how do Mathematica users handle values returned from a function that are unevaluated? For example (based on 1): ...
4answers
1k views

### Moving maximum function?

How can I construct a moving maximum function? For example, if I have a list of 12 values: { 5, 6, 9, 3, 2, 6, 7, 8, 1, 1, 4, 7 } and I want to maximize over 3 ...
2answers
343 views

### How to plot several functions without jumping? (multiple eigenvalues of a system as functions of 2 parameters)

I've been working on this research problem for months with some success by no global/proper solution to the problem. So I have square, Hermitian matrices of various sizes ($8,20,38$ dimensions) with ...
2answers
115 views

### Add a column to a matrix as a function of the other columns

I was wondering if its possible to add a column to a matrix by a formula that uses all other columns, like this: ...
2answers
181 views

### how recover lost data of coordinates from contourplot of mention data?

I have made Contour Plot for a lot of data, like this ...
2answers
1k views

### Is there an equivalent to MATLAB's linspace? [duplicate]

Does Mathematica have an equivalent to Matlab's linspace? I want to make a list with "start", "stop" and "number of points". What is the neatest way of doing this?
2answers
218 views

### How can I extract when a select condition is met in a do loop the value of the iterator?

I use the following code to find out the number of consecutive prime numbers using a formula $n^2+n+i$ found out by Euler (starting from n=0): ...
5answers
345 views

### Partitioning a list of numbers the Mathematica way

I have two sorted lists, one list will be called the "fences" and the other the "values" Fences could be: $\{1, 5, 9, 14\}$ Values could be $\{-1, 1, 3, 4, 6, 9, 10, 13, 14, 15\}$ I want to ...
1answer
301 views

### Two ways of map a function on the list: Which one is faster?

There are 2 ways to make a function listable on the list: Use Map or use SetAttributes. My question is, which one is faster, ...
1answer
187 views

### Split Lingustic(IPA) at Words Unique Sounds

How might I split a word at each IPA of each unique sound. For example {"pray", "wade"} (* {{"p","r","ˈeɪ"}, {"w","ˈeɪ","d"}} *) ssch answered a question here ...
4answers
61 views

### Don't understand why Do-loop index is not evaluated in Play expression

So here is some weird behavior: When I create a list inside a loop whose elements are Play functions, with arguments that depend on the counter, it is as if the counter is being stored symbolically, ...
0answers
87 views

### Gather dependency on list order?

I get intrigued about Gather behavior on this post. I thought that Gather was invariant under list order? Here is the result I ...
5answers
487 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 ...
1answer
189 views

### Map a function conditional on elements at multiple relative positions in a list

I figure this question has many solutions, and if an answer already exists it would be nice just to be referred to it. I need a function that 'maps' over my list and produces a list of equal length ...
1answer
150 views

### How to compute a discrete histogram of a list [duplicate]

I'm trying to compute the discrete histogram of a set of values. By histogram I mean the absolute frequency a value appears on the dataset, by discrete I mean the values are from a discrete set, e.g. ...
1answer
149 views

### Create continuous function from list

I have a list of data (measured per day) that I want to use as imput for another equation (say f). The problem is that the input I need for f needs to be a continuous function of time. Is it possible ...
0answers
63 views

### Defining functions in a loop [duplicate]

I have a symbolic solution to a linear system with respect to some variables a[i,j] which depend on a parameter t. sol=Solve[...,Table[a[i,j],{i,0,n},{j,0,n}]] I ...
1answer
316 views

### Counting the number of operations performed during a calculation

I need to know how can I count the number of operations performed during a calculation of a CompoundExpression. In some of these expressions there are ...
2answers
585 views

### Function returning Null along with other unexpected expressions

When I use some function, at the end along with the output I get some NULLs returned that I don't understand the reason for and are highly undesirable. For example, when I define the reversal of list ...
4answers
717 views

### How can I create a list of functions?

Can anyone tell me, how to create a list of functions? I've tried the following code, but it doesn't work. ...
1answer
111 views

### Flat function with repeated sequence

There are functions like Join[ ] that accept a variable number of arguments. Join is a flat function, as the order of arguments ...
1answer
111 views

### How does LongestCommonSubsequence work?

When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked. ...
5answers
1k views

### How to sum over a List

list = {11.5575, 11.397, 5.52734, 4.0878, 2.54815, 1.86652, 2.55028, 2.14952, 1.6242, 1.34117} I have a list of numbers. How do I make a function that creates a ...
4answers
604 views

### Accessing list elements by name

First, a bit of a long introduction to my problem: I only have a few weeks of Mathematica experience. I am creating a mathematica application that calculates some material properties of steel based ...
5answers
693 views

### Building a continued fraction

I've completed a problem that involves approximating $e$ by a continued fraction: $$\frac{N_1}{D_1+\frac{N_2}{D_2+\frac{N_3}{\ddots+\frac{N_k}{D_k}}}}$$ with the $N_i$ being the list ...
4answers
530 views

### How make f[{x,y}] evaluate as f[x,y]?

I frequently encounter the situation where I have a function of two real variables defined, e.g.: f[x_, y_] := 9 - x^2 - y^2 But then I need to feed into ...
4answers
620 views

### Extract function arguments

Is there a way to extract the arguments of a function? Consider the following example: I have this sum ...