Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.

learn more… | top users | synonyms

0
votes
0answers
45 views

Order of evaluation for numeric functions

I'm trying to plot a 3D vector field to illustrate an electric field of a uniformly charged disk, and I used Manipulate to change the radius R of the disk to see ...
5
votes
5answers
220 views

Nested function with an increasing argument

If, for example, I have a nesting function like Nest[1 + x^n (#) &, 1, 3] it gives the result ...
1
vote
0answers
34 views

Save a Mathematica notebook evaluated [duplicate]

My notebooks can take some time to evaluate and by quitting Mathematica, I have to reevaluate every definition I've made once I restart Mathematica. Is there a way to tell Mathematica to save the ...
0
votes
1answer
123 views

Plotting two variables indirectly dependent on each other

I have the following system of linear ODEs for "i" number of species "c" migrating in "j" number of habitats: ...
18
votes
1answer
283 views

What is the difference between Dynamic[x] and Dynamic[ h[x] ] for DynamicModule variables?

Bug introduced in 9.0 or earlier and persisting through 10.4.1 Why plain Dynamic[x] is less sensitive and less likely to automatically be updated than e.g. ...
0
votes
0answers
92 views

Skipping sections of a notebook automatically

I have a notebook which allows to set some parameters at the start, and then does computations depending on these parameters. It is a long notebook and for readability it is broken up into sections ...
4
votes
1answer
54 views

How to adapt MSPToExpression function in $PrePrint?

I am introducing the mathematica Security (MSP module) to our system. The Document suggests use MSPToExpression as followed: ...
1
vote
1answer
39 views

Please explain this pattern/Message related issue and help with finding workaround

I attempted to clean up my code and also add messages to functions if they are called with wrong arguments. This introduced some error which I tracked down to the following: ...
1
vote
1answer
49 views

Evaluation of InverseFunction at the boundaries of its domain

Folks, I want to numerically evaluate a InverseFunction h[x] close to the edges x5 and <...
10
votes
4answers
338 views

How to take and evaluate a specific part of a list without evaluating the rest?

I have a large list, for example, lis = {x + y, x y, Sin[x] y + Exp[y], x^2 y} and its elements depend on variables x and <...
2
votes
0answers
44 views

Executing selected code [duplicate]

In current Mathematica interface, if I select some piece of code and press CMD + Shift + Enter, the code is evaluated in place. Replacing the selected part by the evaluated version. The question is: ...
0
votes
0answers
74 views

Memoization and upvalues

Can I store an algorithm to one variable and the result as an upvalue to another? With regard to the problematic code below (real algorithm and argument test omitted), I would like to store the ...
1
vote
1answer
56 views

Creating a keyboard shortcut to change the Style of text [duplicate]

I'm editing a very long text in a Mathematica notebook and I'm using the "Article" stylesheet. In this text, code is highlighted using ...
1
vote
1answer
49 views

Showing updating message in Dynamic with UpdateInterval

I am creating an interface which needs to repeat an operation every few seconds. The operation itself is expensive but faster than the update interval of the interface. I would like to have some ...
2
votes
2answers
89 views

PasteButton: Pasting expression name without quotation marks?

I am struggling to find a way to use PasteButton to paste the name of an expression (in particular a list) without showing the contents of the expression or without ...
2
votes
2answers
73 views

How can I use an InputField value as a variable name to save to?

I'm trying to save some settings and results from Manipulate, and I want to be able to save them to different variable names. The code I have is something like <...
11
votes
2answers
184 views

stop notebook evaluation when Assert fails

I would like a notebook evaluation to entirely stop when an Assert fails, without quitting the kernel. Is this possible (e.g., by setting ...
5
votes
1answer
55 views

How to evaluate following inputs only after finishing CreateDialog

I have a code which starts with the following Cell: ...
2
votes
1answer
121 views

How to properly define this function of function

I encountered real problem at first, and here is the toy example variable argument stored some expression that is generated from other parts of the program. I ...
1
vote
0answers
90 views

Meaning of Abs´? [closed]

A friend showed me the code below. r[i_] := {x[i, t], y[i, t], z[i, t]}; rji = r[i] - r[j]; solap = 2 a - Norm[rji]; FullSimplify[D[solap, t]] I'm unsure about ...
5
votes
2answers
108 views

Parallel function evaluation for minimal value

I am asking myself, if the evaluation of a function f looking for a minimal value over a discrete set of values can be parallelize (brute scan for a potential ...
2
votes
3answers
129 views

Evaluation inside a Manipulate

Let's assume I have a symbolic expression, and inside a Manipulate I define the actual values: ...
1
vote
2answers
64 views

Plot of function-generated lists: Why does this workaround not work?

My problem is a classic one: I want to plot a function-generated list, and there's no way to pre-evaluate (because the actual function includes NMinimize and thus ...
2
votes
1answer
113 views
0
votes
2answers
115 views

How to display results of NDSolve

I am solving differential equation of second order ...
2
votes
1answer
85 views

Errors in plotting regular function

Suppose we want to define Tanh-function via exponent: th[x_] := (1 - Exp[-2 x])/(1 + Exp[-2 x]); FullSimplify[th[x]] Out[13]= Tanh[x] Then we define new ...
1
vote
1answer
42 views

Aborting an evaluation automatically after a specified time elapsed

I use the following code to evaluate a series of notebooks: nb1 = NotebookOpen["C:\\Users\\....nb"]; SelectionMove[nb1, All, Notebook] SelectionEvaluate[nb1] ...
1
vote
1answer
58 views

How do I dynamically update “name” of Action Menu?

I have created an action menu that allows you to change the style of a cell. It works. However, I would like it to dynamically update the action menu "name". I can't get the name to refresh. ...
1
vote
2answers
60 views

Unpacking NumberForm expressions

Given a NumberForm expression, e.g.: NumberForm[N[Pi], 10] How does one get the underlying numerical expression (short of ...
1
vote
1answer
71 views

Trace and SameTest in Union [closed]

This question is actually two question. First, I feel so stupid that I just don't understand the use of theSameTest option in ...
1
vote
1answer
43 views

How to enable automatic “grammar check” for MMA? [duplicate]

The special evaluation mechanism of MMA might make it more likely for MMA users (especially new users) to make mistakes and more difficult to find them. For example, one may have defined a function ...
5
votes
2answers
324 views

Evaluate notebook from other notebook

I have a notebook ("notebook 1") which in the beginning sets some parameters, does something depending on their value and saves the result to a file, say: ...
1
vote
1answer
133 views

Why isn't Mathematica reducing my result to a number? [closed]

I do not understad why the program do not show the number values. Even when I use N[xx]. How can I simplify this?
5
votes
3answers
76 views

StepMonitor won't display Plot

This example is from the documentation under Monitor ...
0
votes
0answers
43 views

Evalutation strategy [duplicate]

This example code: ...
16
votes
3answers
287 views

Is it possible to change the order that symbol definitions are checked? (DownValues vs UpValues)

Suppose I have the function f with the following definition assigned to it: ...
4
votes
0answers
91 views

Simple arithmetic with Irrationals fails [closed]

While solving a simple puzzle that asked for a few calculations in plane geometry, I ended up with this expression: $-\frac{55}{2}+\frac{\sqrt{27233}}{2}+\frac{1}{2}(55-\sqrt{27233})$ Or, in ...
2
votes
2answers
81 views

Singleton pattern

How can I implement the singleton pattern in Mathematica in order to ensure that a symbol is not redefined if it's already defined ? This can be useful for example with global variables in packages ...
4
votes
1answer
401 views

mathematica does not evaluate without internet access? [closed]

I am watching the video Hands-on Start to Mathematica Basic Graphics and for about 15 minutes I was trying to evaluate $\frac{\sin x}{x}$ and each time I encountered errors like: The result can ...
17
votes
2answers
330 views
3
votes
1answer
64 views

How to evaluate an expression via `LinkWrite` when the expression is only known at runtime?

*** Here's the original post... I'm setting up a secondary kernel in sandbox mode with LinkLaunch, and need to pass various expressions to it for evaluation. These ...
1
vote
1answer
120 views

Evaluate multiple notebooks sequentially and automatically

I know how to run multiple notebooks at once. But my problem is that due to the RAM capacity, I have to run these notebooks consecutively. Another problem is that since I may not be in my office all ...
7
votes
1answer
145 views

How would one return from a place of a pure function's body using Return?

From previous answers, replies and discussions it is known, while not formally documented (even in the most recent Wolfram Language Documentation Center), that Return can be used in a two-argument ...
1
vote
2answers
154 views

After NumberForm I cannot apply a Sine function. Why?

After NumberForm I cannot apply a Sine function. Why? This works: sol1 = x /. Solve[x^2 - 3 == 0, x] Sin[sol1] Output = $\{-Sin[\sqrt{3}],Sin[\sqrt{3}]\}$ Also ...
0
votes
1answer
92 views

Special fractions generator

Note that 13/33, 1313 / 3333 , 131313 / 333333, ... They are always equivalent fractions Fraciones generate desire to have this property based arbitrary ...
5
votes
1answer
35 views

How could I set TimeConstrained globally?

I want to set TimeConstrained globally, I tried use $PrePrint as bellowed script: ...
1
vote
3answers
102 views

Keep leading/trailing zeroes (like Defer except with numbers) in a given number

I'm trying to write a function that counts the number of significant figures a given number has so I can ensure my calculations are rounded correctly; however, I am having a lot of trouble preventing ...
1
vote
1answer
50 views

problem about Root and Hypergeometric2F1

See these example, why does the output is different? ...
10
votes
1answer
462 views

A problem about the implementation of Bezier curve

I implemented the Bezier curve like built-in BezierCurve as follow: SplineDegree -> d specifies that the underlying ...
1
vote
1answer
55 views

How to achieve fun[Unevaluated[f][Unevaluated[x], Unevaluated[y]] in a more elegant way?

I have defined a function fun[f_[x_,y_]]. When I call it, I want to wrap everything by Unevaluated: ...