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
4
votes
1answer
43 views

Evaluate calls my function multiple times when the function generates an error

If I execute a line of code with Evaluate I find some unexpected behavior when the code returns an error. Here is a minimal example. Let ...
3
votes
1answer
57 views

Combining `With`, `If` and SetDelayed

I just noticed that With[{x = 1}, If[x == 0, 0, 1]] returns 1 (as I expected) but ...
3
votes
1answer
116 views

function evaluation - I don't get it

this function returns Pi/4 for a[1,4] In[...]:= a[r_, n_] := Module[{an = Pi/n, h = r Cos[an], w = 2 r Sin[an]}, an]; a[1, 4] Out[...]= Pi/4 so the kernel ...
6
votes
1answer
83 views

Suppressing analytical evaluation in NDSolve

I am trying to find a numerical solution to a set of coupled ODEs with NDSolve. Let us say $\boldsymbol{X}$ is a vector, and $\boldsymbol{F}$ is a non-linear vector ...
0
votes
0answers
38 views

How to see/trace Manipulate steps?

I am relatively new in Wolfram Language. What I want to solve is tracing "manipulate" steps in one of the demonstration project example codes. In my particular example, there are nearly 20 user build ...
6
votes
2answers
114 views

How to define a functional that produces at runtime a function by evaluating selected parts in its definition?

Consider the following functional as an example: ...
4
votes
1answer
121 views

Evaluate an expression at singular points

I have y[x_] := 1/Sqrt[2] (5 - x - Sqrt[8 - (x + 1)^2]) {x0, x1} = {-1 - Sqrt[8], -1 + Sqrt[8]}; and I want to calculate ...
0
votes
0answers
36 views

Run only a part of a notebook

Is it possible to run only a part of a notebook? I have a long notebook which takes forever to evaluate, so I was wondering if it was possible to run only a couple of cells instead of the whole ...
0
votes
1answer
49 views

How to evaluate a function on Imported data (.xlsx file)

I have imported an excel file, and I want to evaluate an expression on each point: Data = Import["data.xlsx"] which gives output like this: ...
4
votes
1answer
50 views

Evaluate in place annoyance

I want to use the following expression to get a string value: Row[{"Enter index identifier: ", InputField[Dynamic[indexidentifier], String]}] and I also want to ...
3
votes
1answer
78 views

ReplaceAll does not work

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

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

The documentation for $Pre gives the following example ...
5
votes
2answers
83 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
49 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
41 views

Respecting excluded index in sum

I'm using a function involving a sum where some indices are excluded: ...
0
votes
2answers
49 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
57 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
82 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
98 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
95 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
52 views

Open, Evaluate and Close notebooks sequentially

I wanna Open, Evaluate and Close notebooks sequentially. Code from question here ...
3
votes
3answers
325 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
74 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'...
12
votes
0answers
129 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
64 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
27 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
57 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
29 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
36 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
46 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
66 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
16 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
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
47 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
54 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
185 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
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
40 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
2answers
525 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
94 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
623 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
269 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
264 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
79 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 ...