Questions on the basic structure of the Mathematica language (Wolfram language) including atomic data types, syntax etc

learn more… | top users | synonyms

3
votes
0answers
71 views

How to get “BasicFunctions” from WolframLanguageData with implicit entity

I am trying to get a list of the functions that have property "FunctionalityAreas" -> "BasicFunctions". The following does not work: ...
4
votes
1answer
197 views

Why assign variables to empty curly brackets?

I am trying to read code and I see empty curly brackets. For example: abc = {} or fort[x_] := Module[{}, more stuff here ] ...
6
votes
0answers
52 views

KeyIntersection fails (?) when an association is empty

I think I found a bug in KeyIntersection (Mma 10.2). To illustrate, input the following: ...
4
votes
1answer
177 views

Using Mathematica's Position Function

I have a list a = {-1, 2/3, -2 - 4 I, -2 + 7 I, 2 I} and when I use the Position[a, I] it returns ...
8
votes
1answer
95 views

Understanding Part and Span operating on expressions with heads that are not List [duplicate]

I hope this is not a duplicate. I do not understand how does the Part and Span functions work on this expression: ...
0
votes
2answers
41 views

How to use With on previously defined expressions [duplicate]

The command With[{x = 1}, x] outputs 1. The command t = x; With[{x = 1}, t] outputs ...
2
votes
1answer
47 views

How to label outputs from Print [closed]

I have problem with Print in Mathematica. The data that I get from it, is not labelled so that I can use it elsewhere, therefore I have got to label them manually. ...
10
votes
1answer
519 views

Difficulty understanding difference between == and ===

After doing this: ...
18
votes
1answer
231 views

Defer, Hold, Unevaluated, Inactivate — which one when?

What are some guidelines on which function to select from among the superficially similar functions Defer, Hold, ...
1
vote
2answers
143 views

Row-wise matrix multiplication

I have a matrix $A=\{a_{ij}\}$ of dimensions $n$ rows by $m$ columns, and I would like to multiply each row of the matrix by a constant $b_i$, $i=1,\ldots,n$, and store the result in the same variable....
2
votes
1answer
61 views

Out[] is returning percent sign % instead of expression 10.3 [closed]

Has anyone else had this problem, is it a setting, or a bug in 10.3? In[1]:= 2; %+2 Out[2]= %1+2
7
votes
2answers
310 views

Wolfram Language symbols by their Ranks

I'd like to get the top 50, the bottom 50 and an ordered list of all Wolfram Language symbols based on their "Ranks". With ...
0
votes
0answers
54 views

Weird variable report

All, What does this mean when it shows up in your notebook? ?f f Global` CreateUUID["Info-"] False False False ?x x Global` CreateUUID["Info-"] False False False What has happened? ...
0
votes
0answers
32 views

elementwise operation with vector and matrix (“broadcasting”) [duplicate]

In languages supporting broadcasting, one can easily do elementwise comparison of a vector and a matrix. What is the recommended approach in Mma? For example, suppose I want to do a ...
0
votes
1answer
87 views

Formulate an equation to find a fixed point [closed]

I have the following equation: Subscript[x, n + 1] = Subscript[x, n]^2 + c with Subscript[x, 0] = 0. This equation is restricted ...
6
votes
5answers
503 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that <...
4
votes
1answer
76 views

Manipulate: how to hide manipulator

Suppose one creates a simple Manipulate in a notebook, with a single numerical control and no changing of the default appearance. Then there is a small + in the upper right, for accessing the ...
1
vote
1answer
44 views

