<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Nullstellen Bisecverfahren]]></title><description><![CDATA[<p>Irgendwie hab ich grad einen vogel und seh nicht was ich falsch mache.</p>
<pre><code class="language-cpp">double bisec(const double a, const double b){

double c = (a+b)/2 ;

for(int k=0;k&lt;100;++k){

if (testfunction(c)==0) 
   break; 	

else if (testfunction(c)*testfunction(a)&lt;0)
  c = (a+c)/2;

else if (testfunction (c)*testfunction(b)&lt;0)
  c = (c+b)/2;

}

 return c;

}
</code></pre>
<p>Ich habe ganz einfache funktionen ausprobiert, wo es schon nach wenigen schritten eigentlich die nullstele sein sollte, aber da kommt bei mir immer schwachsin, ich seh grad überhaupt nicht, was ich falsch mache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/306169/nullstellen-bisecverfahren</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 10:05:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/306169.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Jul 2012 01:34:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Nullstellen Bisecverfahren on Fri, 20 Jul 2012 01:34:48 GMT]]></title><description><![CDATA[<p>Irgendwie hab ich grad einen vogel und seh nicht was ich falsch mache.</p>
<pre><code class="language-cpp">double bisec(const double a, const double b){

double c = (a+b)/2 ;

for(int k=0;k&lt;100;++k){

if (testfunction(c)==0) 
   break; 	

else if (testfunction(c)*testfunction(a)&lt;0)
  c = (a+c)/2;

else if (testfunction (c)*testfunction(b)&lt;0)
  c = (c+b)/2;

}

 return c;

}
</code></pre>
<p>Ich habe ganz einfache funktionen ausprobiert, wo es schon nach wenigen schritten eigentlich die nullstele sein sollte, aber da kommt bei mir immer schwachsin, ich seh grad überhaupt nicht, was ich falsch mache <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2234238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2234238</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Fri, 20 Jul 2012 01:34:48 GMT</pubDate></item><item><title><![CDATA[Reply to Nullstellen Bisecverfahren on Fri, 20 Jul 2012 07:04:16 GMT]]></title><description><![CDATA[<p>Fließkommazahlen prüft man nicht mit operator== auf Gleichheit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2234265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2234265</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Fri, 20 Jul 2012 07:04:16 GMT</pubDate></item><item><title><![CDATA[Reply to Nullstellen Bisecverfahren on Fri, 20 Jul 2012 07:08:27 GMT]]></title><description><![CDATA[<p>Der Fehler liegt im Wesentlichen darin, dass a und b nicht verändert werden. Damit bleibt das Intervall immer gleich groß und der Wert von c hüpft dort zwar hin und her, nähert sich aber nie der Nullstelle.</p>
<p>- beseitige das const vor a und b im Aufruf.<br />
- verschiebe die Berechnung von c in die Schleife, hinter Zeile 5<br />
- ersetze c = (a+c)/2 (Zeile 13) durch b=c; und c = (c+b)/2; (Zeile 16) durch a=c;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2234266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2234266</guid><dc:creator><![CDATA[Werner_logoff]]></dc:creator><pubDate>Fri, 20 Jul 2012 07:08:27 GMT</pubDate></item><item><title><![CDATA[Reply to Nullstellen Bisecverfahren on Fri, 20 Jul 2012 08:32:24 GMT]]></title><description><![CDATA[<p>oh man danke, ich bin auch blöd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2234282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2234282</guid><dc:creator><![CDATA[Namal]]></dc:creator><pubDate>Fri, 20 Jul 2012 08:32:24 GMT</pubDate></item></channel></rss>