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

learn more… | top users | synonyms

4
votes
2answers
134 views

ReplaceRepeated as a Looping construct?

There are a lot of discussions about looping constructs (notable example here). Wolfram language guides, as usually, contain most relevant links. Looping constructs guide has the following part on ...
18
votes
2answers
355 views

What does f_[whoCalled]^:=f really mean?

I came across the following post by John Doty in this Google Groups discussion: On Friday, January 11, 2013 8:23:16 PM UTC-7, amzoti wrote: It is clear the Mathematica uses Lisp as one ...
3
votes
1answer
111 views

How to check and reset the boolean value of many options one times?

I defined a function which owns many options. In addtion, these options have a common characteristic. Namely, only accepting boolean value True or ...
9
votes
1answer
87 views

Strange behavior of UpSetDelayed together with MakeBoxes

In order to answer this question, I just stumbled into the world of UpValues. Though I managed to find a solution for the problem, I'm confused by my own code now ...
3
votes
0answers
67 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
181 views

Why assign variables to empty curly brackets?

I am trying to read code and I see empty curly brackets. For example: abc = {} or ...
6
votes
0answers
50 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
170 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
94 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
39 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
45 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. ...
1
vote
2answers
123 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 ...
2
votes
1answer
58 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
294 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
53 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
80 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
499 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that ...
4
votes
1answer
69 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 ...
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? ...
5
votes
2answers
249 views

Issue with Set function

Tables often come with column headers. Indexing the columns with the header is a natural thing to do. Although a proper dictionary is the usual solution in such a case, I find it often practical and ...
6
votes
2answers
281 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
487 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
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: ...
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: ...
27
votes
2answers
462 views

Performance regression for Fold?

I noticed an over 10x performance drop on Mathematica v9.0.1 (as Oleksandr R. commented, also v8) compared with v7.01 for this code: ...
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
421 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 ...
0
votes
1answer
132 views

Help with functions in Mathematica

I'd like to make a function that has many parts. Doing this in something such as Java, which I am familiar with, would be simple. In Mathematica I have these "pieces", which I want to put into a ...
3
votes
4answers
225 views

How can I make a summary of all the commands of Mathematica?

I would like to have a simple way to get summary information about all the many commands built into Mathematica. How could I do this? Is there a site I may refer to?
1
vote
0answers
20 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: ...
43
votes
4answers
790 views

What's the difference between Inactive and HoldForm?

In version 10, Mathematica not only added Inactive / Activate but also highlighted this change in the "New in 10" page (in Core ...
9
votes
2answers
235 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 ...
2
votes
1answer
65 views
1
vote
0answers
76 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 ...
27
votes
2answers
617 views

Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
7
votes
2answers
109 views

Cannot Block Plus

It is customary to use the following idiom to partially evaluate something inside a held expression: ...
0
votes
1answer
47 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
1answer
94 views

solving quadratic and linear congruences with different modulus

We are able to solve the quadratic congruences $C^2 + Q^4 - 2\equiv mod 3072$ and $C - Q^2 - 2046\equiv mod 3072$ by entering ...
0
votes
2answers
51 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
89 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
58 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
2answers
42 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
46 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 ...