Questions tagged [head]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
1 answer
172 views

Why is Around omitted when the uncertainty is zero?

I have a list of values with errors and I use Around[x, dx]. Some of those values have an error of zero though. Mathematica removes the ...
Failboy's user avatar
  • 53
6 votes
1 answer
302 views

A problem on the pattern (:) of Heads

I defined Clear[f, g] f[(h : Exp | Log)[x_]] := x; g[(h : Log | Exp)[x_]] := x; The code gives a weird result: ...
Curious Cat's user avatar
11 votes
2 answers
467 views

How can I create an atomic head or treat some head as atomic during Map?

For example, Map[g, {0, {h[1, 2, 3]}}, {-1}] gives {g[0], {h[g[1], g[2], g[3]]}} I want a ...
matheorem's user avatar
  • 17k
2 votes
0 answers
53 views

When should I use Audio vs Sound Data types?

It seems like mathematica has 2 related data types Audio and sound. Why is there 2 separate data types? When would I use one versus the other? Guesses I know I can convert between them by ...
ions me's user avatar
  • 761
2 votes
0 answers
41 views

Can't match custom head in function signature [closed]

I have written a financial charting function which has the following signature; ...
RobertNathaniel's user avatar
0 votes
1 answer
67 views

any way to store the values of the controls of a Manipulate so that one can reuse them in the future excutions

I’m using Manipulate[] to adjust several parameters, which will eventually generate some figures. After I get the desired view, I’d like to store the set of control parameters so that I can reuse them ...
larry's user avatar
  • 695
4 votes
2 answers
245 views

How many @ need to be used when I try to use apply function? [closed]

According to the manual, $f@@A$ means apply function $f$ to $A$. If it would be the same if I only use one @? Does $f@A$ still represent apply apply function $f$ to $A$? And it would help a lot if ...
QubitTy's user avatar
  • 107
5 votes
1 answer
124 views

Extracting n-th part of an expression without any evaluation

Is it possible to extract n-th part of an expression as a string, without any evaluation? For example, ...
imida k's user avatar
  • 4,047
18 votes
1 answer
376 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,047
2 votes
2 answers
94 views

Understanding f /@ g[x,y,z] [closed]

According to the Mathematica guide, In[26]:= f /@ g[x, y, z] Out[26]= g[f[x], f[y], f[z]] In a simple example, this works as desired with symbolic values: ...
Minkowski's user avatar
  • 143
1 vote
1 answer
119 views

How to use column header as the x-axis in ListPlot?

I imported a csv file, and the header of the columns are specific dates. How would I plot these points using ListPlot, but the x-axis instead of 1,2,3, etc, is the dates from the column headers? For ...
froyogirlio's user avatar
1 vote
1 answer
100 views

Dropping curly brackets from a list [closed]

I would like to make many plots using the same plot parameters. I am trying to define a plot parameter list such as ...
Sam's user avatar
  • 11
4 votes
1 answer
76 views

Name of patterns cast as expressions from strings

I'm trying to match a part of a string while imposing conditions on the patterns, e.g.: StringCases["223", a: DigitCharacter ~~ b: DigitCharacter /; Unequal[a, b]] ...
abcd's user avatar
  • 483
0 votes
1 answer
75 views

Count heads: e.g. neglect all terms $\sin(x) \sin (y) \sin (z) \sin (w)$ for all values of the argument

I have a polynomial (functional) expression $E[F]$ in terms of a function $F$. I want to take an $F$-cube truncation in the sense that I want to and make terms of the form $F[w]F[x]F[y]F[z]$ vanish ...
João 's user avatar
  • 155
-1 votes
1 answer
76 views

Function matching any head (Example: h_[_,_] := 5)

I want to define a function matching any expression with 2 parameters. For example: _[_, _] := 5 I get the following error: SetDelayed::nosym: "[,_] does not ...
BP75's user avatar
  • 51
3 votes
4 answers
388 views

How to remove style from a styled number?

For example, I have a number with style like so: Style[1, Red, 20] How do I remove its style, so it returns to its inner value 1...
liang's user avatar
  • 589
13 votes
7 answers
808 views

Getting the "root" Head

I have a dynamic list of function names, like {f1, f2, f3, ...}, and they will enter in computation in various forms ...
Lelouch's user avatar
  • 513
1 vote
1 answer
11 views

Parsing the link returned by CloudExport

Consider Is there a way to make a function justLink that parses a CloudObject[<link>] and returns just the string ...
George's user avatar
  • 3,115
3 votes
2 answers
179 views

Extracting terms with certain heads in a function

Given a function with several arguments func[a,b,g1[x],g1[x,y],g2[1],g2[g1[1]],3] I would like to extract all arguments with the head ...
mastrok's user avatar
  • 591
