<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aptech &#187; Answers for "Command "indnv" cannot find index of a value"</title>
	<atom:link href="http://www.aptech.com/questions/using-command-indnv/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aptech.com</link>
	<description></description>
	<lastBuildDate>Fri, 08 Feb 2013 19:12:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>By: aptech</title>
		<link>http://www.aptech.com/questions/using-command-indnv/#answer-3044</link>
		<comments>http://www.aptech.com/questions/using-command-indnv/#answer-3044#comments</comments>
		<pubDate>Sat, 02 Feb 2013 19:48:49 +0000</pubDate>
		<dc:creator>aptech</dc:creator>
		
		<guid isPermaLink="false">http://www.aptech.com/questions/using-command-indnv/#answer-3044</guid>
		<description><![CDATA[The problem here is not the size of b, but rounding errors inherent in floating point arithmetic. If you print all the digits in b you will see the difference. format /rd 16,16; print b; You will see that that &#8230; <a href="http://www.aptech.com/questions/using-command-indnv/#answer-3044">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The problem here is not the size of <tt>b</tt>, but rounding errors inherent in floating point arithmetic. If you print all the digits in <tt>b</tt> you will see the difference.</p>
<pre>
<span style="color:#0000FF">format</span> /rd 16,16;
<span style="color:#0000FF">print</span> b;
</pre>
<p>You will see that that second to last element of <tt>b</tt> is:</p>
<pre>
0.9990000000000008
</pre>
<p>and if you print 0.999, it will be:</p>
<pre>
0.9990000000000000
</pre>
<p>This is not a problem particular to GAUSS, it is a limitation of the double precision values that computers use.  You can avoid this problem by making your original sequence from -1 to 1000 and the dividing by 1000 like this:</p>
<pre>
z = 1000;
b = seqa(-1, 1, z+2)./z;
a = { 0.049, 0.999 };
c = indnv(a, b);
<span style="color:#0000FF">print</span> c;
</pre>
<p>You should see:</p>
<pre>
51.0000000000000000
1001.0000000000000000
</pre>
<p>I think this should work for you, because it does not require you to know any more information at the time of the creation of <tt>b</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aptech.com/questions/using-command-indnv/#answer-3044/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>By: laurafish</title>
		<link>http://www.aptech.com/questions/using-command-indnv/#answer-3043</link>
		<comments>http://www.aptech.com/questions/using-command-indnv/#answer-3043#comments</comments>
		<pubDate>Sat, 02 Feb 2013 19:12:29 +0000</pubDate>
		<dc:creator>laurafish</dc:creator>
		
		<guid isPermaLink="false">http://www.aptech.com/questions/using-command-indnv/#answer-3043</guid>
		<description><![CDATA[I mean b has many elements. I wonder why the following does not work: z=1000; b=seqa(-1/z,1/z,z+2); a=0.999; indnv(0.999,b);]]></description>
			<content:encoded><![CDATA[<p>I mean <tt>b</tt> has many elements. I wonder why the following does not work:</p>
<pre>
z=1000;
b=seqa(-1/z,1/z,z+2);
a=0.999;
indnv(0.999,b);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.aptech.com/questions/using-command-indnv/#answer-3043/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>By: aptech</title>
		<link>http://www.aptech.com/questions/using-command-indnv/#answer-3042</link>
		<comments>http://www.aptech.com/questions/using-command-indnv/#answer-3042#comments</comments>
		<pubDate>Sat, 02 Feb 2013 18:51:27 +0000</pubDate>
		<dc:creator>aptech</dc:creator>
		
		<guid isPermaLink="false">http://www.aptech.com/questions/using-command-indnv/#answer-3042</guid>
		<description><![CDATA[When you say that b is large, do you mean that b has many elements, or that the individual values in b are large? Do these examples work for you? Example 1: Many elements in b b = rndn(1e7, 1); &#8230; <a href="http://www.aptech.com/questions/using-command-indnv/#answer-3042">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you say that <tt>b</tt> is large, do you mean that <tt>b</tt> has many elements, or that the individual values in <tt>b</tt> are large?</p>
<p>Do these examples work for you?<br />
<strong>Example 1: Many elements in <tt>b</tt></strong></p>
<pre>
b = rndn(1e7, 1);               
idx = { 9, 41, 10009, 9999746 };
a = b[idx];
out = indnv(a,b);
print out; 
</pre>
<pre>
 9.0000000 
 41.000000 
 10009.000 
 9999746.0 
</pre>
<p><strong>Example 2: Large values in <tt>b</tt></strong><br />
Continuing with the data from above:</p>
<pre>
b = b.*1e90;
a = b[idx];
out2 = indnv(a, b);
print out2;
</pre>
<pre>
 9.0000000 
 41.000000 
 10009.000 
 9999746.0 
</pre>
<p>Both of these work for me using GAUSS version 13. Let me know if these work for you and/or a more specific description of your problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aptech.com/questions/using-command-indnv/#answer-3042/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.aptech.com @ 2013-02-09 01:22:42 --