The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [core-language]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

I get different results with replacing the values with Replace all and manually replacing [on hold]

R[n_, l_, r_] := Sqrt[(n - l - 1)!]/Sqrt[(n + l)!] 2^(l + 1)/n^2 (r/n)^l Exp[-r/n]*LaguerreL[(n - l - 1), (2 l + 1), (2 r/n)] ...
0
votes
0answers
41 views

I need a starter kit for Differential Geometry

In Modern Cosmology, the Geodesic Equation is described as:$$\frac {d^2x'^2}{dt}+\left[ \left( \{\frac{\partial x}{\partial x'}\}^{-1} \right)^l_i \frac{\partial^2 x^i}{\partial x'^j \partial x'^k} \...
-1
votes
1answer
54 views

What is the problem in this program? [closed]

The output is showing running only. For[m = 0, m < 0.05, m++, For[a = 5, a < 20, a + 1, a1 = a*(a/2); x[m] = a1 ]; ];
26
votes
2answers
434 views

Using the Wolfram Language in a Commercial Product

Background I am currently consulting with a client that is using Mathematica to prototype a number of proprietary algorithms. Many man-hours of work have gone into the development of these algorithms ...
6
votes
3answers
472 views

Is $2x$ documented?

According to the official documentation of Times[], multiplication of $x$ and $y$ is represented as one of x*y x×y ...
2
votes
1answer
73 views

Question about iteration [closed]

I have the following expression: sol1 = (11 + 3*δ - 11*θ + 4*m*θ - 3*δ*θ - 8*Sqrt[(-(2 + δ))*(-1 + θ)*(1 - θ + m*θ)])/(4 + 4*δ) I want to plug numbers into $ \...
13
votes
1answer
195 views

Memory leak in the system function: how to free memory without restarting the kernel?

$HistoryLength = 0; Warming up: TextSentences[StringJoin@RandomChoice[Join[Alphabet["Russian"], {" ", "."}], 100]]; No ...
0
votes
3answers
76 views

Detecting errors and providing alternative results [closed]

I have the following piece of code: ...
2
votes
2answers
123 views

Vectors and Matrices

Mathematica makes no distinction between columns and rows. Yet, that is a BIG deal in the classroom. Does anyone have a source that explains how Mathematica manages to make every vector a list and ...
5
votes
1answer
287 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 <...
22
votes
1answer
219 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
82 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
71 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
49 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
676 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
138 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: ...
10
votes
1answer
583 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
146 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
220 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
223 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 ...
2
votes
0answers
32 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
128 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
334 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
55 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
546 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 ...
3
votes
1answer
75 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
106 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
33 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
60 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
138 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 ...
6
votes
2answers
99 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
52 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
70 views

Defining iterative algorithms [closed]

Assume the iterative algorithm of interest to be as follows: ...
3
votes
2answers
74 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
122 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
61 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
160 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
69 views

Inspecting Mathematica object

I'm using ProofObject for my question, but it applies to other objects too. FindEquationalProof returns ...
1
vote
0answers
65 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
359 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
46 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
62 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
444 views

Can we make a faster Boole implementation?

I just learned about Mr. Wizard's very efficient code here. ...
1
vote
3answers
127 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
57 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 ...