Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
83 views

Basic question Sort criteria

Can you explain the following codes? (output of codes) I know that there is the default ordering for any expression in Mathematica and Sort uses the default ...
imida k's user avatar
  • 4,355
0 votes
1 answer
127 views

How to convert a list of indexed variable names to a list of formal symbols?

I have the following list of indexed variable names: list = {x1,x2,x3,x4}; I would like to build a list of formal symbols from the above list, i.e. ...
E. Chan-López's user avatar
1 vote
1 answer
89 views

Why does my simple string function fail to grab the only element in a List?

The idea is to normalize a string before processing it to extract information from it. Strings may come with embedded outer brackets which are easily stripped or as elements of a true list. This is ...
Jules Manson's user avatar
  • 2,487
0 votes
0 answers
70 views

Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]

In Mathematica, there is a concept called packed array. ...
imida k's user avatar
  • 4,355
1 vote
2 answers
169 views

Two questions about `Infinity` [closed]

These are 2 small questions about Infinity. They are not related each other. Q1) ...
imida k's user avatar
  • 4,355
7 votes
7 answers
704 views

Grouping consecutive elements at specified positions

Let L1={1,2,4,6,8,9,10,14,15,17,21,22,72,76,80,96,106,116,117} Question1) Group from 10-th to 14-th elements in L1. So that the ...
imida k's user avatar
  • 4,355
4 votes
1 answer
134 views

Extracting list structure from nested list

Can we construct a function f, g in mathematica such that For any list L, g[Flatten[L],f[L]] ...
imida k's user avatar
  • 4,355
10 votes
4 answers
521 views

Construct a pure function containing built-in 'Sequence'

I guessed the output for (Sequence[#, 7]&)[3] should be Sequence[3,7] But my guess was wrong. See the screenshot: And I ...
imida k's user avatar
  • 4,355
2 votes
1 answer
363 views

Using < or <= make different results when sort

...
imida k's user avatar
  • 4,355
4 votes
1 answer
366 views

Largest k such that p^k divides n

(Here all variables are integer.) Is there a built-in function f[n,p] such that f[n,p] = largest k such that p^k divides n For ...
imida k's user avatar
  • 4,355
7 votes
4 answers
452 views

AnyTrue is too good (compared to MemberQ)

Let L be a list of integers, and ⓝ denote an explicit integer. I've thought the most natural way to tell whether ⓝ belongs to L is In[1] MemberQ[L, ⓝ] But there ...
imida k's user avatar
  • 4,355
3 votes
2 answers
153 views

Check an input matrix M contains any nonzero diagonal matrix element or not

Is there a way to easily check an input matrix M contains any nonzero diagonal matrix element or not? For example, if the M contains any nonzero diagonal matrix element, Output: True. if the M ...
Марина Marina S's user avatar
0 votes
0 answers
123 views

Find fit for 3D data

Consider some dataset in the form {x,y,data[x,y]}: ...
John Taylor's user avatar
  • 5,963
3 votes
1 answer
139 views

How to arrange two tables in the following way?

Consider two tables: ...
John Taylor's user avatar
  • 5,963
18 votes
1 answer
403 views

Head[x] vs x[[0]]

Can we say Head[x] and x[[0]] are identical ? In mathematica manual I could find : 'The head is the part with index 0' But I am not sure whether Head[x] are x[[0]] are really interchangeable in any ...
imida k's user avatar
  • 4,355
0 votes
0 answers
63 views

After execution of simple list manipulation every expression turns dark blue and nothing is defined - how to debug

This question is related to this one in the sense that it uses the code from there. What happens is best illustrated in the video here. When I run (* part 1 *) ...
atapaka's user avatar
  • 4,036
1 vote
1 answer
148 views

JoinAcross with multiple associations

I would like to use JoinAcross to combine several lists of associations. Extending an example from the documentation, I'd like to do this: ...
Mark R's user avatar
  • 1,589
8 votes
3 answers
580 views

Is there a built-in function to get the centroid of a table?

Suppose I have a table with some data that are 'lumped' around some central location, such as the dummy example ...
Emilio Pisanty's user avatar
6 votes
2 answers
361 views

How to create non-rectangular array with Array?

From the answers to this question, I learned that the recommended way to construct a symbolic sum of terms in an expression is to use Array. But I'm having a ...
QuantumDot's user avatar
  • 19.8k
7 votes
2 answers
235 views

Constructing expressions using Sum vs Array[... Plus] vs Plus@@Table[...]

For constructing a sum of terms which are symbolic, I noticed that in addition to ...
QuantumDot's user avatar
  • 19.8k
8 votes
3 answers
147 views

Is there a PartDelete like there is a TakeDrop

TakeDrop is nice because after taking a subarray, it also returns the remaining subarray. But it is limited in that the part specification can only be ranges, and ...
QuantumDot's user avatar
  • 19.8k
7 votes
8 answers
497 views

What is the inverse of the Position function?

What is the inverse of the Position? I have an array which contains the positions of elements and I want a function which returns an List which contains 1 where ...
The Square Cow's user avatar
5 votes
4 answers
745 views

Mean of a list of lists (vector) with missing values

I understand, from Calculating the mean of a list with NaN values, that one can preserve structured data with missing values, and still calculate a mean, using ...
FalafelPita's user avatar
0 votes
0 answers
59 views

built-in functions with one argument

I want to find the (NumericFunction) built-in functions that take exactly one document. ...
Dimitris's user avatar
  • 4,894