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


Groups > comp.soft-sys.math.mathematica > #3122 > unrolled thread

Re: Problem with Position

Started byLeonid Shifrin <lshifr@gmail.com>
First post2011-06-16 08:01 +0000
Last post2011-06-16 08:01 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Problem with Position Leonid Shifrin <lshifr@gmail.com> - 2011-06-16 08:01 +0000

#3122 — Re: Problem with Position

FromLeonid Shifrin <lshifr@gmail.com>
Date2011-06-16 08:01 +0000
SubjectRe: Problem with Position
Message-ID<itcd98$cvh$1@smc.vnet.net>
Dominic,

It is not clear to me whether you wanted to compare numbers or strings
obtained from numbers, but in either case using  forms such as InputForm,
OutputForm etc is not what you want. For numbers, my previous recipe should
work. For strings, you should be able to use Position directly provided that
the strings in question must be exactly the same. If this does not help,
please provide a minimal self-contained example illustrating the problem,
since it is hard to understand what is causing the difficulty without it.

Regards,
Leonid


On Wed, Jun 15, 2011 at 4:07 PM, Dominic W=F6rner <
dominic.woerner@mpi-hd.mpg.de> wrote:

> Hi Leonid,
>
> many thanks for your advise but I still have one problem
>
> When I write to a file using WriteString[str, ToString[number]] it will be
> written in OutputForm. Now I thought using your advice It should work with
> Position[..., x_/;x==OutputForm[number]]
> but unfortunately it doesn't
> Am 15.06.2011 um 12:59 schrieb Leonid Shifrin:
>
> Hi Dominic,
>
> This is most likely a symbolic/numerical issue. Position is based on
> symbolic rather than numeric comparisons.
> You may have success with
>
> Flatten@Position[data[[All,1]],x_/;x==0.785398]
>
> Here is one of the most recent related discussions:
>
> http://stackoverflow.com/questions/5750623/using-position-correctly
>
> Regards,
> Leonid
>
>
> On Wed, Jun 15, 2011 at 3:20 PM, Dominic W=F6rner <
> dominic.woerner@mpi-hd.mpg.de> wrote:
>
>> Hi,
>>
>> I have to import data from a csv file. And I get a structure
>> data[[rows]]={first, second,...}.
>> Now I want to find the rows in which, say the first entry has a specific
>> values.
>> By just looking at the data there are for example entries with value
>> 0.785398.
>> But when I try Flatten@Position[data[[All,1]],0.785398] or with
>> ToString[0.785398] I just get {}
>>
>> What's the problem here?
>>
>> Best,
>> Dominic
>>
>>
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web