Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2985

replace with closest value

From graser <graser@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject replace with closest value
Date 2011-06-07 10:45 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iskvgs$5nt$1@smc.vnet.net> (permalink)

Show all headers | View raw


Hi

I have a some question for you!

Let's say there is a list like that
AA={1.3, 1.5, 1.6, 1.8, 2.1, 2.3, 2.6, 2.9, 3.3, 3.7, 4.2, 4.7, 5.2,
5.9, 6.6, 7.4, 8.3, 9.4, 10.6, 11.8, 13.1, 14.8, 16.9, 19., 21.5,
23.6}.
Length[AA]=26
I want to replace the element in the list with a closest number I
specify in my list  BB,
BB={1.2, 1.4, 1.6, 1.8, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 5,
6, 8 , 10 , 15, 20, 25, 40, 60, 100},
Length[BB]=23
so that the list AA after I replace will be

AA={1.2, 1.5, 1.6, 1.8, 2. 2.25, 2.5,3.........20, 25}
Length[AA]=26.

I wonder if anyone can help me to solve this problem!

Back to comp.soft-sys.math.mathematica | Previous | NextNext in thread | Find similar | Unroll thread


Thread

replace with closest value graser <graser@gmail.com> - 2011-06-07 10:45 +0000
  Re: replace with closest value Thomas <thomas.a.lanz@gmail.com> - 2011-06-08 11:14 +0000
  Re: replace with closest value Thomas <thomas.a.lanz@gmail.com> - 2011-06-08 11:14 +0000
  Re: replace with closest value Stefan Salanski <wutchamacallit27@gmail.com> - 2011-06-08 11:16 +0000
  Re: replace with closest value Yves Klett <yves.klett@googlemail.com> - 2011-06-09 09:44 +0000

csiph-web