8 votes
1 answer
200 views

Why does MatchQ[a, r_ /; Head[r] != Plus] evaluate to False?

I'm trying to understand. Why is it that: MatchQ[a, r_ /; Head[r] != Plus] Evaluates to: False ? For me, I would think ...
Jmeeks29ig's user avatar
  • 1,427
26 votes
2 answers
3k views

Why no RationalQ or RealQ?

Interesting pattern came up as I go through the homework replies of my students. Why is there no RationalQ or RealQ? We have <...
Andreas Lauschke's user avatar
4 votes
1 answer
376 views

Testing Head inside a Module [closed]

I hava a Module in which a want to give a single String or a List as a parameter and I want to change a single String to a List containing this String. So I did the ...
mgamer's user avatar
  • 5,573
4 votes
1 answer
206 views

question about using Heads->True in Cases command

I was trying to find the order of highest derivative of expression. Using solution given in detect-highest-order-of-derivative-in-expression I just do not understand why when removing ...
Nasser's user avatar
  • 137k
1 vote
2 answers
1k views

Head replacement [duplicate]

Input Code a[1]=UnitVector[4,1] b[1]=1 Now I want replace the head of b[1] by a, ...
Robin_Lyn's user avatar
  • 355
5 votes
1 answer
114 views

How to obtain a list of all build-in system level Heads?

I am writing a small Mathematical expression parser and need a list of all Mathematica build-in Heads (system context?) so I can check the type of input. Such as ...
Nasser's user avatar
  • 137k
8 votes
2 answers
235 views

Replace Complex Head with List

I would like to apply ListPlot to a set of complex numbers. This is what comes to mind to convert a complex number to a pair: ...
Chrystomath's user avatar
2 votes
1 answer
120 views

Gather element of a list based on their head

I have list of the form {y[-1], y[0], w'[1], y'[0], w'''[-1], z''[-1]} and I would like to gather the elements together based on their heads to have ...
jrekier's user avatar
  • 463
3 votes
1 answer
619 views

How can I replace a head on a specific level?

So in my notebook I have a list of long expressions which are sums of a bunch of terms. I would like to look at each of these terms individually and try to remove them based on some criteria. My idea ...
swalsh1123's user avatar
1 vote
1 answer
1k views

How to "invert" a rule

The subject is a bit cryptic, I know, but here is what I'd like to do: Let's say I am solving an ODE like this: ...
Pirx's user avatar
  • 4,129
7 votes
2 answers
343 views

How to access Dataset's metadata

A Dataset object has internal metadata. For example, let ds = Dataset[{<|"a" -> 1, "b" -> "x", "c" -> {1}|>}]; ...
kjo's user avatar
  • 11.7k
2 votes
1 answer
85 views

Why is head evaluation inconsistent in pattern replacement?

I noticed the following unexpected result: In[90]:= "foo" /. x_String -> Head[x] Out[90]= Symbol Why is it that Head[x] ...
Adrian's user avatar
  • 377
5 votes
1 answer
331 views

How to represent 1 as Symbol["Integer"]

Maybe this is a boring question, but I cannot figure it out. Because every expression has a Head, and Head[1] is ...
Kattern's user avatar
  • 2,541
6 votes
1 answer
434 views

How to Collect a variable multiplied by a constant?

I'd like to use Collect to get terms that have a variable multiplied by a constant. For example I'd like: Collect[x + b x, b x] ...
JeffDror's user avatar
  • 1,870
4 votes
1 answer
993 views

What is the definition of head in Mathematica? [closed]

I know (by practice) what a head is, but I am unable to find the appropriate words to actually define it. I would like to see a precise definition of head using the appropriate technical words ...
user avatar
1 vote
1 answer
225 views

Why does the Derivative function not appear in the tree form? [closed]

I was learning that set delay doesn't evaluate things until its calling time. Hence, I thought that something like the followng: dfdt := D[f[t],t] would not ...
Charlie Parker's user avatar
6 votes
2 answers
679 views

Is there any way to use head of Real and Integer altogether?

Is there any way to use the head of Integer and Real together like below? The below is not right, I know that, it is just for ...
Smart Humanism's user avatar
2 votes
0 answers
378 views

Custom Head for Encapsulation

Often when I'm writing a project in Mathematica, the number of arguments I must provide to functions spins out of control. I need a sort of object-oriented encapsulation approach. I've already had a ...
Myridium's user avatar
  • 1,089
6 votes
1 answer
1k views

Pattern matching list of elements with different heads

I have a function, which I want to accept only a list of kind of elements belonging to a group. The task comes down to finding an elegant pattern suitable for easy to read function prototype. As an ...
Johu's user avatar
  • 4,876