Questions tagged [evaluation]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
126 views

ReplaceAll does not work

Why ReplaceAll does not work in this situation? ...
6
votes
1answer
53 views

Why does `$Pre` need to be defined indirectly via some other function?

The documentation for $Pre gives the following example ...
5
votes
2answers
94 views

Obtaining head and parts without evaluation

I have been trying to write a routine MyHead and MyPart which would have the following properties. MyHead[2+3] evaluates to Plus ...
0
votes
1answer
66 views

Evaluation functions with lower and upper limit ODE?

How do I find the numerical value of y at 0 and also at 1. Here is my code. I appreciate any help. ...
1
vote
1answer
63 views

Respecting excluded index in sum

I'm using a function involving a sum where some indices are excluded: ...
0
votes
2answers
56 views

Can anyone please help me to plot the following list of complex values?

I tried to plot the complex values in Mathematica using the following code ...
1
vote
2answers
90 views

Why is this not False? (SameQ,Equal, Set) [duplicate]

How can we understand why Mathematica does not evaluate this expression to False? {{1, 2, 3, 4}, {4, 3, 2, 1}} == 0
1
vote
1answer
90 views

ReleaseHold and Get

I've created a try.m file which has the following structure: { Hold@{a+b+c}, Hold@{a^2+b^2} } On my main code I do: <...
3
votes
2answers
108 views

Inconsistency between Plot and NIntegrate

Have a look at the following definition Y[q_, w_ /; w < 0] := 0 Y[q_, w_] := w The function Y is zero for negative ...
8
votes
1answer
2k views

What is -(-2,3,4)?

I was trying to define a function f such that, when its second argument is negative, we have $$ f(a,b,c,d,\dots,n)=f(a,-b,-c,-d,\dots,-n) $$ i.e., we reverse the ...
1
vote
1answer
105 views

How to Open, Evaluate and Close the same Notebook 100 times in a row?

I have a Mathematica notebook which I Open and Evaluate by hand. It Exports some data and then Closes. I now wanna Open, Run and Close the exact same Notebook 100 or 1000 times in a row to get a lot ...
2
votes
1answer
74 views

Open, Evaluate and Close notebooks sequentially

I wanna Open, Evaluate and Close notebooks sequentially. Code from question here ...
4
votes
3answers
445 views

How do pure functions differ from functions defined with SetDelayed?

Why is it that f[{{a_, b_}, {c_, d_}}] := (a z + b)/(c z + d) will return (2 + z)/(4 + 3 z) on evaluating ...
7
votes
0answers
94 views

How useful is $SynchronousEvaluation?

Example SessionSubmit @ Print @ $SynchronousEvaluation Will print False even though ref/SessionSubmit/Details last point: ...
2
votes
0answers
33 views

Do not evaluate function inside of another function for simplification

Consider the simple example : ff[x_] := x^2 gg[x_] := (ff[x] - ff[-x])^2 Let's assume I would like to expand g[x_] as a polynome of ff[x] and ff[-x], but I don'...
13
votes
1answer
243 views

Scheduled tasks and dynamic updating

Here is an example: x = 0; Dynamic[x] now please run: SessionSubmit[x = 1; Pause[10];] Problems: Annoying one: ...
0
votes
1answer
182 views

Evaluating function before its plotting

Suppose I want to plot a function $f(x,y)$ but first need to calculate its symbolic expression. An easy solution is to copy the output of my calculation by hand and then paste into ...
1
vote
2answers
63 views

NMaximize selects duplicate inputs and a problem with EvaluationMonitor

The aim of the following is to maximize 'penalty' and monitor it for convergence during the process: ...
0
votes
1answer
36 views

Constructing sequence of function with elements depending on the previous one / recursion

