Branching on error messages?
- To: mathgroup at smc.vnet.net
- Subject: [mg108946] Branching on error messages?
- From: Jack L Goldberg 1 <jackgold at umich.edu>
- Date: Thu, 8 Apr 2010 07:59:42 -0400 (EDT)
Hi Folks, In a module I have written I call Reduce and in the most common case, Reduce does exactly what I want. In some rarer cases, however, Reduce returns the error message Reduce::nsmet: ... (basically, Reduce doesn't know how to simplify transcendental equations.) Suppose in Line L6 of my module I have this code L6 = Reduce[L5, var, Reals]; I want something like this instead, L6 = If[ Reduce[L5, var, Reals] generates no error message, Reduce[L5,var,Reals], Module[ ... ]; So if there is an error message, we go to Module[...] which I hope corrects things by introducing numerical methods. An alternative is this: Define newReduce which acts like Reduce when no error message of the type Reduce::nsmet occurs and uses my numerical techniques otherwise. I am unsure how to code L6 or whether to explore defining my own newReduce? Any guidance is appreciated, as usual. Jack
- Follow-Ups:
- Re: Branching on error messages?
- From: "Carl K. Woll" <carlw@wolfram.com>
- Re: Branching on error messages?