Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [core-language]

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

2
votes
1answer
67 views

Operator currying: how to convert f[a,b][c,d] to {a+c,b+d}?

This question is related to this golfing question (but I'm not interested in golfing, only in functional operator composition): How can we convert f[a,b][c,d] to <...
0
votes
0answers
60 views

What does D mean? [on hold]

I am using Wolfram Cloud for do my homework. I got the following result from a matrix multiplication. ...
19
votes
1answer
162 views

Possible Memory Leak Issues in NestWhile

Consider the following code snippet: NestWhile[{#[[1]]+1,Pause@.001;ConstantArray[0,{100, 100}]}&, {1}, (#[[1]] <= 10000) &, 2] In theory, when ...
2
votes
1answer
78 views

Basic question regarding returning values from user-defined functions [closed]

I'm new to Mathematica today. I would like to write a function that will implement the following pseudocode: f[x_]:= Do something return y I have searched ...
6
votes
1answer
55 views

Can I stop a running NDSolve calculation without losing the data it obtained so far?

I would like to solve a system of ODEs numerically using NDSolve on an interval {t,t0,tf}. For the systems I currently solve, ...
1
vote
0answers
41 views

Can I store output data in the Notebook file? Specifically output from NDSolve[ ]

I am having some outputs from NDSolve of the form {{x→InterpolatingFunction[…], y→InterpolatingFunction, … }} and the ...
7
votes
1answer
371 views

The Wolfram Kernel must be activated for WolframScript to use it

I'm using the free Wolfram Engine for developers, but somehow I cannot activate it. ...
3
votes
2answers
127 views

Print characters from list with a For-loop

Suppose I have the list primary = {"b","a","e"} I want to get the following output with a For-loop (or While-loop) "b" "a" "e" My code is: ...
7
votes
1answer
465 views

Row vectors and column vectors (Mathematica vs Matlab)

As far as I know, Mathematica does not distinguish between row vectors and column vectors: all vectors are seen as lists. I know ways to bypass this as suggested here Product between a column vector ...
1
vote
1answer
120 views

Error plots in MMA 12.0

Suppose I have the following data and associated quartiles: data = RandomReal[{0, 1}, {40, 10}]; qs = Quartiles[data] I want to make an ErrorListPlot from the ...
11
votes
2answers
211 views

Selecting elements from a list where the order is set by another list

I have two lists, list A and list B. All of the elements of A are members of ...
8
votes
2answers
215 views

Surprising behavior of Part[ ]

Look at this list list={1,2,3,4} Obiously list[[1, 2]] throws the error: During evaluation of Part::partd: Part ...
1
vote
0answers
24 views

one Dataset from multiple csv files

In one folder I have many csv files, all sharing an identical header. I can use SemanticImport to produce a Dataset from each ...
0
votes
1answer
120 views

How can I translate some JavaScript code into Mathematica code? [closed]

I am a programmer and would like to understand another field outside of the procedural thinking of if-else and for. I would ...
16
votes
2answers
285 views

Around usage results

Why is Around[10, 1]^2 +- 20 and Around[10, 1] Around[10, 1] giving 100 +- 14 ? Just curious I would suspect them to ...
0
votes
1answer
53 views

Deriving a list of time differences from a column in a dataset and appending the list as a new column

I know it's a beginner question, but I've struggled with it for some time now and can't find a solution. I have a dataset consisting of timestamps, where I've managed to compute the time differences ...
10
votes
4answers
532 views

What is the accessibility of a package's `Private` context variables?

I've been reading up on how Mathematica handles contexts, $Context, $ContextPath, and a few of the tutorials they have on ...
2
votes
1answer
69 views

How to trace value assigned to local variable(variables in Module)?

Bug introduced in v10.1 or earlier and persists through v11.3 CASE:4240757 Here is my code: ...
1
vote
0answers
90 views

Design completion idea for Position [closed]

This is not exactly a question but rather a suggestion for a design which I think would greatly improve Mathematica. Before I put this to Wolfram Research I would like to see what other people think ...
1
vote
2answers
102 views

Computation with arrays of numbers

My code is m = RandomVariate[NormalDistribution[], 100]; c = 0.1; f1 = RandomVariate[NormalDistribution[], 100]; F = Sqrt[c]*m + Sqrt[1 - c]*f1; I would like to ...
0
votes
2answers
31 views

My function for computing a partial derivative generates an error message [closed]

Apologies, I'm still new at Mathematica. I have defined the function ...
1
vote
2answers
59 views

Using a Do-loop to find divisors mod 13 [closed]

I want to check sum of divisors of i mod 13 fori = 1 to i = 20. I tried writing a Do-Print ...
10
votes
1answer
137 views

Why does Success[…][key] work and Failure[…][key] doesn't work?

I'm trying to figure out what is a quick way to add error reporting to my user defined functions. I was experimenting with Success and ...
5
votes
2answers
91 views

Converting prefix to infix

Is there a way in Mathematica to convert prefix to infix notation (where precedence order is preserved)? For example, how would I convert S[a, S[b, c]] to ...
3
votes
1answer
51 views

Is using Length more efficient than using === as stopping criterion?

I am using NestWhileList[ f[#, elems]&, pairs, Length[#1]<Length[#2]&, 2, Infinity, -1 ] to generate all suitable subsets from ...
1
vote
2answers
88 views

Change the output for `Times`function

When I have an input like: 1/2*k The output is: How to change the output of Timesfunction to see this result: Another ...
1
vote
1answer
65 views

Defining iterative algorithms [closed]

Assume the iterative algorithm of interest to be as follows: ...
3
votes
2answers
69 views

Iconize behaves in a confusing manner

When I evaluate Iconize[Range[10], "range10"], it returns an icon labled "range10", which if evaluated returns ...
12
votes
2answers
120 views

Bad Float Counts? (Length[xs] != Total@Counts[xs])

In Mma 11.3, tallying floats with Counts seems to fail. (Tally works fine, and rounding fixes the problem.) Is this behavior ...
1
vote
1answer
37 views

using strings from a header row as “pointers”

Suppose I have a list like: data={{"product","amount","price"},{"A",1,100},{"A",3,100},{"B",5,200}} I could use a Map to calculate over each row the "amount" * "...
0
votes
0answers
60 views

Implementing a function that exhibits linearity

I am trying to define a function $\mathbb{E}_t$ such that $\mathbb{E}_{t}[f[x_{s}]] = f[x_{s}]$ if s<=t, and $\mathbb{E}_{t}[f[x_{s}]] = \mathbb{E}_{t}[f[x_{s}]]$ if s>t. $\mathbb{E}_{t}$ is ...
0
votes
0answers
88 views

Is there a direct way of adding two random step size lists

As shown in the figure, I have three lists a,b and c. I want to see whether a + b +C0= c(here C0 is a constant). Since list a and b have varing step size (...
6
votes
2answers
148 views

Flat attribute : example I don't understand

I am just beginning to learn about attributes of function in mathematica. I saw the example "Flat". But there is something I don't get : ...
2
votes
1answer
65 views

Inspecting Mathematica object

I'm using ProofObject for my question, but it applies to other objects too. FindEquationalProof returns ...
1
vote
0answers
64 views

Is there packages can help read, analyze or understand MMA codes? [closed]

Sometimes, I think that it's difficult to learn high level codes, or even when looking back on some long lines of codes I myself had written, espectially when lots of pure-functions was used, so I'm ...
5
votes
3answers
335 views
6
votes
1answer
64 views

unexpected result from augmented assignment to association

Is the last of these results expected? If so, how? ...
1
vote
0answers
41 views

raise error on type mismatch

Is there a best practice for raising an error on a type mismatch? For compiled functions I'm guessing the answer is the use of GeneralUtilities`WithMessageHandler. ...
3
votes
1answer
57 views

Module - Symbols out of scope of lexical scoping

The Problem Consider the following code (1): In[1]:= x = 2; Module[{x, y}, y[x_] = x; y[1] ] Out[2]= 2 I expected the answer ...
7
votes
2answers
433 views

Can we make a faster Boole implementation?

I just learned about Mr. Wizard's very efficient code here. ...
1
vote
3answers
108 views

Unable to implement bisection method using recursion [duplicate]

I have tried to implement a bisection method for finding roots using SetAttributes[BisectionItt, HoldAll] and then ...
0
votes
0answers
55 views

How can I better formulate a conditional statement?

To solve optimization problems I have seen this: Is there a more elegant way to do this with alternative conditional expressions? Is there something equivelant to ...
4
votes
1answer
50 views

Is it possible to write an expression A such that Evaluate[Evaluate[A]] is different from Evaluate[A]?

Mathematica is cool for all sorts of "magic tricks", but I'm trying to get an idea on how the core term-rewriting system works. Is it possible to make a term such that the output of its evaluation can ...
17
votes
1answer
302 views

Distinguishing Wolfram Language and Mathematica, the software

Which features are part of Mathematica, the software, and which features are Wolfram Language? I would say there has to be a line discriminating the two somewhere. One could say that Mathematica, in ...
14
votes
3answers
207 views

What is the difference between Set and SetDelayed when evaluating the RHS leaves it unchanged?

I thought there was no difference between f[a_] = 2 + a; and f[a_] := 2 + a; because the resulting ...
3
votes
1answer
110 views

Why did Set work instead of SetDelayed?

I started with the following expression a[t_] := -Pi Sin(Pi/2*t) where initial velocity is 2 Pi and initial distance is 1. ...
4
votes
1answer
58 views

How can I evaluate only the (bound) variables in an expression?

Given an arbitrary expression, how can I have Mathematica only evaluate the (bound) symbols, i.e. replace them by their respective values, but not do any further simplification/evaluation of the ...
0
votes
1answer
34 views

FunctionExpand vs FullSimplify

The documentation (v.11.3) says: "FunctionExpand is automatically called by FullSimplify." Why then does ...
1
vote
1answer
44 views

undesirable/buggy change in behavior of Limit in Mma 11.2?

The behavior of Limit changed in Mma 11.2, and I think it is in some ways undesirable or possibly buggy. Consider ...
1
vote
1answer
78 views

What resources can I use to become familiar with high level syntax?

I was reading a question about dropping higher order terms and realized that I have a serous gap in knowledge when it comes to the finer points of mathematica computational programming. Are there any ...