Questions tagged [head]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
9 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 ...
3
votes
2answers
87 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 ...
8
votes
1answer
148 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 ...
22
votes
2answers
1k 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 <...
3
votes
1answer
124 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 ...
4
votes
1answer
88 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 ...
1
vote
2answers
163 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, ...
4
votes
1answer
76 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 ...
8
votes
2answers
174 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: ...
2
votes
1answer
58 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 ...
3
votes
1answer
245 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 ...
1
vote
1answer
514 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: ...
7
votes
2answers
263 views

How to access Dataset's metadata

A Dataset object has internal metadata. For example, let ds = Dataset[{<|"a" -> 1, "b" -> "x", "c" -> {1}|>}]; ...
2
votes
1answer
68 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] ...
5
votes
1answer
254 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 ...
6
votes
1answer
248 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] ...
4
votes
1answer
460 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 ...
1
vote
1answer
166 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 ...
5
votes
2answers
342 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 ...
2
votes
0answers
265 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 ...
5
votes
1answer
434 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 ...