Re: How to specify that a variable is an Integer?
- To: mathgroup at smc.vnet.net
- Subject: [mg5085] Re: How to specify that a variable is an Integer?
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Fri, 25 Oct 1996 22:48:48 -0400
- Organization: Michigan State University
- Sender: owner-wri-mathgroup at wolfram.com
In article <544cvu$5s7 at dragonfly.wolfram.com>, "Economics Department" <jruiz at bu.edu> wrote: -> I have an indefinite integral of a function that contains a and b as ->parameters. Mathematica is able to compute the indefinite integral when it ->is supplied integer values of a and b but cannot solve it when they are ->left as parameters. -> The question is: Is there any way of telling mathematica that the ->parameters a and b are Positive Integer numbers? -> ->Juan M. Ruiz ->Boston University ->Department of Economics ->email: jruiz at bu.edu -> Assuming you're in version 2.x.y of Mma (I don't have version 3 yet), you can probably convince Mma, via upvalues, that Positive[a] evaluates True and IntegerQ[a] evaluates True (similarly for b), but I suspect that won't buy you much. Are you sure the problem is with Mma recognizing the symbols represent positive integers, as opposed to Mma not having specify numerical values for them? As an example, Expand[ (x + y)^3 ] and Expand[ (x + y)^4 ] produce the expansions you expect, but Positive[ n ] ^= True; IntegerQ[ n ] ^= True; Expand[ (x + y)^n ] still spits back (x + y)^n, because Mma can't do anything with it (not knowing, among other things, how many terms the result would contain). -- Paul ************************************************************************** * Paul A. Rubin Phone: (517) 432-3509 * * Department of Management Fax: (517) 432-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE