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

learn more… | top users | synonyms

1
vote
2answers
63 views

Pattern matching to head with HoldFirst

I want to define a function that only operates on expressions with a head from a given list, such as f[expr:(_And|_Or)] := Print["LHS is ", expr[[1]]]; This of ...
1
vote
2answers
82 views

Extract the real components from a very large expression

Suppose I have a very long expression (>500,000 characters) which contains a mixture of real and imaginary terms. e.g ...
1
vote
1answer
44 views

Cell seems to be evaluating in exponential time even though it shouldn't

I am trying to implement Newton's method for a given function f[x] and a starting x-value xval. The code should print out each new x-value as it approaches one of the zeroes of the functions. g[x] is ...
1
vote
1answer
125 views
1
vote
1answer
102 views

Manual CellGrouping option causes crash at cell evaluation

Update: Try to reproduce this behaviour with CellGrouping set to manual. To do that: either evaluate ...
1
vote
1answer
3k views

Evaluate an expression at a specific point

In Maple, you right click and can evaluate an expression (whatever it is) at a specific point say: Expr.= abcddafjosjfoj, then right click and simply evaluate at c=-34 say. But how does one do the ...
1
vote
1answer
179 views

Confused about Unevaluated

Why does Map[Unevaluated, Table[PauliMatrix[i], {i, 1, 3}] give {Unevaluated[{{0, 1}, {1, 0}}], Unevaluated[{{0, -I}, {I, 0}}], Unevaluated[{{1, 0}, {0, ...
1
vote
1answer
140 views

direct assignment to the element in a Table

I have already asked a related question here why set values in this way doesn't work? But I think I have to write the question which I encountered explicitly? ...
1
vote
2answers
50 views

Strange behavior of the Evaluate function

I am solving a system of differential equation whose unknown are saved under variable vec={C00,C01,C10,C11} and the solutions are saved under variable ...
1
vote
1answer
65 views

Strange integration

I tried to evaluate this line Integrate[((-I/2) (E^((-I) x) - E^(I x)) + ((E^((-I) x) + E^(I x)) x)/ 2)/((-1 + E^x) x), {x, 0, Infinity}] Then I get $14$ ...
1
vote
1answer
115 views

Generate conditions seems to not work [closed]

I am trying to compute the following integral Integrate[E^(I*k*Omega*t), {t,0,T}, GenerateConditions->True] for which Mathematica returns ...
1
vote
1answer
111 views

Caching data in Mathematica package

Consider the following: m=Quantity[1,"meter"] If I run the package, it will return 1m But when I load the package, the ...
1
vote
2answers
145 views

How can define a set of nested parameters

I would like to know how I to define a function with a nested set of parameters (or whatever you would like to call it). For example, how would I get the following function ...
1
vote
1answer
30 views

Package function not evaluating

I have a short package like this: ...
1
vote
1answer
46 views

How to abort silently?

I want to Abort[] an evaluation without generating this message: $Aborted Is there a way to do this? This messages modifies my notebook, and I don't want this to ...
1
vote
1answer
27 views

Expand Expression with Nested Special Functions [closed]

I am trying to study the following sequence for $a=1$, $n \ge 1$: $$\alpha_n=(1-aq^{2n})\sum_{j=0}^{n}\frac{(aq;q)_{n+j-1}(-1)^{n-j}q^{\binom{n-j}{2}}}{(q;q)_{n-j}(q;q)_j^3}$$ using Mathematica, where ...
1
vote
1answer
61 views

Commutative algebra by generators and quadratic relations

My apologies if this has been asked before. Please also be gentle, as this is my first question here. I am trying to define a commutative algebra by generators and relations in the following way. ...
1
vote
2answers
215 views

Converting expression into string without evaluating it

How can one convert a Mathematica expression into a string without the expression being evaluated first? I tried using Hold, but it returns ...
1
vote
1answer
123 views

Evaluation of second argument to NIntegrate

Apologies if this is a duplicate, but I couldn't find it. The expression Integrate[x^2, Flatten[{{x},{1,2}}]] evaluates properly, to $\frac{7}{3}$. However, ...
1
vote
1answer
40 views

Output cell written with NotebookWrite dissappears on whole notebook evaluation, yet remains if I individually evaluate it

Create a new notebook with the following two input cells: NotebookWrite[EvaluationNotebook[], Cell[BoxData[ToBoxes[Manipulator[Dynamic[x]]]], "Output"]] and ...
1
vote
1answer
104 views

About evaluation in Block

I'm completely puzzled by the following codes: Clear[func, f] a = x^2 + z; func[k_] := Block[{f}, (f[x_] := Evaluate[(a /. {z -> k})]; f[1])] func[2] ...
1
vote
1answer
259 views

How to tell Mathematica not to simplify an expression

While there is this question with a very similar title, it does not answer my question, which is: I have part of an input, in my case Re[Exp[I*x]] which ...
1
vote
1answer
142 views

Evaluate code to some point

How can I evaluate my code, up to some point? I don't want to evaluate all of my code always. I have to use Shift - Enter for every line from the first cell up to the point I want to be, and it's not ...
1
vote
1answer
182 views

Skip one step of the loop if there is an NIntegrate::eincr message

Is there a possibility of skipping one step of a loop if in this step there appears an error like NIntegrate::eincr? After skipping, the loop should go to the next ...
1
vote
1answer
214 views

Particular solutions of a Differential Equation not evaluated in a given case

Below first case which gives particular solutions of an OED correctly: ...
1
vote
0answers
92 views

How to make a graph of this function?

I need to plot the following function: ...
1
vote
1answer
43 views

Getting Gamma as a result for integration [closed]

When finding the mean from the distribution, fx = 4*x^3*Exp[-x^4] meanx = Integrate[x*fx, {x, 0, Infinity}] I get Gamma[5/4] Could someone explain what ...
1
vote
0answers
37 views

Question on Function in Replacement Operation

I am trying to create a replacement function which, depending on the input, gives an additional minus. In my example I have an undefined function a with two ...
1
vote
0answers
74 views

Summing the probability distribution to 1 to convince myself

I have worked out a probability distribution and want to check its sum which is necessarily 1. First we write $$ r \triangleq \frac{(2 \lambda + \mu)^2}{2(\mu + \lambda)^2}, \quad s \triangleq ...
1
vote
0answers
44 views

Is it possible to pipe the output of EvaluationMonitor to Excel?

I have an EvaluationMonitor setup to capture the points processed by NIntegrate. This is a case where the same function, integrated over the same region in cartesian coordinates yields a dramatically ...
1
vote
0answers
73 views

How to implement nested With as a single construct using functional programming (Fold)?

It is possible to define my own With construct where each local constant can depend on the previous defined local constants? I wish to replace something like this ...
1
vote
0answers
86 views

Expression for evaluating multiple functions?

I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate ...
1
vote
0answers
38 views

can I evaluate multiple cells at the same time? [duplicate]

my laptop has 2 cores, can I assign a core to evaluate one code, and the other core for another code in parallel instead of evaluating in sequence? thanks
1
vote
0answers
30 views

How to Plot a function that returns multiple values? [duplicate]

I have a function that returns multiple values, like this: f[x_] := ( (*... something ... *); {y1, y2}); They are computed together, so there's absolutely no ...
1
vote
0answers
131 views

Is there a way to stop evaluation immediately?

Sometimes I'll have a loop that I accidentally made too big. I'll evaluate, and MM will try to run through the entire loop. The program itself doesn't actually seem frozen... I can go to Evaluation-> ...
1
vote
0answers
65 views

How to extract a variable names (not values) from a list of transformation rules?

I am trying to extract variable names from a list of transformation rules mapping = {var1 -> 'val1', var2 -> 'val2' }. Variables ...
1
vote
1answer
117 views

Printing intermediate calculations in an external file, while suppressing the output in the notebook

I'm trying to construct a text-file that contains all the operations that Mathematica performs when evaluating an expression. However, i'd like to suppress all output in the notebook in which I'm ...
1
vote
0answers
54 views

Confusing efficiency and evaluation when returning pure functions? [duplicate]

I have a function that takes some time to evaluate, that's meant to be a polynomial approximation to a function. The polynomial is defined by a list of coefficients, so I have the function ...
1
vote
0answers
104 views

is there an equivalent of “show” steps? [duplicate]

Possible Duplicate: Get a “step by step” evaluation in Mathematica In wolfram alpha, when preforming for complicated integrals there's a 'show steps' option that explains how ...
0
votes
4answers
794 views

Specify a variable as an integer

I have a formula that always evaluates to a certain number for any variable X under one condition that X is an integer and ...
0
votes
2answers
227 views

How can I get the approximate analytical solution to this simple algebra equation?

Is there a way to get the analytical form to the root of this equation 2 A e (-ArcTanh[smax/s0] + ArcTanh[(smax Cos[w \[Zeta]])/s0]) == F0 ...
0
votes
3answers
150 views

Avoid creation of OwnValues when inserting transformation rules into Experimental`OptimizeExpression

I have a large list of transformation rules that I want to simplify. I find Experimental`OptimizeExpression works as it gets me the answers. My question is: **I can only get this to work when I ...
0
votes
4answers
150 views

Minimization in single component of BSpline to extract points

I smoothed some data with a BSpline $B[t] = (x[t],y[t])$. I would like to extract certain points from this spline by their x-Values, $x_0$. The easiest way I came up with was to minimize ...
0
votes
1answer
151 views

Plot[ D[Sin[x]] ] and Evaluate[] [duplicate]

Why does t = 2 Pi; Plot[D[Sin[x],x], {x,0,t}] (* Plotting the derivative of Sin[x] *) not work, but ...
0
votes
2answers
122 views

Symbolic evaluation fails because it exceeds $RecursionLimit

I am trying to perform a simple arithmetic in complex algebra. ...
0
votes
1answer
71 views

Not evaluating all cells unless I explicitly evaluate each one?

I'm running a Mathematica (version 8) notebook. In one of the first few cells, it is supposed to plot some data. It uses a couple functions that are defined in an above cell. If I do Evaluation-> ...
0
votes
2answers
79 views
0
votes
1answer
449 views

Can graph interpolating function, but not use it. Any thoughts?

When solving a system of differential equations numerically, I get two interpolating functions. I can graph both of these, but when I try to evaluate either of the functions at a point, it just spits ...
0
votes
3answers
151 views

Evaluation in Manipulate [duplicate]

I have an expression assigned to a variable. For example: exp1 = a*x+b Now I would like to plot it using something like this ...
0
votes
1answer
111 views

NIntegrate failling on floating value

I'm trying to take the following integral NIntegrate[ ((Sin[Q 1]-Q 1*Cos[Q 1])/(Q 1)^3)^2 * S[Q,0.4,2] * Q BesselJ[0,0.5Q] , {Q,0,Infinity}] ...