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

learn more… | top users | synonyms

2
votes
1answer
45 views

Problems with QueueingNetworkProcess [on hold]

I have a two stage queueing network and want to vary the number of servers at the second node. The input data and the Manipulate command is below: ...
295
votes
26answers
46k views

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
0
votes
0answers
63 views

Advice need on my use of Slot in a pure function [closed]

This is the code that someone gave me (Many thanks MarcoB) But it looks wrong to me, since I want this $$\begin{cases} a=C_1C_2R^2 \\ b=2RC_2 \end{cases}$$ ...
4
votes
1answer
163 views

Goal optimization: finding the best combination of capacitors and resistors resulting in given properties

I want to edit @MarcoB answers (because the code he gave doesn't answer the question appropriately)->(the function that need to be optimised is not implemented as asked) But it seems like I am having ...
0
votes
1answer
94 views
2
votes
0answers
25 views

why does ReadString[“fname”,term] open a persistent stream, and how to close it?

Create a file temp.txt with the following content: test1 ;;; test2 ;;; test3 ;;; Treating the semicolon sequence as ...
6
votes
1answer
320 views

Battery charge simulation not clipping properly as it iterates

My code for simulating a batterylevel-state throughout a year in 15min-steps doesn't work. There is a certain list-inputs which simulates the charge state and the batterylevel-state, additionally ...
8
votes
3answers
101 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 ...
0
votes
1answer
59 views
14
votes
3answers
212 views

ReplaceAll with Associations instead of Rules

I have just noticed that x /. <|x -> 123|> evaluates to 123 In other words, the association seems to behave as a ...
54
votes
1answer
1k views

Incompatible Changes since Mathematica Version 7?

There is documentation of the incompatible changes made to Mathematica with each major release: Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped ...
5
votes
0answers
62 views

How does Plus work on machine precision Real arguments?

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8  ...
7
votes
3answers
129 views

DSolve—different solutions for same set of equations using different symbols?

I happen to find that DSolve can give different solutions, even a different number of solutions, for a set of differential equations just by making a change in the ...
15
votes
3answers
197 views

Resolving my Entity* Crisis

In the Wolfram Language I can usually guess a function's name, operation or idiomatic application but I don't have such a sense for various Entities ... ... instead, I seem to keep needing to ...
5
votes
2answers
155 views

Why this upvalue doesn't escape from Sum?

Probably a hard question, but I decide to cry out loud :). This is actually another problem I encountered when answering this question. Consider the following transform rule stored as an upvalue: ...
6
votes
4answers
915 views

How can I avoid using a For-loop in my code?

I am trying to avoid using For because I heard that For is not cool in functional programming. Below is a problem that the first ...
4
votes
2answers
83 views

How can I extract something from an expression and assign it without changing the expression?

I am researching how to extract a certain value from an expression by using a pattern mechanism without actually changing the original expression. The paragraph above could be very ambiguous, so here ...
104
votes
3answers
5k views

How to make use of Associations?

I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
1
vote
2answers
66 views

How can I define operators that have the behavior I want? [closed]

I need to define some operators with properties like idempotence and distribution over union and intersection so that Mathematica can symbolically simplify expressions. How do I define such operators? ...
3
votes
1answer
37 views

How can I perform arithmetic on a list integers and some other exact numbers and get decimal numbers in the result?

I want to do a simple calculation with a list with Pi and 10^-6 and get a list of decimal numbers as the result. ...
1
vote
1answer
152 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
1answer
49 views

Can anyone tell me what f[[1,1,2]] is doing? [closed]

equ = DSolve[y'[x] == x + y[x], y[x], x]; y[x] /. equ; f = equ[[1, 1, 2]];
4
votes
2answers
130 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
349 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 ...
0
votes
2answers
107 views

Using 0 < x < 10 as a condition in an equation

How do I write 0 < x < 10 on the right side in the equation. If #1 + #2 is bigger than 0 and smaller than 10. And is it possible to require -10 < x < 10 with the additional condition x != ...
3
votes
1answer
97 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 ...
7
votes
1answer
79 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
59 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
164 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
49 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
163 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
89 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
38 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
40 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. ...
14
votes
0answers
156 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
87 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
56 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
6
votes
2answers
249 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
52 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
73 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 ...
5
votes
5answers
483 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that ...
4
votes
1answer
60 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
35 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
246 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
272 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
399 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
63 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: ...