Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [evaluation]

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

1
vote
0answers
50 views

Calling a notebook from a different notebook

Basically I have a notebook (let's call it nb1) that when evaluated yields one number when I specify some parameter $\alpha$ (in nb1). I want to call nb1 in a different notebook (nb2) using for ...
3
votes
2answers
166 views

Maximum point of a rational function

Suppose I have the following rational function: ...
4
votes
0answers
25 views

Why does't 'Abort evaluation' properly work when NotebookEvaluate is executed

The following procedure can be easily aborted using Evaluation > Abort Evaluation menu item: Do[j + k, {j, 1, 10000}, {k, 1, 10000}] But it is not possible if <...
0
votes
0answers
21 views

Incorrect Function value and Derivative when expression in numerator yields zero

Recently I found that in special cases when the r.h.s. of a function definition is not simplified, and part of the expression in numerator yields zero, the value of the function is incorrectly zero as ...
4
votes
1answer
63 views

Does the position of a comment in a CompoundExpression matter for the result obtained with Out (%)?

I would like to understand what happens when we include a comment at the end of a line that ends with a semicolon. For example, if you execute ...
3
votes
1answer
83 views

HoldFirst being overridden by Activate

So here's the problem a=1;a=2 works because of the HoldFirst attribute of Set, so that it ...
0
votes
0answers
15 views

Evaluating part(s) of a function which outputs another function [duplicate]

I would like to define a function f(n) which outputs another function as follows: ...
1
vote
1answer
26 views

Evaluation of Extract and use the result in a Sum

I am experiencing a problem in the evaluation of a sum. I hope that someone can help me, I am not an expert Mathematica programmer. I'm posting just the portion of code that gives problems, I know ...
2
votes
1answer
41 views

Strange behaviour (or issue?) in using evaluation of held argument inside a table in Mathematica

I encountered a very strange behaviour on Mathematica using Evaluate on a held argument. Could anyone explain to me what is the subtlety (or is it a bug?) Here is the expression: ...
5
votes
2answers
84 views

How to prevent arguments UpValues from being used in selective functions

Ok, I know the simple answer is to set some form of Hold attribute to the function but bear with me for a bit while I explain my motivation and why that is not quite what I want. I have a collection ...
10
votes
3answers
171 views

Perform localized, evaluation-leak free replacements

Consider the following expression: expr = Hold[ { f[ {1, {Print@1}} ], g[ {{{Print@1}}} ] } ]; I'm looking for a way to ...
0
votes
1answer
30 views
1
vote
2answers
57 views

Getting thet derivative of a user defined function in terms of an auxiliary function

I'm currently struggling with evaluation control when getting the derivative of a function (I dont know if that's the correct term here. Sorry, beginner). My function is of the form ...
0
votes
2answers
39 views

How to find value of an expression if some cases are given>

I actually need to find the value of x which have 3 cases as follows: x=0, when x<=0 x=[x], when x>0 and is non-integral ...
9
votes
1answer
175 views

Force evaluation of user-defined function

Consider a function that sorts its arguments based on a function called order ...
1
vote
0answers
57 views

Why is my Mathematica notebook resetting all my previous computations after some hours?

I am using Mathematica 11.1. This morning I started some calculations in the hope that when I come back from work, they will be finished and I can get on with the rest of my project. Indeed, when I ...
0
votes
0answers
61 views

Evaluate higher order derivative at some point under some assumptions

