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
0answers
25 views

Can I use D[] inside of Plot[]? [duplicate]

I wanted to make a plot like this: Plot[-BesselJ[1, z]*Evaluate[D[BesselJ[1, z], {z, 2}]], {z, 0, 5}] but I got an error. However, when I tried this: ...
1
vote
1answer
70 views

General::ivar: is not a valid variable

...
5
votes
2answers
276 views

Efficiency of the rule _ * 0 := 0

In the standard evaluation process, innermost parts are evaluated first. For example: In[0]:= (a/a + 1) * 0 The evaluation process gives: ...
2
votes
2answers
44 views

Cannot understand meaning of “identical”

This came up in the context of plotting solutions to NDSolve, but I've reduced it to the following issue. This really has me scratching my head. ...
12
votes
1answer
163 views

PlusMinus definition unexpectedly affects plotting

In version 10.1 I found a strange Plot behavior I did not anticipate. It seems that various heads including PlusMinus are ...
5
votes
1answer
65 views

head of a sequence

Why does Head[Sequence[b, c]] return c[Symbol] and not Sequence? Why does ...
2
votes
1answer
40 views

Defer evaluation of function but not of its derivative

Sometimes, the derivative of a function can be simplified nicely using the definition of the function itself. For example, if $f(x) = e^{x^2}$, then $$f'(x) = 2x \cdot f(x).$$ How can I perform this ...
1
vote
1answer
21 views

Evaluation order and Tables - Errors when using Evaluate@Table

following this question of mine Conditional PlotStyle, I ran into another problem. I fear it has to do with evaluation orders, as for example described in Table and Evaluation Order, but I am totally ...
1
vote
1answer
34 views

The number 1 evaluates inside HoldForm sometimes

If I run the following code: ...
1
vote
2answers
44 views

Evaluating part of an expression, but delaying the rest

Say I have an expression g = x^2 + y^3; I tried writing this H[x_, y_] := Eigenvalues[Evaluate[{{0, g}, {g, 0}}]]; The ...
0
votes
0answers
57 views

How does the parameters pass between functions? [duplicate]

In C++ , there are several ways to write a function: ...
0
votes
0answers
23 views

NotebookDirectory in NotebookEvaluate

Suppose Notebook A calls NotebookEvaluate[Notebook B]. Notebook B calls NotebookDirectory[]. Naturally, NotebookDirectory[] returns the directory of Notebook B. Is there an option to have ...
3
votes
1answer
35 views

Using local variables inside WhenEvent

Using WhenEvent inside Module is quite strange. The local variables are not evaluated in ...
0
votes
1answer
31 views

FunctionDomain ouput conflict with Limit output

I was just trying to find out the available domain for a function using the following : FunctionDomain[-((I*a*(-1 + E^(2*I*a*Pi)))/(-1 + a^2)), a, Complexes] &...
1
vote
0answers
33 views

Unexpected output of a Listable function. Arguments not threaded correctly

I saw this question asking about the Listable. The accepted answer did a good explanation on the poor performance of user defined function with Listable. However the answer didn't clarify why the <...
2
votes
0answers
35 views

How to refactor solution verification function for solving simple ordinary differential equations with Dsolve? [closed]

I have tried different approaches but none would work for me as I am new to both functional programming and Mathematica. At bottom is the code I have. How ...
0
votes
1answer
40 views

SetDelayed using local variables

I'm trying to define MakeBoxes for a bunch of functions all at once, but wish to do so within a loop as in the following example: ...
0
votes
1answer
67 views

How to evaluate the matrix in loop for different values of entries?

Hi everybody: I have a 4x4 matrix M see below, where for each value of h I have corresponding ...
0
votes
1answer
27 views

Hypothetical aplication of rules/restricting rules to a given context?

I have the code TensorDimensions[TensorContract[c, {{1, 2}}]]. It is in normal form. But if I add the rules: ...
0
votes
2answers
37 views

How can Mathematica quickly evaluate a scalar $g(x,y)$ given a long list of points $(x,y)$?

I am looking for a way that Mathematica quickly evaluate a scalar function $g(x,y)$ given a long list of points {{x_1,y_1},{x_2,y_2},{x_3,y_3},{x_4,y_4},.......}. ...
2
votes
0answers
25 views

How to configure cells **not** to evaluate via “Evaluate Notebook”

Is there a way to configure certain cells/sections not to evaluate under "Evaluate Notebook," while still being able to "manually" evaluate them with Shift+Enter? I have a large notebook with ...
5
votes
1answer
30 views

How to Evaluate the index of a list while keep the list Unevaluated?

I have the following simple example: letter= {"a", "b", "c", "d"}; idx=1; (*just for example*) ToString[Unevaluated[letter[[idx]]]] the output is ...
1
vote
0answers
33 views
0
votes
0answers
30 views

How can I ensure initialization cells are evaluated in order of definition?

I have a cell: Unprotect[Plus]; followed by a cell: Plus[label[t1_, l1_], label[t2_, l1_]] := label[t1 + t2, l1] If I ...
0
votes
1answer
52 views

Mathematica temporary files

I have a notebook which takes 24 hours or so for evaluation. The notebook uses Export command to output a dat file with two ...
0
votes
1answer
61 views

Mathematica giving wrong output [closed]

I have defined (very roughly): ...
2
votes
0answers
35 views

