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
-1
votes
0answers
64 views

How can I check that this is true? [closed]

Good morning, someone would be so kind to explain the steps that I must follow to be able to pose this exercise. Someone would be so kind as to explain to me how to use Mathematica commands in order ...
0
votes
1answer
20 views

Create a table of plots in manipulate with redundant variables

I'm trying to create a table of diagrams of which each shows a different variable on the x axis and fetches the remaining parameters from the enclosing scope, a Manipulate object. So I have this code ...
0
votes
0answers
39 views

BellY function call fails

I would very much appreciate to get an answer about the reason of the message I get calling the BellY function. ...
0
votes
0answers
46 views

Force WhenEvent and NDSolve to numerical evaluation and Best Practice

I'm trying to perform an hybrid kalman filter for a nonlinear system. The following code works but it is very slow due to the fact that it does symbolic evaluation. What I wish is that for the filter ...
0
votes
1answer
31 views

Evaluating $T(x,y) = ((K_h*K_g - K_g)*(K_h*K_g - K_g))(x-y)$?

Define $K_h$ as$$ K_h(x) = \dfrac{1}{h}K\bigg(\dfrac{x}{h}\bigg), $$ where $K$ is the Gaussian function$$ K(x) = \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2}. $$ Define the function $T(x,y)$ by$$ T(x,y) = ...
2
votes
0answers
36 views

Hold parents of ArcTan

If this question is beating a dead horse about Hold, Inactivate etc., a close vote is fair enough. That being said, I'm curious ...
0
votes
2answers
36 views

Defining function in terms of previously defined symbol

With a very high frequency I find myself working with giant and hard to alter expressions in a situation where it would be convenient to do something like ...
1
vote
2answers
55 views

WhenEvent inside Ndsolve how to evaluate actions numerically every time the event happens

I need to force a whenevent action to be evaluated numerically all the times the event happens. The fact is that I use very complicated matrices and I need to invert them so the system requires a lot ...
1
vote
2answers
47 views

Applying a particular rule to a held (or unevaluated) function

I am a very novice Mathematica user and still can't get my head around its evaluation control, all possible constructs related to it (e.g. Hold, ...
2
votes
1answer
55 views

What's the difference between Evaluate and Replace command? [closed]

all, I'm new to Mathematica, I am very confused between Evaluate and Replace (/.) command. I feel they are very similar. For example, ...
0
votes
1answer
49 views

Sum over multiple values falsely returning 'Indeterminate' [closed]

