MathGroup Archive 1999

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

Search the Archive

Re: Help needed with List!

  • To: mathgroup at
  • Subject: [mg16926] Re: Help needed with List!
  • From: "P.J. Hinton" <paulh>
  • Date: Thu, 8 Apr 1999 02:32:35 -0400
  • Organization: "Wolfram Research, Inc."
  • Sender: owner-wri-mathgroup at

On 6 Apr 1999 alvaroo at wrote:

> (i) I need to convert a long integer number in List format. For
> example if I had the number 123456 I need to convert it into
> {1,2,3,4,5,6}:  Is it possible with an instruction?

In[1]:= ? IntegerDigits
IntegerDigits[n] gives a list of the decimal digits in the integer n.
   IntegerDigits[n, b] gives a list of the base-b digits in the integer n.
   IntegerDigits[n, b, len] pads the list on the left with zeros to give a
   list of length len.

In[2]:= IntegerDigits[123456]

Out[2]= {1, 2, 3, 4, 5, 6}

> (ii) I need to delete from a List A the common elements with other
> List B:  for example if A = {1,2,3,4} and B = {1,2} I need to delete
> by an instruction the elements 1, 2 of List B from List A to obtain
> List C = {3,4}.  

In[3]:= ? Complement
Complement[eall, e1, e2, ... ] gives the elements in eall which are not in
   of the ei.

In[4]:= A = {1,2,3,4}

Out[4]= {1, 2, 3, 4}

In[5]:= B = {1,2}

Out[5]= {1, 2}

In[6]:= Complement[A, B]

Out[6]= {3, 4}

For more information on these functions, see _The Mathematica Book_ (Third
Edition).  If you are using the Mathematica 3.0 notebook front end, you
may be able to retrieve this content using the Help Browser.  Paste the
following expressions into a notebook and evaluate them.

FrontEndExecute[FrontEnd`HelpBrowserLookup["MainBook", {"3.1.3", "3.9"}]]

FrontEndExecute[FrontEnd`HelpBrowserLookup["MainBook", "1.8.8"]]

P.J. Hinton
Mathematica Programming Group           paulh at
Wolfram Research, Inc.        
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Re: Curve Fitting w/ Parametric Equations
  • Next by Date: Re: problem
  • Previous by thread: Re: Help needed with List!
  • Next by thread: Re: Help needed with List!