<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Simspons Rule Program</title>
		<link>http://tibasicdev.wikidot.com/forum/t-757397/simspons-rule-program</link>
		<description>Posts in the discussion thread &quot;Simspons Rule Program&quot; - How to do calculations with a variable that contains defined variable values in the variable, inside the program? (If that makes sense?)</description>
				<copyright></copyright>
		<lastBuildDate>Fri, 14 Aug 2026 10:06:06 +0000</lastBuildDate>
		
					<item>
				<guid>http://tibasicdev.wikidot.com/forum/t-757397#post-1927413</guid>
				<title>Re: Simspons Rule Program</title>
				<link>http://tibasicdev.wikidot.com/forum/t-757397/simspons-rule-program#post-1927413</link>
				<description></description>
				<pubDate>Fri, 03 Jan 2014 13:24:07 +0000</pubDate>
				<wikidot:authorName>MasterChief2552</wikidot:authorName>				<wikidot:authorUserId>1673174</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I am not familiar with the Ti Nspire CX CAS, but basically you can make the user to input the equation as a string, and then you can use <a href="http://tibasicdev.wikidot.com/expr">expr(</a> for getting the y value at X.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://tibasicdev.wikidot.com/forum/t-757397#post-1927161</guid>
				<title>Simspons Rule Program</title>
				<link>http://tibasicdev.wikidot.com/forum/t-757397/simspons-rule-program#post-1927161</link>
				<description></description>
				<pubDate>Fri, 03 Jan 2014 02:23:49 +0000</pubDate>
				<wikidot:authorName>Synex</wikidot:authorName>				<wikidot:authorUserId>1803370</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p><strong><span style="text-decoration: underline;">So for introduction,</span></strong><br /> I'm trying to create a program in my Ti Nspire CX CAS that will give me the solution (with working out) to approximating areas under a curve using the Simpsons Rule/Law.</p> <p><strong>For those unfamiliar with the &quot;Simpsons Rule&quot; or the like, it is simply a formula that approximates the answer of an integral.</strong></p> <div class="code"> <pre><code>For example: Integral of 2x with limits 0 to 3 would result in an exact answer of 3.</code></pre></div> <p><strong>The Simpsons Rule uses the following equation so solve</strong></p> <div class="code"> <pre><code>h/3[(first ordinate + last ordinate) + 4(sum of odd ordinates) +2(sum of even ordinates)]</code></pre></div> (Slightly 'funky' I know, it basically breaks up the area into strips with quadratic functions and then some other 'stuff' not important to this question to find the solution) <p><strong><span style="text-decoration: underline;">So My Code,</span></strong><br /> In order to understand why the code below is doing what it does (for those who do not understand the Simpsons Rule, or need to freshen up) I suggest you Google 'Simpsons Rule'. =P</p> <div class="code"> <pre><code>Define LibPub srule(b,a,n)= Prgm :Local b,a,h,n,x,xx :((b-a)/(n))→h :a→x :2*x^(2)→a :Disp &quot;Usage: srule(b,a,n)&quot; :Disp &quot;(where n=number of strips &amp; b,a=integral limits)&quot; :0→xx :Disp &quot;x&quot;&amp;string(xx)&amp;&quot;=&quot;&amp;string(a) :While x&lt;b :DelVar a :xx+1→xx :x+h→x :2*x^(2)→a :Disp &quot;x&quot;&amp;string(xx)&amp;&quot;=&quot;&amp;string(a) :Cycle :EndWhile :Disp &quot;End of Program&quot; :EndPrgm</code></pre></div> <p><strong><span style="text-decoration: underline;">The Result of My Code (So Far),</span></strong></p> <div class="code"> <pre><code>Usage: srule(b,a,n) (where n=number of strips &amp; b,a=integral limits) &quot;x0=0&quot; &quot;x1=8&quot; &quot;x2=32&quot; &quot;x3=72&quot; End of Program</code></pre></div> (Notice this code does not actually find the area under the curve (yet) this is the working out of the exercise) <p><strong><span style="text-decoration: underline;">&quot;Sooo, Whats the Problem?</span></strong><br /> Well, the output of the code is correct, the working out for the (not yet found) solution is being displayed correctly. the problem is, if you look back at the code, you will see the <strong>function</strong> that we are trying to find the area of is <strong>hard-coded</strong> into the program: <span style="text-decoration: underline;"><strong>2*x^(2)</strong></span> (Found twice in the code).</p> <p>I am looking for a way to use the program by being able to state what the function is that we are trying to approximate the area of.</p> <p><strong>-</strong> I have tried using y as a variable: srule(<strong>y</strong>,b,a,n) - however when writing 2*x^(2) It is treated as a string (or something) and outputs the answer as 2*x^(2) INSTEAD OF actually substituting in the x value, that was very well defined in the program beforehand grr =(</p> <p>So I guess my problem is, how do I do calculations from a variable that contains x values defined inside the program? Do I need to Define a Function of some sort? Or am I just making a silly mistake somewhere? Or is it all wrong =( ?</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>