<?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[e^x Reihenentwicklung, Ausgabe nur 1.#inf]]></title><description><![CDATA[<p>Hallo ich bin neu hier und bereite mich auf meine Klausur vor.<br />
Habe versucht die e<sup>x</sup> Reihe SUMME( v=0 -&gt; unendlich ÜBER (x<sup>v</sup>/v!)) zu implementieren.</p>
<p>Leider verursacht die Ausgabe ständig nur 1.#INF anstatt Zahlen. Woran könnte das liegen?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;

using std::cout;
using std::cin;
using std::endl;

double factorial(double i);
double exp(double k, double x);

int main()
{

	double k,x;
	double schleife=0.0;

	cout&lt;&lt;&quot;Bitte k eingeben: &quot;;
	cin&gt;&gt;k;
	cout&lt;&lt;&quot;Bitte x eingeben: &quot;;
	cin&gt;&gt;x;

	for(int i=0; i&lt;k; i++)
	{
		schleife=(schleife+((exp(k,x))/(factorial(i))));
		cout.precision(10);
		cout&lt;&lt;&quot;Ergebnis bei k= &quot;&lt;&lt;i&lt;&lt;&quot;= &quot;&lt;&lt;schleife&lt;&lt;endl;
	}

	system(&quot;PAUSE&quot;);
	return 0;
}

double factorial(double i)
{
	if(i&gt;1)
	{
		return i * factorial(i-1);
	}
	return i;
}

double exp(double k, double x)
{
	double y;
	y=x;

	if(k==0)
	{
		y=1;
		return y;
	}

	else
	{
		for (k; k&gt;1; k--)
		{
			y=y*x;
		}
		return y;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/248557/e-x-reihenentwicklung-ausgabe-nur-1-inf</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 23:04:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/248557.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Aug 2009 13:50:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 13:50:47 GMT]]></title><description><![CDATA[<p>Hallo ich bin neu hier und bereite mich auf meine Klausur vor.<br />
Habe versucht die e<sup>x</sup> Reihe SUMME( v=0 -&gt; unendlich ÜBER (x<sup>v</sup>/v!)) zu implementieren.</p>
<p>Leider verursacht die Ausgabe ständig nur 1.#INF anstatt Zahlen. Woran könnte das liegen?</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;

using std::cout;
using std::cin;
using std::endl;

double factorial(double i);
double exp(double k, double x);

int main()
{

	double k,x;
	double schleife=0.0;

	cout&lt;&lt;&quot;Bitte k eingeben: &quot;;
	cin&gt;&gt;k;
	cout&lt;&lt;&quot;Bitte x eingeben: &quot;;
	cin&gt;&gt;x;

	for(int i=0; i&lt;k; i++)
	{
		schleife=(schleife+((exp(k,x))/(factorial(i))));
		cout.precision(10);
		cout&lt;&lt;&quot;Ergebnis bei k= &quot;&lt;&lt;i&lt;&lt;&quot;= &quot;&lt;&lt;schleife&lt;&lt;endl;
	}

	system(&quot;PAUSE&quot;);
	return 0;
}

double factorial(double i)
{
	if(i&gt;1)
	{
		return i * factorial(i-1);
	}
	return i;
}

double exp(double k, double x)
{
	double y;
	y=x;

	if(k==0)
	{
		y=1;
		return y;
	}

	else
	{
		for (k; k&gt;1; k--)
		{
			y=y*x;
		}
		return y;
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1767029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767029</guid><dc:creator><![CDATA[neotronic]]></dc:creator><pubDate>Wed, 26 Aug 2009 13:50:47 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 14:06:13 GMT]]></title><description><![CDATA[<p>In Zeile 41 muss es</p>
<pre><code class="language-cpp">return 1;
</code></pre>
<p>heißen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767052</guid><dc:creator><![CDATA[Werner_logoff]]></dc:creator><pubDate>Wed, 26 Aug 2009 14:06:13 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 14:09:26 GMT]]></title><description><![CDATA[<p>danke für den Tipp!</p>
<p>Er gibt jetzt Zahlen aus, aber leider nicht die e Reihe... kann jemand noch nen Tipp geben wie die richtig e-Reihe raus kommt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767054</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767054</guid><dc:creator><![CDATA[neotronic]]></dc:creator><pubDate>Wed, 26 Aug 2009 14:09:26 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 14:14:49 GMT]]></title><description><![CDATA[<p>neotronic schrieb:</p>
<blockquote>
<p>danke für den Tipp!</p>
<p>Er gibt jetzt Zahlen aus, aber leider nicht die e Reihe... kann jemand noch nen Tipp geben wie die richtig e-Reihe raus kommt?</p>
</blockquote>
<pre><code class="language-cpp">schleife=(schleife+((exp(i,x))/(factorial(i))));
</code></pre>
<p>Das alles hättest du wunderbar leicht mit einem Debugger rausfinden können. Selbst einfachste Testausgaben deiner Funktionen hätten gereicht.</p>
<p>Übrigens ist deine Fakultät von einem double Wert doch irgendwie komisch und auch andere Aspekte deines Programms sind unnötig umständlich. Sagt dir beispielsweise die Funktion pow irgendwas?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767060</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767060</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 26 Aug 2009 14:14:49 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 14:20:57 GMT]]></title><description><![CDATA[<p>Okay, ich habs gesehen. Dankeschön... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>PS: Nein, die Funtkion pow kenn ich nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767061</guid><dc:creator><![CDATA[neotronic]]></dc:creator><pubDate>Wed, 26 Aug 2009 14:20:57 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 15:58:49 GMT]]></title><description><![CDATA[<p>Selbst pow ist schon überdimensioniert. Tipp: Schreibe dir die der Reihe unterliegende Folge $$(\frac{x^\nu}{\nu!})_{\nu\in\mathbb{N}_0}$$ mal in rekursiver Form auf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767067</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767067</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Wed, 26 Aug 2009 15:58:49 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 15:55:24 GMT]]></title><description><![CDATA[<p>Heyho danke für eure Antworten.</p>
<p>du meinst: 1 + x + x<sup>2</sup>/2 + x<sup>3</sup>/6 ?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767134</guid><dc:creator><![CDATA[neotronic]]></dc:creator><pubDate>Wed, 26 Aug 2009 15:55:24 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 17:06:11 GMT]]></title><description><![CDATA[<p>neotronic schrieb:</p>
<blockquote>
<p>Heyho danke für eure Antworten.</p>
<p>du meinst: 1 + x + x<sup>2</sup>/2 + x<sup>3</sup>/6 ?!</p>
</blockquote>
<p>schreibs mal so:</p>
<p>x^0 / 0! = 1/1 = 1<br />
x^1 / 1! = x/1 = x<br />
x^2 / 2! = x²/2<br />
x^3 / 3! = x³/6</p>
<p>...</p>
<p>siehst du es jetzt? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767172</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Wed, 26 Aug 2009 17:06:11 GMT</pubDate></item><item><title><![CDATA[Reply to e^x Reihenentwicklung, Ausgabe nur 1.#inf on Wed, 26 Aug 2009 17:15:59 GMT]]></title><description><![CDATA[<p>Ich meinte so:</p>
\\[  
\exp x = \sum_{\nu=0}^{\infty}a_{\nu}\\]
<p>mit<br />
\\[ a_0 := 1, \\]<br />
\\[a_{\nu} := a_{\nu-1}\frac{x}{\nu}, \quad\nu=1,2,\ldots\\]<br />
Ergibt einen sehr viel schöneren Algorithmus. Insbesondere funktioniert es auch für mehr Reihenglieder als bei dir, weil dir sehr schnell die Fakultäten um die Ohren fliegen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1767179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1767179</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Wed, 26 Aug 2009 17:15:59 GMT</pubDate></item></channel></rss>