Re: Help! Sin[n Pi] (n Integer)
- To: mathgroup at smc.vnet.net
- Subject: [mg8984] Re: [mg8942] Help! Sin[n Pi] (n Integer)
- From: Mark Evans <evans at gte.net>
- Date: Tue, 7 Oct 1997 03:35:30 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Greg, Yes, it is exactly the same type of problem. In Mathematica, there is one and only one type of undefined symbol, and that is the complex number type. An undefined symbol cannot be declared real, matrix, integer, or anything else. This is a *big* problem with Mathematica. The closest approach to a type declaration is ComplexExpand. There is no equivalent IntegerExpand. You might also look at upvalues, but I have the feeling they are somewhat unreliable. In your case you might try something like IntegerQ[n] ^= True (but check with the book). I attempted this with your expressions and they did not simplify. Of course, you might want to try putting your equations in exponential form. My sense is that sooner or later, the company will have to undertake a fundamental redesign of much of the software in order to allow what we would call in other languages "types." For example, try to write out and solve any matrix equations of your choice where the matrices are identified by symbols. It can't be done. You have to spell out your matrix element-by-element, which means you can't use Mathematica to perform algebra on theoretical matrix systems with arbitrary dimensions. The Sqrt[a] problem is another classic that keeps reappearing on the newsgroup. So the best course of action is to pay close attention to your equations and simplify them by hand, or get another program that can do the job. Best regards, Mark Evans > > Does anyone know if there's a way to specify that a variable is an > integer? > > I'm taking a conduction class (with *lots* of separation of variables > problems) and the quantities Sin[n Pi] or Cos[(2n+1)/2 Pi] come > up constantly. I can dispose of them with replacement rules, but I was > wondering if there's a way to "tag" n as an integer so that Mma will > automatically kill the Sin and Cos terms later in the derivations. > > It seems like the "specify that a is real so that Sqrt[a^2] automatically > reduces to a without using PowerExpand" problem from way back and I don't > remember the solution (if there was one) > > Thanks! > > Greg Anderson > dwarf at wam.umd.edu