should Variance of EmpiricalDistribution include Bessel correction? (it doesn't)

I was rather surprised by this: ...
0
votes
0answers
37 views

when to use `Select` vs `Cases` [duplicate]

Given a list lst and a Boolean function f, are there any interesting differences in the following? ...
6
votes
2answers
287 views

What evaluation mechanism is behind Mathematica support for multiple definitions of a function? What is the benefit of this?

I am studying the question What are the most common pitfalls awaiting new users? Up to now, I have fulfilled some of the parts but yet don't understand which this problem is related to? Consider the ...
18
votes
3answers
549 views

What are the requirements for a well behaved indexed variable? Subscript, ToExpression, Downvalue?

On writing this answer I needed to call a function, (NonlinearModelFit) with an unknown number of parameters. We have learned that we should not use ...
0
votes
1answer
50 views

SortBy second item in each list item [closed]

I have: mydata = {{1, "NEBRASKA", 2.7`}, {2, "NORTH DAKOTA", 3.`}, {3, "UTAH", 3.6`}, {3, "VERMONT", 3.6`}, {5, "HAWAII", 3.7`}} Now, I can do: ...
0
votes
1answer
64 views

How to put a levelspec in operator form? [closed]

All variable argument functions need Function wrapped around them in operator form, but is there any other way to achieve this: ...
8
votes
3answers
104 views

Indexed and array-valued interpolations

Bug introduced in 10.1 or earlier and persisting through 10.3.0 or later Using Indexed on an InterpolatingFunction leads to ...
2
votes
0answers
36 views

Unexpected behavior from Return called in a Block [duplicate]

I like to write functions that dispose of failure cases early, before they do the main calculation, but I don't like to write cascading If statements. Here is a toy ...
14
votes
1answer
431 views

Why is an Identity function needed?

Today I came across the function Identity[x] in Mathematica (documentation). The example given in the documentation uses it in ...
1
vote
0answers
22 views

How to ValueQ a symbol, constructing the symbol name from strings? [duplicate]

In a function I'm writing, I need to check whether a particular symbol has been assigned a value (any value) in a particular context. This would work: ...
11
votes
1answer
86 views

Which symbol gets DownValues or OwnValues when using SetDelayed?

I have been looking at various usages of Pattern objects. Here's a number of ways to define the same thing: mod[x_] := {x} ...
9
votes
2answers
239 views

Pattern and Orderless function

I'm a Mathematica beginner. I am exploring the use of patterns and (only for fun) am trying to implement a permutations function. My (dirty) code is: ...
0
votes
1answer
47 views

Could I use Select with condition on any column other than First (Last)? [closed]

I often deal with huge tables of various functions of randomly generated values for my research. Sometimes there's need to only keep rows which satisfy a specific condition. This is easy with ...
1
vote
0answers
78 views

What's in a Name? [closed]

StringReplacePart["StringReplacePart","At",{14,17}] ... Surely you can't be serious? ... Naming Matters: I think what and how we call things is underestimated ...
2
votes
1answer
68 views

How can an argument of the form f[t] be injected into the RHS of a function definition [duplicate]

This is what I want, for an arbitrary function x This is what I have done: ...
7
votes
2answers
110 views

Cannot Block Plus

It is customary to use the following idiom to partially evaluate something inside a held expression: ...
0
votes
1answer
50 views

The FindRoot output only with numbers [duplicate]

I have this code in Mathematica: FindRoot[{Sin[x - y + 2] - x == 0, Sin[2 x - z] - 8 z == 0, Sin[z + y + z] - 2 x == 0}, {{x, 0}, {y, 0}, {z, 0}}] where it's ...
0
votes
2answers
52 views

How to make Mathematica to assemble components we already have like a regular input

Suppose we have the following list: {5, 3} I want to add the -> to the end of the first element in the list in Mathematica ...
2
votes
1answer
92 views

How should I enter indexed terms? For example, constants $n_k$ for $k\in\{1,\,\ldots,\,N\}$

How should I enter $\quad \quad \sum^{N}_{k=0}{f(n_k)}$ into Mathematica? More generally, how should I work with the indices? Take the following as an example. I know how the ...
4
votes
1answer
59 views

Boundedness of an expression

First post on this part of the stackexchange network, I was just wondering if Mathematica allows one to quickly see if an expression is always within a certain range given values for the parameters it ...
1
vote
1answer
155 views

A question on using Cases [closed]

I am working on Wagon's FindRoots2D section. Clear[f]; f[x_, y_] := x - y^2 Cos[y]; g[x_, y_] := -y + x Sin[x]; fcnVec[{x_, y_}] := {f[x, y], g[x, y]}; I am ...
0
votes
1answer
70 views
1
vote
1answer
158 views

DownValues when using Set and SetDelayed

It is known from several questions asked in SE that one of the basic differences between Set and SetDelayed is that the former ...
0
votes
2answers
44 views

Equality of expressions containing complex numbers [closed]

I am using Mathematica to test the equivalence of symbolic expressions. I run into what appears to be a bug when I test the equivalence of expressions involving an imaginary number taken to a complex ...
3
votes
1answer
47 views

Order of evaluation of Exp and Normal on result from Series

This may be more math related than Mathematica related, but I thought this might be of interest to the group. I'm trying to work with some Taylor Series approximations of functions that are ...
7
votes
1answer
75 views

Is $ModuleNumber working properly on my machine?

In the documentation ref/$ModuleNumber, I read: Every Wolfram System session starts with $ModuleNumber set to 1. Yet, when I quit Mathematica 10.1 (OS X 10.10.4), restart it, open a new notebook ...
3
votes
3answers
146 views

How I can count multiplications in an experssion?

Next task to complete: Count *-symbol in such expression as a + s^2*b - c/y + o^3 + n*m*u (in this case count of ...
0
votes
1answer
86 views
14
votes
1answer
302 views

What's wrong with Simplify and FullSimplify?

I have a quite complex list of equations and inequalities I combine to a boundary condition for my cost function. After investigation of two days I found the bug (I really name it a bug!). One of my ...
0
votes
1answer
111 views

Draw a number of rectangles from list of coordinates [closed]

I'm new to Mathematica and this is also my first post here. Now for the question: I try to let Mathematica draw a number of rectangles from lists of coordinates. Unfortunately it only works when I ...
2
votes
2answers
131 views

What is the meaning of Range[10] /. {x_ /; PrimeQ[x] -> x^2}? [closed]

I'm currently doing a unit at university that touched briefly on Mathematica, but the final exam will feature multiple choice questions from Mathematica (along with excel and matlab). This leads to ...
10
votes
4answers
357 views

How to Thread with custom functions? Thread vs Map?

This function finds n given the nth prime: findPrime[n_] := If[PrimeQ[n], i = 1; While[Prime[i] < n, i = i + 1]; i, False]; This works: ...
6
votes
1answer
297 views

What is the relationship between Thread and MapThread

I hope this is not a silly question, since there are plenty of questions on Thread and MapThread. However, I still cannot quite ...