I need to evaluate the $k^{\rm th}$ order derivative D[w[t] w'[t], {t, k}] which is actually equal to ...
0
votes
0answers
33 views

How to perform delayed evaluation containing function with Mathematica

I was wondering whether there is a way in Mathematica to evaluate an expression in the most simple form, without any simplifying. For example if we define: ...
1
vote
2answers
40 views

Parametric function with reference at a central point

Would anyone have any idea how to delete the xy andxyz steps? I tried using the Evaluate ...
1
vote
0answers
33 views

How to use Evaluate inside function definitions? [duplicate]

How to use Evaluate inside function definition so that is acts as Evaluate only whet function is called? This is toy exampl, where I want to define function inside another function: ...
1
vote
1answer
63 views

Why the difference in outputs in different cores?

Executing the code r = RegionIntersection[Region[Ball[3]], Region[Ball[{1/2, 1/3, 5/6}, 1]]]; Region[r] in version 11.3.0.0 on Windows 10 32-bit, I don't ...
5
votes
3answers
341 views

What is the the proper way to define a function from an expression?

Say after some long computation we get an expression expr=x^2 We do not know what the value of expr beforehand. Now we want ...
1
vote
1answer
64 views

Is there any built-in way to loop over a column/lines?

I have a file as following: cat data.m 1 2 3 x+y 2 x + 3 y So it contains rows containing numeric numbers or expressions, which at this stage is not ...
2
votes
0answers
49 views

Integrating over colors

I'm trying to compute the following integral: $$\int_{380 \, \mathrm{nm}}^{700 \, \mathrm{nm}}\mathbf{RGB}(\mathrm{Hue}(\lambda))\frac{\mathrm{d}\lambda}{\lambda^4}$$ where $\mathbf{RBG}$ takes in ...
0
votes
0answers
18 views

Find value of expression based on variable equality instead of assignment

I have certain relations or equalities which determine how different variables are related to each other. These relations are meant to be used to further calculate the value of some other expression. ...
1
vote
0answers
20 views

Cell wierdly auto evaluated when mouse-selecting code through VNC viewer

I have Mathematica 11.3 installed on a Mac. I connect to it from a Windows machine via VNC viewer. Very strangely, whenever I select any piece of code in a cell by clicking and holding my mouse button,...
2
votes
1answer
97 views

Does Mathematica understand dummy variables?

I encountered this problem and was unpleasantly surprised. Let us define a function: g[x_]:=Sum[x^k,{k,0,2}]; k is supposed ...
0
votes
3answers
28 views

Low precision from function returning matrix

Got a function depending on single parameter "t" defined below which returns a 2 by 2 matrix ...
2
votes
0answers
39 views

Evaluate notebook without opening cell groups

I have a notebook with grouped cells, where the input cells are hidden and only output cells open. Is it possible in an easy way to evaluate the whole notebook and preventing opening all groups, ...
0
votes
0answers
41 views

How to stop evaluation of Zeta with even arguments

It could be a duplicate question. However I could not find much after a huge searching. I have a huge expression in mathematica involving many Zetas. I want not to evaluate the even Zetas which ...
8
votes
3answers
235 views

HoldForm: Display exactly as entered?

Sometimes, Mathematica's internal representation of expressions can give somewhat surprising results. Specifically, I noticed this when I tried to preserve products of fractions for display. E.g. ...
0
votes
1answer
47 views

Why isn't my function evaluating to an explicit number?

I'm just wondering why my function is not evaluating as I think it should. I put in the following: ...
3
votes
1answer
31 views

How to evaluate limit of a user-defined function

Limit[(k/(k - 1)), k -> Infinity] Gives correctly: 1 But, ...
0
votes
2answers
39 views

Evaluation control - Hold (?) argument name not argument values

I wanted to produce a list of statistics labelled with the statistic name, for exchange with a database. I defined ...
5
votes
1answer
158 views

Inactivate all occurrences of a symbol

I would like to inactivate all occurrences of a symbol to prevent it from evaluating, regardless where in the evaluation process it appears. A minimal example: ...
3
votes
4answers
240 views

Basic substitution

I am relatively new to Mathematica, so I am sure this is basic, but I lack the basic terminology to be able to google it. How can I make this command work? ...
0
votes
0answers
11 views

Trouble with evaluation and Dynamic [duplicate]

I would like to evaluate the gradient of a certain function at position (x0,y0,z0) where x0, y0, z0 are global variables which can get altered in real-time later in the worksheet. The only way I know ...
6
votes
4answers
386 views

partial numerical evaluation

Context The following is an issue I have come across many times and still do not have a satisfactory solution for. The context of it is this. Let's say we have an equation, a linear ODE for the ...
2
votes
0answers
50 views

non listable plus and times [duplicate]

I am trying to create my own Plus and Times functions, which are identical to the built in ones with the exception that they are ...
0
votes
0answers
56 views

Problem with NIntegrate: it gets stuck when evaluating zero value

I have an integral with complicated function evaluated by MonteCarlo method (please find a folder with two files by the link below). Namely, a function ...
3
votes
1answer
47 views

Is it possible to write an expression A such that Evaluate[Evaluate[A]] is different from Evaluate[A]?

Mathematica is cool for all sorts of "magic tricks", but I'm trying to get an idea on how the core term-rewriting system works. Is it possible to make a term such that the output of its evaluation can ...
4
votes
3answers
178 views

Handling expression differently for display vs. calculation?

I have a function I wrap a lot of my numbers with to factor them and display them out a certain way. Usually I do this at the last step of a calculation, but sometimes it would be nice if I could ...
4
votes
1answer
65 views

Subtle order-of-evaluation issues when pattern-matching with attributes

Related question concerning unrolling the tests that are shown below: Big and Little surprises when unrolling tests of pattern-matching and attributes Questions researched before posting this one: ...
4
votes
3answers
41 views

Controlling HoldForm while mapping

If I execute A = {Sin, Cos, Tan} B = {ArcSin, ArcCos, ArcTan} #[[1]]@#[[2]]@x & /@ Transpose[{A, B}] the output is ...
5
votes
1answer
118 views

With vs. Block scoping of parameters for Plot

A very basic question.. Why does Block work, but not With, to specify value of a parameter for a function to be plotted? ...
6
votes
2answers
99 views

How to use ReplaceAll and RuleDelayed with an Association? [duplicate]

I expected that something like this ...
1
vote
0answers
17 views

ClearAttributes in ParallelDo

The following code ClearAttributes[Times, Orderless]; temp = b*a; Do[ Print[temp];, {i, 1} ] will print b*a However, the ...
3
votes
1answer
144 views

Can this power tower function be optimized to perform faster?

Take the following function defined in Mathematica: Itr[x_, p_, n_] := x^Nest[Power[p, #] &, 1, n]; Evaluating this function even for small values of ...
0
votes
2answers
67 views

Why doesn't Boole return 0?

I'm writing a code to evaluate if the Cauchy-Riemann conditions are satisfied for a given function. For example, for the function f[z]=Conjugate[E^(z)] it has to ...
4
votes
1answer
53 views

How to extract part of a held expression without evaluating it

How can I extract part of a held expression without evaluating it? Clear[w] Part[HoldForm[w = 3],1,1] (* w *) w = 4 Part[HoldForm[w = 3],1,1] (* 4 *) Here I ...