Skip to main content
Post Closed as "Duplicate" by xzczd, Roman, creidhne, Domen, bbgodfrey
deleted 4 characters in body
Source Link

I am trying to do some calculations on very long and difficult equations. Ultimately, I want to create a function to NIntegrate my result, but I want to set it as SetDelay (to be evaluated after placing the variables).

The problem can be showed at this simple example:

A = {{a, b}, {c, d}};

EVals = Eigenvalues[A];

EV1 = EVals[[1]];
EV2 = EVals[[2]];

DEV1 = D[EV1, a];
DEV2 = D[EV2, a];

F[a_, b_F[b_, c_, d_] := NIntegrate[DEV1 + DEV2, {a, 0, 1}];

But after evaluation, e.g., F[1,2 F[2,3,4], I get the symbolic expression.

I know, that in this example I can just copy-paste DEV1 and DEV2 directly to the F, but I am working with more difficult formulas, where I cannot do this.

I am trying to do some calculations on very long and difficult equations. Ultimately, I want to create a function to NIntegrate my result, but I want to set it as SetDelay (to be evaluated after placing the variables).

The problem can be showed at this simple example:

A = {{a, b}, {c, d}};

EVals = Eigenvalues[A];

EV1 = EVals[[1]];
EV2 = EVals[[2]];

DEV1 = D[EV1, a];
DEV2 = D[EV2, a];

F[a_, b_, c_, d_] := NIntegrate[DEV1 + DEV2, {a, 0, 1}];

But after evaluation, e.g., F[1,2,3,4], I get the symbolic expression.

I am trying to do some calculations on very long and difficult equations. Ultimately, I want to create a function to NIntegrate my result, but I want to set it as SetDelay (to be evaluated after placing the variables).

The problem can be showed at this simple example:

A = {{a, b}, {c, d}};

EVals = Eigenvalues[A];

EV1 = EVals[[1]];
EV2 = EVals[[2]];

DEV1 = D[EV1, a];
DEV2 = D[EV2, a];

F[b_, c_, d_] := NIntegrate[DEV1 + DEV2, {a, 0, 1}];

But after evaluation, e.g., F[2,3,4], I get the symbolic expression.

I know, that in this example I can just copy-paste DEV1 and DEV2 directly to the F, but I am working with more difficult formulas, where I cannot do this.

Source Link

Problem with SetDelay

I am trying to do some calculations on very long and difficult equations. Ultimately, I want to create a function to NIntegrate my result, but I want to set it as SetDelay (to be evaluated after placing the variables).

The problem can be showed at this simple example:

A = {{a, b}, {c, d}};

EVals = Eigenvalues[A];

EV1 = EVals[[1]];
EV2 = EVals[[2]];

DEV1 = D[EV1, a];
DEV2 = D[EV2, a];

F[a_, b_, c_, d_] := NIntegrate[DEV1 + DEV2, {a, 0, 1}];

But after evaluation, e.g., F[1,2,3,4], I get the symbolic expression.