I have a conditional expression which depends on three variables, say x, y and z (all ...
1
vote
3answers
58 views

How to set a value to the symbol denoted by a given string? [duplicate]

The code setString[name_String, value_]:= Evaluate[Symbol[name]] = value fails whenever Symbol[name] has already been assigned ...
6
votes
1answer
48 views

Automatically set x=0, after each input/output ? ($AfterEachInputOutput)

Is it possible to do something that I want, after each input/output automatically and silently? I am looking for a feature like $AfterEachInputOutput in the following code : Example : to set variable ...
5
votes
1answer
92 views

Extracting n-th part of an expression without any evaluation

Is it possible to extract n-th part of an expression as a string, without any evaluation? For example, ...
4
votes
1answer
47 views

Floor function not returning correct value

Something very strange is happening as I evaluate the Floor function: (9.2 - 8)/1.2 Floor[(9.2 - 8)/1.2] returns: 1. 0 so I ...
1
vote
0answers
42 views

Series coefficient not working for abstract powers

I'm trying to extract coefficients of some complicated polynomials. If I try to write SeriesCoefficient[1/(x-1)^4,{x,0,m}], this works fine, everything as expected. ...
2
votes
1answer
145 views

An alternative command to compute a logarithmic integral [closed]

I am trying to see if Mathematica can calculate: $$\int_0^1\frac{\ln(x)\ln(1-x)\ln(1+x)}{x}dx,$$ which has a closed form found here. So I tried ...
7
votes
1answer
144 views

Fast Evaluation of a series of dot product

Context I have a function that depends on 3 real variables x,y and z and that is defined by a series of matrix products. The evaluation of f for a specific (x,y,z) is fast ~0.02 sec but I want to ...
2
votes
1answer
42 views

What is the best way to coalesce two values, if the first value is Null?

I want to set a variable to a value, and have a default value in case the previous value is Null. Basically it would act like a Coalesce statement in SQL. I have not been able to find a succinct way ...
1
vote
0answers
32 views

Evaluating function taken as input

Consider this toy example: myDerivative[f_, x_] := D[f, {x, 2}] This defines a function myDerivative that takes in a function <...
0
votes
1answer
43 views

TemplateEvaluate, TemplateUnevaluated, and TemplateVerbatim [Undocumented] - What do you know?

Let's discuss some undocumented Template-related functionality. Specifically, what do you know about TemplateEvaluate, ...
3
votes
0answers
40 views

Symbol differentation in Wolfram Programming Lab gives recursion error [closed]

I was experimenting with the Wolfram Programming Lab, but it doesn't seem to be working. I tried running this code in a notebook: D[x^2, x] but it gives the error <...
0
votes
1answer
80 views

Combination of Block and With - Unexpected results

I'm trying to use Block to prevent a function from executing. In this example, the function I'm trying to block will simply be ...
0
votes
0answers
34 views

Accessing already defined Symbols in a function

I'd a like a function that assigns variables based on a rule list. That is, SetParameters[{x->1, y->2}] would set x=1 ...
0
votes
2answers
66 views

Hold `outermost layer` of expression

In pursuit of a function to force unsimplified fractions forceden[x_,d_]:=Hold[Evaluate[Numerator[x]d/Denominator@x]/d]; There are many related functions (...
2
votes
2answers
184 views

Wolfram modules returning functions

I am trying to get a With / Module pair to return a set of functions. ...
1
vote
0answers
84 views

Do Loop contained in a function defined within a custom package doesn’t work as expected but works fine when function is defined directly in a script

Below is my code and I am having problems running the StdMPC function that I am trying to define. Running my code gives me the error that the matrix A and Xopt[[i]] are not of compatible shapes for ...
5
votes
1answer
150 views

Integral of a function defined with a loop

I have defined a function g as ...
0
votes
1answer
49 views

How to instruct internal function to evaluate arguments only after numerical values are plugged in?

For convenience, let me start with a simple example. The following code calculates the sorted eigenvalues of a 4x4 Hermitian matrix with a parameter x ...
1
vote
1answer
55 views

function within function

delFunc[funcform_, lstofparams_,lstoferrs_] := √Total[Table[(D[funcform, lstofparams[[i]]]*lstoferrs[[i]])^2, {i,Length[lstofparams]}]] ...
0
votes
0answers
34 views

Simplifying expression involving Boson operators

I want to do calculations involving Boson operators $a(k), a^{\dagger}(k)$, e.g $(x + a(k))(y+a^{\dagger}(k))$. My code is: ...
3
votes
1answer
51 views

How to force Mathematica to output a function using its alternate pretty form when using Apply? [closed]

By default, Bra is an undefined function. Let's say I have defined Bra, Bra[a___]:=... such ...
0
votes
1answer
46 views

Symbolic evaluation expressions containing a user-defined function [closed]

I have a function F[r] = (-1)^(r + 1) Binomial[n, r]/r I would like to evaluate F[x+1]/F[x] for some arbitrary ...
3
votes
2answers
126 views

Change the color of sub-expression when the whole expression evaluates to a different expression

I found it's tricky to colorize a sub-expression of an expression that changes to a different expression when it is evaluated. For example, if I replace s with ...
1
vote
2answers
76 views

Repeat every $ x $ coordinate except the last one

Below is the code to print the x value. ...
2
votes
2answers
62 views

Print function value at specified coordinate

Below is the code to evaluate the function. I am trying to print the function values at a specified coordinate as shown in ActCoor. ...
0
votes
1answer
60 views

Mathematica 12.1 is treating all my cells as raw texts by default

I was once using Mathematica 11 it all works fine - when I create new Notebook (.nb) input like 1+1 and press shift+...
1
vote
1answer
56 views

How to inline a variable in function definition

I need to compile a function g that calls an external function f. f and ...
0
votes
1answer
187 views

Elliptical Integration

I have an integral which can be decomposed into three complete elliptical integrals. I want to know the method by which I can achieve this. The integration is the following: (4 (-1 + y)^2)/(c Sqrt[y (-...
0
votes
1answer
71 views

Evaluate analytic solution of the function [closed]

Here, i have plotted a function and i would like to print the y coordinate values from the plot for the x-coordinate given below. Coordinates in the sequence that every fourth y-coordinate should be ...
2
votes
1answer
29 views

How to conveniently evaluate a function at several points when there are way too many points

Say I define a function as follows: pos[n_] := If[Cos[288 ((n Pi)/233)] > 0 && Sin[288 ((n Pi)/233)] > 0, 1, 0] Then I want to evaluate at this ...
6
votes
0answers
101 views

Difference between the infinite rewriting behavior of evaluation and ReplaceRepeated

In the documentation tutorial/Evaluation it's said that: Every time the expression changes, the Wolfram Language effectively starts the evaluation sequence over ...
0
votes
1answer
24 views

How to keep a variable unevaluated when used as parameter for `Sum`?

Let's say I have assigned the follow value to s by s = Floor[Log[n]] Then I want to compute ...
0
votes
1answer
31 views

Solving a large system of equations for the smallest integer values

I'm trying to find the smallest possible non-negative integer solutions to hundreds of fairly large equations systems . An average example would be the following: ...
0
votes
1answer
33 views

Errors within code to change the intersection of two Log Functions

I have been asked to produce a "parametric log-log plot of s=f(y) as a function of t=g(y), where ...
2
votes
1answer
57 views

Function does not take many inputs, and cannot plot correctly using Listplot

I am a beginner with Mathematica. I have a function which is defined as follows: $h(x) = \begin{cases} \hfill \frac{1}{x}\sin(x) & \text{if $x\neq 0$}\\ 1 & \text{...
0
votes
0answers
22 views

Different results when using ReplaceAll

Here's a riddle. I have a matrix QQsimple with some algebraic expressions. For example: QQsimple[[36, 22]] evaluates to: ...
2
votes
0answers
47 views

What are key differences between InputNotebook and EvaluationNotebook?

I am still new to Mathematica but advancing to a point of programming notebook and cell manipulations using native commands. Sometimes they call for specifying ...
2
votes
0answers
82 views

Is there any way to change the box-formatting behavior thoroughly?

Background The box-formmating behavior is affected by the downvalues of the symbol MakeBoxes. But the formatting behavior is not exactly ...
2
votes
1answer
72 views

Trouble evaluating this definite integral, either directly or with indefinite + limits

I have the function $$ \Sigma(x) = \frac{\sqrt{R^2-x^2}(\left| R\right| -1)}{\left(R^2-1\right) \left(x^2-1\right)}+\frac{\tan ^{-1}\left(\frac{\sqrt{R^2-x^2}}{\sqrt{R^2 \left(1-x^2\right)}}\right)-\...

1
2 3 4 5
27