Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Strange behavior from Evaluate[]' topicStudent Support Forum > General > Archives > "Strange behavior from Evaluate[]"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Forum Moderator
email me
02/28/13 11:51am

a) We may need to see a notebook with examples for the lower questions.
tstarg[x1_] := 1/(Evaluate[k1[x1] /. geod]) tstarg[2][[1]]
should not output anything.

b) Evaluate is noticed if it wraps a whole argument that usually is held. The URL link given covers that. An Evaluate inside the expression, like
1/(Evaluate[k1[x1] /. geod]) tstarg[2][[1]]
is ignored.

c) About the first question, NIntegrate is one of the numerical functions that pre-processes its first argument before inserting numbers for the variables. If the first argument does not play nicely with undefined variables, the pre-processing has trouble.

Often, after the warning, the function proceeds fine.

The best way to deal with this is to define a function to evaluate only when it is used with a number as the argument. (See, "Using ?NumericQ to Affect Order of Evaluation".) That way, the first argument to NIntegrate is just a function call,

k2[x_?NumericQ] := Evaluate[k1[x] /. geod]

NIntegrate[ k2[x1], {x1, Log[5], Log[7]}]


Subject (listing for 'Strange behavior from Evaluate[]')
Author Date Posted
Strange behavior from Evaluate[] user1639133 02/28/13 11:17am
Re: Strange behavior from Evaluate[] Forum Modera... 02/28/13 11:51am
Re: Strange behavior from Evaluate[] Bill Simpson 02/28/13 12:11pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic