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

learn more… | top users | synonyms

-3
votes
0answers
40 views

Function Expectation

I want to have a function result from this expectation is it possible? ...
3
votes
3answers
85 views

ReplacePart equivalent for Associations

I have a fairly complicated Association. I wish to use/create a function such as ReplacePart to operate on certain Keys within this multi-level Association. Here's ...
6
votes
4answers
149 views

Generate list of strings from a list of assigned variables

How do I generate a list of strings from a list of assigned variables? Eg. Convert ...
0
votes
1answer
39 views

Aborting from a Dialog box

I'm trying to abort a While cycle, with a dialog box. I've tried the following: ...
13
votes
1answer
331 views

Evaluation indicator for a notebook

I have a GUI with a number of TabView and other Manipulate controls. Sometimes clicking from one tab view to the other can take ...
4
votes
2answers
97 views

Difference between Evaluation>>Quit Kernel and Quit[]

What is the difference between Evaluation >> QuitKernel and Quit[]? Both seem to quit the kernel (and clearing all ...
-1
votes
0answers
57 views

How to find a function result from expectations functions [duplicate]

How to find a function result from expectations of this function: ...
0
votes
0answers
22 views

I am going mixed [migrated]

Why this is wrong ? $ -1=(-1)^{2/2}=((-1)^{2})^{1/2}=1^{1/2}=1 $ Then $1=-1$
0
votes
0answers
50 views

Evaluating Expectation [duplicate]

I would like to have a result equal to a function : ...
0
votes
0answers
32 views

Order of evaluation when using Solve and Minimize

I have to solve numerically an integral, that ends up being more or less as follows: Solve[f[x]==a*Sum[Sin[x-i]*(f[i]-f[i-1]),{i,1,x}],f[x]] (not actual ...
-3
votes
1answer
97 views

Integration with mathematica? [closed]

I am very new to Mathematica. I am trying to evaluate ∫ (1+lnx)Sqrt(1+(xlnx)^2) using Mathematica. I know a substitution must be done so I have set ...
2
votes
1answer
89 views

Mathematica displays the unevaluated expression Expectation function

The evaluation runs for a few seconds and then Mathematica displays the unevaluated expression Expectation function ...
1
vote
1answer
42 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 ...
0
votes
1answer
48 views

Defining a function with algebraic parameters

I am trying to define and use a function to represent the eigenstates of a Quantum Harmonic Oscillator, which have the general form: $$\psi_{n}(x) = \frac{1}{\sqrt{2^{n} n!}}\left(\frac{m \omega}{2 ...
9
votes
2answers
234 views

ScheduledTask with scoped variables. Working with timed evaluation

I guess I have to try harder and focus more but timed evaluation always frustrates me. I will show the issue on simple example of delayed trigger. ...
1
vote
0answers
34 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 ...
6
votes
2answers
455 views

How Can Notebook Know When it Called by Another Notebook?

I would like a notebook to behave slightly differently depending on whether it is evaluated from another notebook; i.e., ...
5
votes
1answer
81 views

How to track Part of Symbol or How to symbolize Parts of Symbol without copying data

Let's create simple function: SetAttributes[h, HoldFirst]; h[data_] := Dynamic[Grid[data], TrackedSymbols :> {data}] test = RandomReal[1, {2, 2}]; h[test] ...
1
vote
0answers
71 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 ...
60
votes
5answers
36k views

Get a “step by step” evaluation in Mathematica

Is it possible in Mathematica to get a step-by-step evaluation of some functions; that's to say, outputting not only the result but all the stages that have led to it? Example : Let's say I want to ...
3
votes
0answers
54 views

Regarding Evaluated True

Done a bit of reading: Normal[Series[ ]] does not give a normal expression Regarding the Evaluated->True, consider: ...
44
votes
4answers
3k views

Plot draws list of curves in same color when not using Evaluate

This example comes from the Mathematica documentation for Plot under Basic Examples. Can someone please explain why these are each plotted as a different color in ...
0
votes
0answers
30 views

reloading previously evaluated inputs? [duplicate]

How do I avoid having to resend previously evaluated commands when I reopen my notebook? can't it just allow me continue my computation from where I stopped? Also, some inputs take forever to execute, ...
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 ...
14
votes
1answer
353 views

What is the real default CellEvaluationFunction?

The default CellEvaluationFunction is Identity but one can quickly see that this is handled specially as an equivalent function, ...
2
votes
0answers
61 views

$Epilog does not work when exit

The following code does work: $Epilog := Print@1; Quit[]; But if I close the document and exit WM or click QuitKernel, it does not work. Why?
11
votes
1answer
2k views

A one line proof that one is zero using Mathematica 10

a = (Sqrt[2] + 1) (Sqrt[2] - 1) - 1; {a/a, Simplify[a]/a, b/b == Simplify[b]/b} {1, 0, True} This one line "proof" that ...
1
vote
2answers
49 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
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 ...
0
votes
0answers
55 views

Mathematica not evaluating q derivative of Jacobi theta function

Jacobi theta functions, $\theta_a(u,q)$ for $a=1,2,3,4$ are defined in the unit disk $|q|<1$. For some reason that I would like to understand, Mathematica does not evaluate numerically the $q$ ...
4
votes
1answer
82 views

Slowdown of Flat attributed function

I was trying to write an associative function f using the attribute Flat. ...
20
votes
2answers
434 views

Context unique to each group at a specified level

Recent versions of Mathematica provide the option of having a unique $Context for each cell group, via: Evaluation > Notebook's Default Context > Unique to Each ...
3
votes
0answers
73 views

Dynamic and Refresh

If I am not mislead by my memory, in Mathematica 6 a function Refresh was introduced, having the options UpdateInterval and ...
3
votes
1answer
55 views

Defining a function that prints both the name and value of a variable defined locally within the calling function

To save time when debugging with Print statements, I'd like to define a function -- call it PrintVal -- that prints both the name and value of a variable defined locally within the calling function. ...
10
votes
1answer
240 views

Why does the documentation call functions “pure”?

Clearly, functions in mathematica are not pure functions according to the definition on Wikipedia (no side effects - basically implementabe with table lookups): ...
2
votes
1answer
42 views

Is there a simple function identify the sign of an expression given constraints

I'm looking to find a simple function that can identify the sign of an expression given a set of constraints. I have looked around and do see that there is a few threads on this but I'm not sure I ...
0
votes
1answer
29 views

How can I get numerical answers to integrals involving the error function?

This is the integral I am trying to evaluate in mathematica: Integrate[Exp[-p^2/(m w h)], {p, -Infinity, Sqrt[h m w]}] Can someone show me how to get a numerical answer out of this?
1
vote
2answers
57 views

Assigning to the “local” version of a symbol

Compare Manipulate[c[1] = 1; c[1], {c[1], 0, 1}] with Manipulate[Do[c[i] = 1, {i, 1}]; c[1], {c[1], 0, 1}] The first case ...
0
votes
0answers
25 views

Expanding Function Based on Congruence Classes

I'm trying to get Mathematica to expand $\quad \quad \beta_n=\sum_{r=0}^{n}\frac{\alpha_r}{(q^4;q^4)_{n-r}(q^4;q^4)_{n+r}},$ where $\alpha_r$ is an integer valued sequence that is given by ...
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$ ...
10
votes
2answers
528 views

DSolve cannot solve for certain branches of the solution

Update - This has been fixed in 10.0.0 Could somebody please tell me, why I am always getting an error message when trying to run the following code: ...
3
votes
1answer
56 views

A problem about sorting final result

Three days ago, I asked a question about B-Spline Basis fuction here @Michael E2 given a solution to make the order of interval looks normal The easiest way would be to sort it afterwards: ...
8
votes
3answers
1k views

Keyboard shortcut to evaluate notebook

(If this is entirely trivial, although I couldn't find an answer as much as I searched the archives, I will delete the question.) How could I add a keyboard shortcut to evaluate the entire notebook ...
14
votes
4answers
346 views

Prevent graphics render inside held expression

Assuming each odd line is input I would like the even lines to be the output of the following lines. In the above the Graphics are inside ...
2
votes
1answer
53 views

How can I set a RadioButton to invoke an action, like a Button can?

In Mathematica one can create a Button which, when clicked, invokes an action. For example... ...
1
vote
1answer
25 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 ...
6
votes
1answer
77 views

Held keys in associations

Jacob Akkerboom commented: Note that PositionIndex does work correctly with held expressions, whereas this is a bit painful to implement using ...
9
votes
1answer
128 views

Tracking Initialization

How to track Initialization step by step? Any tricky solution is ok. One condition, x should be ...
15
votes
4answers
533 views

HoldForm doesn't hold form

Bug introduced in 10.0.0 and fixed in 10.0.1 In Mathematica version 10, HoldForm no longer produces the same results as in version 8 (edit: I only have versions ...