Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematicas simplifications

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96311] Re: Mathematicas simplifications
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 11 Feb 2009 05:21:51 -0500 (EST)

On 2/10/09 at 5:56 AM, kilian at nihilnovi.de (Kilian Kilger) wrote:

>if I type in Mathematica 7 for example

>Select[Divisors[n],SquareFreeQ]

>It gives me

>Divisors[n]

>as a response, which is wrong.

Perhaps this isn't what you wanted or expected but it is
correct. Mathematica by default returns expressions unevaluated
when it is not possible to evaluate them. Until you give n a
value, it is impossible for Mathematica to determine the
divisors of n. Consequently, Divisors[n] returns Divisors[n]

>If I type

>f[n_] := Select[Divisors[n],SquareFreeQ]

>and then

>f[4]

>it gives me

>{1,2}

>which is correct. If I type (afterwards)

>f[n]

>again the wrong answer "Divisors[n]" is shown. What am I doing
>wrong?

Again, n is undefined so Mathematica returns the only result possible.



  • Prev by Date: Re: linear regression with errors in both variables
  • Next by Date: Re: Memory leak caused by JavaNew[...] (JLink package)
  • Previous by thread: Re: Mathematicas simplifications
  • Next by thread: Re: Mathematicas simplifications