Message Boards Message Boards

Expound on function BinarySearch[list,key, Function]?

Posted 7 years ago

Please explain the requirements ( order of execution, compiled?, other constraints) on "Function" in BinarySearch[list, key, Func] I can define

Func[x_]:= x^2 

which works fine as a test example, but the function that I am trying to use without success is:

Func=(NIntegrate[ kernel[s],{s, x, (x+1)}]) / (NIntegrate[ kernel[s],{s, (x-1), x}]) 

which produces an error saying BS "variable is non-numeric" which suggests that Func was not evaluated before BS was evaluated. How do I get M to evaluate Func before evaluating BS?? Many thanks for your assistance.

POSTED BY: Gerald Kamin
2 Replies

What exactly is the code that elicited the message?

POSTED BY: Daniel Lichtblau

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your posts and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract