Tagged Questions
2
votes
2answers
67 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 ...
2
votes
4answers
139 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.
...
2
votes
1answer
59 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 ...
6
votes
1answer
88 views
How does `LongestCommonSubsequence` work?
When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked.
...
3
votes
3answers
190 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 ...
12
votes
3answers
222 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 ...
8
votes
5answers
267 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 ...
2
votes
3answers
206 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 ...
3
votes
4answers
202 views
Extract function arguments
Is there a way to extract the arguments of a function? Consider the following example:
I have this sum
...
4
votes
1answer
137 views
A Faster way to combine two Lists of different structures into one of a different structure [duplicate]
I have the following two lists (each containing over 500,000 elements). Here is a sample:
...
3
votes
1answer
66 views
Efficiently finding the maximum value of a column in a matrix
Imagine I have a matrix of the following form:
TestArray = $((a_1,b_1,...),(a_2,b_2,...),(a_3,b_3,...),...)$, where a specific example might be:
TestArray = ...
2
votes
1answer
97 views
writing a function using multiple variables
I am fairly new to Mathematica and am trying to write a function for the equation:
xx = [x/(Sqrt[h^2 + d^2 + y^2]))*(Sqrt[h^2 + (d + yy)^2])
where h, d are known ...
0
votes
1answer
118 views
Random sample with gap sizes
Lets say I have 101 instances of data with multiple attributes. In particular case, one attribute has 7 unique values. I want to get ...
1
vote
1answer
154 views
Filtering Lists in Mathematica [duplicate]
Possible Duplicate:
Select/Delete with Sublist elements?
I need help in filtering long lists of x,y coordinates.Lets use the following list as an ...
4
votes
6answers
172 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 ...
2
votes
2answers
139 views
Position function not always retuning an answer even with no apparent problems
I'm having some problems with Position.
Sometimes it will give an empty list instead of the actual position of the element I am looking for when that element is ...
5
votes
4answers
193 views
Prevent Part[] from trying to extract parts of symbolic expressions
If you have a list, e.g.
{1, 2, 3}
then you can extract the $k$th part using Part (...
4
votes
3answers
278 views
4
votes
2answers
190 views
How can I use Max[] in a function that is passed a list not find the max of the list
For most functions in Mathematica, passing them a list will call the function on each element of the list. For example:
...
3
votes
3answers
165 views
How to pull scalars out of a function that should act on lists?
Suppose I have
A = a vecA
B = b vecB
where a and b are supposed to be arbitrary scalars ...
16
votes
8answers
423 views
Applying And to lists of Booleans
I'd like to take {True,True,False} and {True,False,False} and apply And to get ...
13
votes
7answers
318 views
Get the first element after the first sequence of length N of consecutively increasing values
I'm looking for an efficient way of extracting the first element after the first sequence of N consecutive elements in which the values are increasing.
If these are the data of a toy example:
...
9
votes
5answers
674 views
Counting negative values in list
I would like to count the negative values of a list.
My approach was Count[data, -_] which doesn't work.
How can I tell Mathematica to count all numbers with ...
-5
votes
3answers
259 views
Constructing lists by applying functions to another list
Suppose f is a function of two variables: $f = f(x,y)\quad$ and $L$ is a list. Could someone help me in defining a list of the form:
$D = \{f(x,y)\ |\ x \in L,\ y \in L\}$
I tried this:
...
6
votes
2answers
418 views
Finding all partitions of a set
I'm looking for straightforward way to find all the partitions of a set.
IntegerPartitions seems to provide a useful start. But then things get a bit complicated.
...
1
vote
2answers
144 views
Expectation over a list with nested-mapped expressions
I need expected values of a list where the random variable to take expectations over should be an input into expressions defined earlier. I suspect Set[] and SetDelayed[] tripped me. (Or Map and ...
5
votes
1answer
105 views
RankedMax and Max do not behave identically
I have spent three hours debugging some code and at the end I think I found a bug. Otherwise I cannot explain what I am seeing:
When I want to use RankedMax on ...
6
votes
2answers
196 views
How to choose variables from a list for a function and then use the solution in a subsequent function?
I am trying to calculate heating degree days and cooling degree days and output that information to a table. I am using mathematica's curated data to do this. In text this is what I would like to ...
20
votes
3answers
374 views
Is there a bug in Pick?
I wanted to use the Pick function with a condition. But there seems to be an issue here. Take a look at this:
...
7
votes
3answers
262 views
How to create a list of pre-defined functions?
I would like to create a list of Cauchy distribution pdf's, having different locations of their maxima, and being multiplied by different factors; then I'd like to calculate those functions' values ...
10
votes
3answers
204 views
How to “ignore” an element of Map or MapIndexed
Say I have some function that I'm applying every element in a list to... if that element matches some criteria:
...
13
votes
6answers
839 views
Max of a table/list with indeterminate values
Suppose I have a Table:
tab = {1., 2., 3., Indeterminate}
When I type Max[tab] I get ...
10
votes
2answers
350 views
How do I find the elements in a list that return the highest value for a function?
Suppose we have a list of values and a function f. I want to find which of the elements maximizes the return value of the function in Mathematica. Let call the ...
10
votes
9answers
404 views
How to find range in which a number falls, from given list of numbers?
How can one find the range in which a number falls, from given list of numbers?
...