Starting from a function $\theta0[x\_ , y\_ , z\_ ]$, the terms $\varphi[x\_ , y\_ , z\_ ]$ constitutes a sequence of functions that is constructed as follows: Order 1 (one function and its ...
0
votes
1answer
36 views

Evaluate list queries inside `HoldForm[]` terms

When I have an equation like (example)... ...I can derived it and turn it into TeXForm afterwards (that is what I want). Therefore, I might want to additionaly ...
0
votes
2answers
85 views

First ReplaceAll, then evaluate an expression

Here is a simple example using ReplaceAll: rvec[[2]] /. rvec -> {x, y} I think Mathematica first tries to evaluate ...
0
votes
1answer
77 views

Evaluation Control for Equation Input to NDSolve

I am trying to numerically integrate a system of equations using NDSolve and am having issues with symbolic matrix inversion taking a long time. The actual system is much more complicated, but I have ...
7
votes
1answer
85 views

New input cell style with a custom evaluator

I'm interested to implement a custom input style which would appear (mostly?) like a normal "Input" Cell, but which would ...
2
votes
0answers
94 views

Why was implementation of “Exponent” changed since version 11.3? [closed]

I have a following expression and need an exponent of n Exponent[Exp[Sqrt[n]]*n^2, n] (* 2 *) Exponent[Exp[Sqrt[n]]*n, n] (* 1 *) All versions 7,8,9,10 up ...
0
votes
2answers
77 views

Can ComplexInfinity output be trusted?

A quick question regarding evaluation of algebraic expressions at specific values. If for instance I enter (x + 1) (x + 2)/((x + 2) (x + 3)) /. x -> -2 ...
1
vote
1answer
61 views

Why is this NDSolveValue function remembering past inputs?

I have been attempting to generate a function that uses NDSolveValue to return the value of a solution to a system of ODE's when an event condition is triggered, as a function of the initial ...
0
votes
1answer
87 views

Variable nesting depth inside table

I hope my title makes sense. The idea is the make a function in which a set of variables, $l_1$, $l_2$, etc. are accessible inside the innermost body of a nested (/folded) function. Each of these ...
10
votes
2answers
241 views

How to explain the behaviour of TreeForm? [duplicate]

Just try this: g=1;a=1;TreeForm[Hold[g[a]]] The weird thing in the outcome is that the node of g displays 1 ,and a is still a. I do not know how to explain ...
0
votes
1answer
26 views

Comparison between Point And EmptyRegion

My aim is to evaluate the length of a line segment lying inside a sphere. Code ...
0
votes
1answer
66 views

Function that refuses to return a value

I wanted to know the exact solution to the following differential equation $$ \frac{\mathrm{d}^2 y}{\mathrm{d} t^2} = - \frac{1}{y-1}, \quad \begin{aligned} y(0) &= 0 \\ \left. \frac{\mathrm{d} y}...
4
votes
1answer
183 views

Cell Bracket Clarification

I am running a very simple program that uses NotebookEvaluate to evaluate an open notebook that only has the context of saving and closing, and while it completes that task, the program gets stuck in ...
4
votes
2answers
1k views

How to prevent Mathematica rounding extremely small numbers to zero?

I have a function that, while the maths itself is unimportant, at certain values it results in a very large number multiplying a very small number. E.g. 10^450000 * 10^-449998. As you can see, this ...
6
votes
1answer
128 views

RegionPlot3D no longer localizes its arguments?

Bug introduced after 9, fixed in 12.0. Just now, I was astonished to find the behavior of RegionPlot3D changes somewhere after v9 . Consider the following sample: ...
0
votes
2answers
129 views

How to get the derivative with StepMonitor?

I am trying to use StepMonitor inside of the NDSolveValue function for a complicated system of differential equations, but the simple example below shows my issue just fine. I am trying to obtain ...
6
votes
1answer
631 views

How to monitor a big program?

Is it possible to know how much % of calculations are done in a big program? In other words, % will increase gradually when the calculations are progressing. I want to see the %.
5
votes
5answers
369 views

How to factor all coefficients of a multivariable into prime factors

I have several polynomials in 2 variables with integer coefficients, e.g., poly= -10 x - 10240 y^3 - 1520 x y^4; I'd like to convert all such polynomials into a ...
12
votes
2answers
272 views

Unexpected behavior of the procedure `Area` on the object 'Polygon'

Bug introduced in 11.3 or earlier and fixed on 12.0. Sometimes get a results, sometimes left unevaluated. For instance ...
3
votes
2answers
86 views

Keep element of formula as it is

I have ClearAll["Global`*"]; de = f''[y] - (n^2 \[Pi]^2)/(4 a^2) f[y]; DSolve[de == -q/S (4/(n \[Pi] b))(-1)^((n - 1)/2), f[y], y] and I would like the $(-1)^{(n ...
2
votes
1answer
100 views

Why is Mathematica “de-evaluating” my expressions when I try to generate a Table? [duplicate]

I am attempting to plot a combination of StreamPlot and ParametricPlot that is a function of a parameter. When using Manipulate or Animate, the evaluation is slow but the graphs are outputted as ...
2
votes
1answer
67 views

Why can't I execute other commands while the dialog is running?

Bug introduced in v10.4 or earlier and persisting through 11.3 CASE:4226661 The code is from the following video: http://www.wolfram.com/broadcast/video.php?sx=Ian%20Johnson&v=2076 ...
2
votes
0answers
66 views

Wrong result using “numeric” symbols

Recently I stumbled upon a weird bug when I used a package that sets the NumericQ result of symbols you are feeding into a certain function to true. Here is a minimal working example of what I mean: ...
3
votes
1answer
110 views

Correct way to make groups of cells (not) evaluable

Let us say that I want to make all the cells within a section not evaluable. In principle, I would simply highlight the relevant section, then go to ...
2
votes
0answers
83 views

Problem with PopupMenu: Its values don't update dynamically

I have a problem with PopupMenu inside DynamicModule, its values don't update dynamically as they supposed to. The example below ...
2
votes
2answers
74 views

Mix text and calculated values in table header

I have a simple table: ...
0
votes
0answers
47 views

Why am I getting strange results from CUDADot?

This is what I am getting: This is what I am expecting:
0
votes
1answer
28 views

Variable value is changing inexplicably [closed]

So I was trying to avoid doing some trig calculations on paper by using mathematica, when I encountered this (Screenshot in a new notebook, after having restarted everything): As you can see, B is ...
1
vote
0answers
67 views

Making a function definition where the right hand side is evaluated before the definition is saved [closed]

My question is about assigning the resulting expression after evaluation of a function. So what I want: FOCf[x, y] := D[f[x, y], x] such it immediately ...
2
votes
2answers
99 views

Extract unevaluated definition of function

Say I have a function f[x_]:=a x + b. Now I want to get the a x + b part from the function to use in e.g. ...
7
votes
2answers
153 views

Bug in VectorFieldPlot[] with InterpolatingFunction[]?

Bug introduced in 11.3 or earlier and persisting through 12.0.0 or later While looking at https://mathematica.stackexchange.com/questions/192081/how-do-i-plot-a-divergence, I thought to suggest the ...
1
vote
1answer
68 views

Nested Do loops with externally defined iterators [closed]

I want to be able to define a set of iterators for nested Do loops, such as ...

1
3 4
5
6 7
27