As of May 31, 2023, we have updated our Code of Conduct.

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
1 vote
2 answers
101 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 ...
Mateus's user avatar
  • 1,223
1 vote
1 answer
87 views

Defining iterative algorithms [closed]

Assume the iterative algorithm of interest to be as follows: ...
BayesIsBaye's user avatar
4 votes
2 answers
143 views

Iconize behaves in a confusing manner

When I evaluate Iconize[Range[10], "range10"], it returns an icon labled "range10", which if evaluated returns ...
George Wolfe's user avatar
  • 5,412
12 votes
2 answers
127 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 ...
Alan's user avatar
  • 13.1k
1 vote
1 answer
45 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" * "...
Lou's user avatar
  • 3,740
0 votes
0 answers
67 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 ...
cheng liu's user avatar
0 votes
0 answers
95 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 (...
wind1239's user avatar
6 votes
2 answers
265 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 : ...
StarBucK's user avatar
  • 2,085
3 votes
1 answer
156 views

Inspecting Mathematica object

I'm using ProofObject for my question, but it applies to other objects too. FindEquationalProof returns ...
Max's user avatar
  • 291
1 vote
0 answers
85 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 ...
Jerry's user avatar
  • 2,399
5 votes
3 answers
542 views

How to put the variable in a certain order after using "Solve[]"

I have this code: ...
Jose Castellanos's user avatar
6 votes
1 answer
67 views

unexpected result from augmented assignment to association

Is the last of these results expected? If so, how? ...
Alan's user avatar
  • 13.1k
1 vote
0 answers
113 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. ...
Alan's user avatar
  • 13.1k
3 votes
1 answer
125 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 ...
Max1's user avatar
  • 1,115
8 votes
2 answers
479 views

Can we make a faster Boole implementation?

I just learned about Mr. Wizard's very efficient code here. ...
Ted Ersek's user avatar
  • 6,924
1 vote
3 answers
458 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 ...
Oamar Kanji's user avatar
0 votes
0 answers
70 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 ...
Jim Clarke's user avatar
4 votes
1 answer
65 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 ...
user3257842's user avatar
17 votes
1 answer
459 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 ...
Johu's user avatar
  • 4,846
14 votes
3 answers
246 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 ...
MeMyselfI's user avatar
  • 1,116
3 votes
1 answer
250 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. ...
Isaac Ayele's user avatar
4 votes
1 answer
74 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 ...
Roland Salz's user avatar
0 votes
1 answer
48 views

FunctionExpand vs FullSimplify

The documentation (v.11.3) says: "FunctionExpand is automatically called by FullSimplify." Why then does ...
Alan's user avatar
  • 13.1k
1 vote
1 answer
56 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 ...
Alan's user avatar
  • 13.1k
1 vote
1 answer
83 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 ...
Brandon's user avatar
  • 95
1 vote
0 answers
61 views

What use is empty binding list in `Block[{},...]`? [duplicate]

Spelunking the Export function, I stumbled upon the following definition: ...
kkm's user avatar
  • 784
12 votes
1 answer
215 views

stable sort for association?

Should I be able to use the "list of functions" approach to getting a stable sort of an association? In 11.1 I see, ...
Alan's user avatar
  • 13.1k
7 votes
1 answer
145 views

advantages of ApplySides?

Version 11.3 introduces ApplySides for situations where I usually use Map. What is an example where ...
Alan's user avatar
  • 13.1k
3 votes
0 answers
385 views

How to achieve with Mathematica the effect a closure has in other languages?

Motivation I want to write an auxiliary function (brief auxf) for testing the output of another function that evaluates its body repeatedly using ...
user42582's user avatar
  • 4,115
6 votes
1 answer
143 views

Is (x|y|...)∈set the same as x∈set&&y∈set&&...?

I've sometimes seen that this operator is used to specify that each of given variables is in some set, e.g. Reals. Like ...
Ruslan's user avatar
  • 7,082
13 votes
2 answers
176 views

Can a Symbol have more than one OwnValue?

The DownValues, UpValues, and OwnValues functions are all plural. In general, a Symbol may ...
Robert Jacobson's user avatar
4 votes
1 answer
123 views

SetDelayed not working as expected

According to the manual, "A variable defined with SetDelayed is evaluated every time it is used". The code below suggests otherwise. ...
Hector's user avatar
  • 6,408
13 votes
1 answer
554 views

Check if symbol is in core language

How can I check if a symbol is pre-defined by Mathematica, in a way that's backwards compatible with old versions? i.e. I would like some CoreLanguageQ[x_Symbol] ...
Joe's user avatar
  • 1,278
1 vote
1 answer
186 views

Convenient value assignments in OOP

It is possible to implement OOP in Mathematica using something like obj=c[<|a->1,b->2|>] and it's convenient to extract value from the object by ...
Wjx's user avatar
  • 9,373
0 votes
0 answers
35 views

How can I extract the numerical value from the result of FindRoot [duplicate]

I've to use previous values of FindRoot to implement my program (recursively), but the type of the output from FindRoot is not a number. How can I extract the ...
Pagode's user avatar
  • 121
4 votes
3 answers
189 views

Keep only rules that replace integers with other integers

Let's say I have a list of replacement rules: List1 = {2 -> 3, b -> 5.5, 6.57 -> 2, 3 -> 4.5, 1 -> -1, 0.03 -> 0.5, 9 -> a} The desired ...
am111's user avatar
  • 43
0 votes
2 answers
78 views

Numerical integration with a fixed sampling size, skipping points [closed]

I have a large number of data points to integrate over numerically. I would like to sample only some of the points and use a rather large step size just to reduce computation time. Say the data ...
Rethliopuks's user avatar
0 votes
2 answers
207 views

NIntegrating in $n$ dimensions?

I need to make a function that takes a function $f$ and a natural number $n$ and returns the integration from -inf to inf in all the $n$ dimensions of $f(x_1,\cdots,x_n)$. With Integrate I would do ...
Garmekain's user avatar
  • 299
1 vote
1 answer
88 views

any possible meaning to a "terminal" slash (/)? [closed]

I've been directed to the web page http://functions.wolfram.com/07.31.16.0001.01 The first statement in the formula is ...
Paul B. Slater's user avatar
-4 votes
1 answer
156 views

how can i convert my matlab conde into mathematica or atleast convert the bisection program? [duplicate]

(Convert matlab code into mathematica code) (I'm fairly new to mathematica) (bisect function matlab code:) ...
marisol's user avatar
0 votes
1 answer
88 views

SplitBy and mod 2 [closed]

I wish to group semiprimes into groups with same parity. Mathematica does this well with SplitBy[ Select[ Range@ 100, PrimeOmega@# == 2 &], Mod[#, 2] &] ...
Robert G. Wilson v's user avatar
18 votes
2 answers
1k views

Why it seems that there is no counterpart function as to multiplication, to `Total` as to addition?

Times and Plus have the same grammar, and so do Product and ...
Αλέξανδρος Ζεγγ's user avatar
0 votes
1 answer
108 views

Why 1 is not recognized as real? [closed]

I'm not understanding smth simple. Why is 1 not recognized as a real number in the second line?
mavzolej's user avatar
  • 683
3 votes
2 answers
657 views

Writing a bisection root finder

I'm trying to make a simple function that will calculate roots of equations by using bisection method. My code isn't working right. Can anyone take a look and help me? Here is the code: ...
user57225's user avatar
  • 101
10 votes
1 answer
454 views

What does the ToList function do, and where did it go?

I am trying to revive some code from 2015 (version 10?) which uses the function ToList. I can not find it defined in any notebook on my system (in fact, it only ...
Daniel W's user avatar
  • 3,386
-2 votes
3 answers
270 views

Convert pseudocode into Wolfram Language [closed]

Pseudocode: ...
M. Ali's user avatar
  • 23
11 votes
2 answers
1k views

Can't understand one paragraph in Power Programming with Mathematica

In the chapter 7 of the Power Programming with Mathematica, there is a paragraph discussing the behavior of Set- functions: (page 205. (pdf version p. 224)) ...
Eric's user avatar
  • 1,181
1 vote
0 answers
39 views

Is Construct introduced to replace Function application? Should it be treated as such an alternative?

I noticed that v.11.3 got released the other day; it was exciting so I went through the Summary of New Features in 11.3 to catch a glimpse of what's new and see if there is something I should keep in ...
user42582's user avatar
  • 4,115
0 votes
1 answer
881 views

Why is Null printing?

I am making a function that will evaluate several other functions, using the same inputs, in my program and give me the results. I am using Print to do this (see ...
Kenneth Eaves's user avatar
2 votes
1 answer
186 views

Can the pattern "_." be used in head?

The standard usage of the pattern _. seems usually used in the parameter, for example, f_[a_,n_.]. I wonder if such pattern can ...
Eric's user avatar
  • 1,181

1 2 3
4
5
12