MathGroup Archive 2009

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

Search the Archive

Re: Mathematicas simplifications


It's doing exactly what I'd expect if n has no value.

n =.;
Select[Divisors[n], SquareFreeQ]

Divisors[n]

which is not, BTW, wrong. Neither is it RIGHT, I admit, since it doesn't  
mean anything.

You could define and use f this way, if it helps:

Clear[f]
f[n_Integer] := Select[Divisors[n], SquareFreeQ]
f[n_] = HoldForm@Select[Divisors[n], SquareFreeQ];

f[4]

{1, 2}

f[n]

\!\(\*
TagBox[
RowBox[{"Select", "[",
RowBox[{
RowBox[{"Divisors", "[", "n", "]"}], ",", "SquareFreeQ"}], "]"}],
HoldForm]\)

f[n] /. n -> 4 // ReleaseHold

{1, 2}

Bobby

On Tue, 10 Feb 2009 04:56:39 -0600, Kilian Kilger <kilian at nihilnovi.de>  
wrote:

> Hello,
>
> if I type in Mathematica 7 for example
>
> Select[Divisors[n],SquareFreeQ]
>
> It gives me
>
> Divisors[n]
>
> as a response, which is wrong. 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?  
> Same happens in many other circumstances.
>
> Thanks in advance,
> Kilian.
>



-- 
DrMajorBob at longhorns.com


  • Prev by Date: Re: Inappropriate kernel limits!
  • Next by Date: Re: very slow Save[]s on Mathematica V7??
  • Previous by thread: Mathematicas simplifications
  • Next by thread: Re: Mathematicas simplifications