How might one deal with a run-away job, short of “force quitting”?

I've done some miscoding, and I'm in a loop that's producing output quite rapidly. So, it seems that I can't really get the Abort Evaluation or Quit Kernel options to "take". Of course, I can Force ...
0
votes
1answer
22 views

Help with Evaluation controll/hold all attributes?

I'm making a sort of symbolic derivator, which needs to take its formulas in unevaluated form. ...
1
vote
2answers
42 views

Evaluation Control for interpolating functions

I would like to find the root of the third component of an interpolating function, here e.g. a BezierFunction p: ...
0
votes
1answer
44 views

Making a list of Strings from the SymbolNames for a list of Graphics

Having generated a list of plots, such as plot01 = Plot[Sin[x], {x, 0, 6}]; plot02 = Plot[Cos[x], {x, 0, 6}]; plotList = {plot01, plot02} Then create strings ...
1
vote
0answers
38 views

Create an operator that holds its arguments [duplicate]

How can I create an operator that holds its arguments? I am looking to define something similar to oper[x_][expr_] := Hold[expr] I am expecting the following ...
4
votes
2answers
35 views

RandomVariate on multidimensional Bernoulli array

Executing... Map[RandomVariate, Map[BernoulliDistribution, RandomReal[1, 5]]] yields the expected result, e.g. ...
4
votes
1answer
55 views

Custom function which behaves like `Evaluate`

Question Is there a way to define a function which evaluates itself regardless of HoldAll, HoldFirst, ... ? Background I'm ...
4
votes
2answers
66 views

How to run all cells above current one? [duplicate]

In Jupyter notebook, there is a Run All Above (a certain cell) option. Is there something like Run All Above in Mathematica?
4
votes
1answer
66 views

Problem with Get'ting files with << as opposed to Get

When trying to import some files into my Mathematica notebook, I wanted to use ToString to specify the file path. Consider the following MWE, where we export some ...
2
votes
1answer
24 views

Define function that interleaves and then evaluates its arguments

I wish to define a function interleaveWithX[statements__] with behavior such that evaluating, for example, ...
0
votes
1answer
47 views

step-by-step solution unavailable (( possible intermediate steps ))

When using the (( WolframAlpha["integrate 1/(2+Sqrt[1-x]+Sqrt[1+x])"])) function to find integration steps, this message appears to me what is the explanation and ...
1
vote
0answers
32 views

How is following two (same) calculations giving two different results? [closed]

I have the following two pieces of code which give me two different results, ...
9
votes
0answers
147 views

Dividing by Zero - Unexpected Result [closed]

When I divide this number by zero I get this for an answer. ans = 2345900/0 (* *) What is surprising is that in taking the square root, Mathematica seems to ...
5
votes
0answers
71 views

In over my head in trying to create a debugger

Apologies for a less than ideal question, but if I could have asked a good question the answer would probably have been revealed in the process... In answer to this question @LeonidShifrin gave some -...
3
votes
1answer
56 views

Question about iterator

I am new to Mathematica. I just want to evaluate a 2x2 Jacobian and then evaluate it on different values of the two variables x and y. The values I want to use to evaluate the Jacobian are the result ...
0
votes
0answers
31 views

Calculation of algebraic sets using sequences

I am attending algebraic geometry and we are dealing with algebraic sets in the polynomial algebra. I wanted to make a code that receive some polynomials and give me a certain decomposition of its ...
1
vote
3answers
54 views

Two variables integrals: How to integrate with respect to one variable, then evaluate and plot the result with respect to the second variable? PART 2

I have got a very usefull answer to my problem yesterday. Now, I wish to improve the code, including a new variable in other to obtain a 3D-plot. Here is the sample i wrote already. Please check any ...
2
votes
1answer
79 views

Two variables integrals: How to integrate with respect to one variable, then evaluate and plot the result with respect to the second variable?

I have started using Mathematica for a moment, but I'm now struggling to make some more advance calculations, for which I don't know how to overcome some difficulties. In fact, my wish is to evaluate ...
1
vote
1answer
40 views

NIntegrate does not evaluate this finite integral composed of divergent parts

I would like to numerically evaluate the following integral: $$I = \int_{-\infty}^\infty d\tau_3 \int_{-\infty}^\infty d\tau_4 \frac{1}{1+\tau_3^2} \left\lbrace \frac{2}{1+\tau_4^2} \log (\tau_3 - \...
7
votes
1answer
185 views

And@@(f/@list) without evaluating f for the whole list

And[f[1],f[2]] doesn't evaluate f[2] if f[1] is false, but ...
0
votes
1answer
51 views

Is using an If[] condition faster than KronckerDelta[]?

I have a code which has a term in a summation like: KroneckerDelta[M,0]*func[M] where func[M] is a time consuming numerical ...
4
votes
1answer
611 views

My Computer crashes every time after I run this - Abort Dynamic Evaluation error

This code makes my computer crash, every time I run it. ...
1
vote
0answers
38 views

Table with function evaluated at a list [closed]

Supposed I have a function f[a_] = a^2; alist = {1, 10, 100, 1000}; I want to make a table of the values of alist and ...
1
vote
3answers
68 views

DynamicModule: Assign Initial Values to Variables as List of Strings

Working within DynamicModule, how can a list of strings as be used to assign initial values to variables? For example, what nested functions can be used as ...

1
2 3 4 5
25