Programming
- To: mathgroup at smc.vnet.net
- Subject: [mg2819] Programming
- From: Jack Goldberg <jackgold at umich.edu>
- Date: Wed, 20 Dec 1995 01:16:42 -0500
- Organization: University of Michigan - College of Literature, Science, and TheArts
Hi Group; Here is my problem: Suppose BuiltIn[expr_] is an operation either native to Mma or an operation appearing in some complicated, lengthly package. Suppose that BuiltIn does not always work. (An example might be Integrate which fails to find the anti-derivative Integrate[1/(1+Log[x]),x].) When BuiltIn fails I want to try MyOperation[expr_], but ONLY if BuiltIn fails! Interactively, this is trivial. Whenever BuiltIn fails, I recognize the failure because Mma echos the Input in the Output. (The output of Integrate[1/(1+Log[x]),x] is itself.) I then apply MyOperation[expr_]. But how does one code this so that Mma will do MyOperation automatically? That is, I want a snippet of code that determines the failure of BuiltIn and then applies MyOperation. (In my illustrative example, suppose I have written a general change of variable routine. I want this routine to go in effect whenever Integrate returns unsimplified. For the example given u = Log[x] converts the integral into one recognizable by Mma. So my code will recognize the fail and call "change of variable" without my intervention. Let me make clear that the integration example is only an illustration of the problem, not the reason for this posting.) Jack Goldberg University of Michigan