Questions tagged [evaluation]

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

0
votes
0answers
20 views

Numbers not multiplied out in the numerical expansion

I have a Mathematica notebook file with some functions that I need to evaluate numerically. However, for some values of certain variables Mathematica does not give me a result as just one number, but ...
12
votes
0answers
102 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
56 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 ...
0
votes
0answers
25 views

Underflow and Machine Precision

I am using Mathematica to solve a system of differential equations and evaluate and plot the solutions on an interval. The solutions have non-zero solutions, but Mathematica underflows in a portion of ...
1
vote
2answers
55 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
29 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
28 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
33 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
42 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 ...
6
votes
1answer
62 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 ...
0
votes
0answers
15 views

SystemException[“MemoryAllocationFailure”] with long evaluation involving FindRoot

I had earlier posted my code in a previous question, but I am reposting my code here: ...
2
votes
0answers
91 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
70 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 ...
0
votes
1answer
40 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
53 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 ...
8
votes
2answers
182 views

How to explain the behaviour of TreeForm?

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
25 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
39 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
441 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
114 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
87 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
620 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
253 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
263 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
84 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
76 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
56 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
65 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
64 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
39 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
57 views

Mix text and calculated values in table header

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

Why am I getting strange results from CUDADot?

This is what I am getting: This is what I am expecting:
0
votes
1answer
27 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
54 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
77 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
117 views

Bug in VectorFieldPlot[] with InterpolatingFunction[]?

Bug introduced in 11.3 or earlier and persisting through 11.3.0 or later While looking at How do I Plot a Divergence?, I thought to suggest the following as a solution to the OP's problem (where <...
1
vote
1answer
60 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 ...
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 ...
2
votes
0answers
29 views

Using Min & Max of an Interval in a replacement [closed]

I want to use a replacement rule to transform a list of equations. The following works as expected: ...
2
votes
2answers
89 views

How to evaluate the “Domain” of a Parametric Function?

In a simple example I try to calculate the time the solution x[t] passes a second time x[t]==1. ...
2
votes
1answer
32 views

Reevaluating an expression when Assumptions have changed

Is there a way to make this work? THM = TensorDimensions[M]; Assuming[ Element[M, Vectors[n]], THM ] Which gives: ...
3
votes
2answers
104 views

Convert defined variables to rule list

I'd like to make a function that takes a list of variables and returns a corresponding rule list with the current values of the variables. E.g. ...
0
votes
1answer
30 views

Replacing non-adjacent variables [closed]

Suppose I have an expression of the form $exp=a\,b\,c\,d\,+\,e\,f\,g\,h$ where all the letters represent real numbers, and I want to replace $a\,c$ in the first term by $w\,x$ and $f\,h$ in the second ...
3
votes
3answers
238 views

Why is expression not evaluated completely? [closed]

I have a simple sum of complex numbers. In my example their sum is zero. sum = Total[{1 , E^(2*I/3*Pi) , E^((4*I)/3*Pi)}] Print[sum] Try it online! When ...
1
vote
0answers
40 views

Differentiating functions of Set expressions

There are so many things in Mathematica I think I will never understand. Perhaps today there will be one fewer... B'[y]/.B->Function[y,y^2] Outputs ...
2
votes
0answers
69 views

Calling a notebook from a different notebook

Basically I have a notebook (let's call it nb1) that when evaluated yields one number when I specify some parameter $\alpha$ (in nb1). I want to call nb1 in a different notebook (nb2) using for ...
3
votes
2answers
176 views

Maximum point of a rational function

Suppose I have the following rational function: ...
7
votes
1answer
92 views

Why doesn't 'Abort evaluation' properly work when NotebookEvaluate is executed?

The following procedure can be easily aborted using Evaluation > Abort Evaluation menu item: Do[j + k, {j, 1, 10000}, {k, 1, 10000}] But it is not possible if <...
0
votes
0answers
32 views

Incorrect Function value and Derivative when expression in numerator yields zero

Recently I found that in special cases when the r.h.s. of a function definition is not simplified, and part of the expression in numerator yields zero, the value of the function is incorrectly zero as ...
5
votes
1answer
71 views

Does the position of a comment in a CompoundExpression matter for the result obtained with Out (%)?

I would like to understand what happens when we include a comment at the end of a line that ends with a semicolon. For example, if you execute ...