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
0
votes
2answers
53 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 ...
0
votes
2answers
62 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
83 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
101 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
99 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
54 views

Open, Evaluate and Close notebooks sequentially

I wanna Open, Evaluate and Close notebooks sequentially. Code from question here ...
3
votes
3answers
366 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
79 views

How useful is $SynchronousEvaluation?

Example SessionSubmit @ Print @ $SynchronousEvaluation Will print False even though ref/SessionSubmit/Details last point: ...
2
votes
0answers
29 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
162 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
74 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
34 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
58 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
32 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
32 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
41 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
48 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
70 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
25 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
92 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
73 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
53 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
57 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
211 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
45 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
112 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
621 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
119 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
109 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
627 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
300 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
267 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
85 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
59 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
73 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
48 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
63 views

Mix text and calculated values in table header

I have a simple table: ...
0
votes
0answers
38 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
84 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
128 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
62 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 ...
6
votes
2answers
102 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
34 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
98 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. ...