<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title><![CDATA[Physics Forums - Programming & Comp Sci]]></title>
		<link>http://www.physicsforums.com</link>
		<description>Computer algorithms, data structures, A.I., systems, databases, communications, security...</description>
		<language>en</language>
		<lastBuildDate>Fri, 24 May 2013 09:50:04 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.physicsforums.com/images/physicsforums/misc/rss.jpg</url>
			<title><![CDATA[Physics Forums - Programming & Comp Sci]]></title>
			<link>http://www.physicsforums.com</link>
		</image>
		<item>
			<title>How to calculate arithmetic sum of multiple strings</title>
			<link>http://www.physicsforums.com/showthread.php?t=693052&amp;goto=newpost</link>
			<pubDate>Wed, 22 May 2013 10:01:03 GMT</pubDate>
			<description>I have a MySQL database and I have the problem that queries take way too much time. I want to optimize the database and one way would be to save data...</description>
			<content:encoded><![CDATA[<div>I have a MySQL database and I have the problem that queries take way too much time. I want to optimize the database and one way would be to save data into a string, instead of in rows (the string would be replicates of the same condition).<br />
<br />
Each string is an interval of 4 seconds, to reduce the number of rows further I want to sum the data into 30-minute intervals. How can I sum strings? I'd like to use PHP for that. Shall I push replicates into an array?<br />
<br />
NULL values may be present<br />
<br />
To illustrate:<br />
time 1: 0,1,0,1,1,1,0<br />
time 2: 1,1,0,,0,1,1<br />
<br />
sum time 1+2: 1,2,0,1,1,2,1</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>Monique</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=693052</guid>
		</item>
		<item>
			<title>Akima bivariate interpolation</title>
			<link>http://www.physicsforums.com/showthread.php?t=693044&amp;goto=newpost</link>
			<pubDate>Wed, 22 May 2013 09:10:14 GMT</pubDate>
			<description><![CDATA[Anyone familiar with the bivariate interpolation method developed by Akima? 
 
I've been reading H. Akima, Commun. ACM 17, 18 (1974)...]]></description>
			<content:encoded><![CDATA[<div>Anyone familiar with the bivariate interpolation method developed by Akima?<br />
<br />
I've been reading <a href="http://dx.doi.org/10.1145/360767.360779" target="_blank">H. Akima, Commun. ACM 17, 18 (1974)</a> and trying to implement his method, but he actually doesn't describe how to do the interpolation!  The formulas for calculating the derivatives at each point are given, but not the polynomial that uses them for the interpolation.<br />
<br />
I've been trying to reverse engineer <a href="http://dx.doi.org/10.1145/360767.360797" target="_blank">his code</a>, but it's starting to take too much of my time. Any help welcome.</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>DrClaude</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=693044</guid>
		</item>
		<item>
			<title>Weird C++ Array Issue</title>
			<link>http://www.physicsforums.com/showthread.php?t=692955&amp;goto=newpost</link>
			<pubDate>Tue, 21 May 2013 21:31:17 GMT</pubDate>
			<description><![CDATA[Hello all, 
 
I'm not really a programmer at all, but I learned c++ for a while so I can do basic stuff. Having just finished my linear algebra class...]]></description>
			<content:encoded><![CDATA[<div>Hello all,<br />
<br />
I'm not really a programmer at all, but I learned c++ for a while so I can do basic stuff. Having just finished my linear algebra class I suddenly had an urge to write myself a simple matrix solver. I knew it wouldn't be easy (especially because of my lack of skill) but I was curious.<br />
<br />
It was going great until I noticed that large matrices would crash the program. It's very weird. If the number of entries in my matrix array is less than 10 then everything works fine, but the second it hits 10 it stops working. I get the following message:<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="6" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="alt2">
			<hr />
			
				Windows has triggered a breakpoint in Matrix.exe.<br />
<br />
This may be due to a corruption of the heap, which indicates a bug in Matrix.exe or any of the DLLs it has loaded.
			
			<hr />
		</td>
	</tr>
	</table>
</div>I was hoping someone could help me figure out why in gods name this is happening. I apologize in advance for the messiness of my code, I haven't yet made it nice (I was going to once I got the matrix entry down), but I put in a couple of notes to try and help.<br />
<br />
Thank you very much :)<br />
<br />
<strong>Edit:</strong> Something I should add: it doesn't crash when I made the size  &gt; 10 entries, it crashes when I enter the value for the 10th entry.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">// Matrix.cpp : main project file.<br />
<br />
#include &quot;stdafx.h&quot;<br />
#include &lt;iostream&gt;<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; using namespace std;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // definition of array values<br />
&nbsp; &nbsp; &nbsp; &nbsp; struct Entry<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long double Value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int mVal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int nVal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool pivot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // beginning of program<br />
&nbsp; &nbsp; &nbsp; &nbsp; int mSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int nSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int tSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Entry *toSize = new Entry[tSize]; // creating array<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Height of Matrix (M-Val):&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; mSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Width of Matrix (N-Val):&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; nSize;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tSize = (nSize * mSize);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int B;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Num = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int modN = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int modM = 1;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // entering values<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (B &lt; tSize)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; long double value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;What do you want entry &quot; &lt;&lt; &quot;(&quot; &lt;&lt; modM &lt;&lt; &quot;,&quot; &lt;&lt; modN &lt;&lt; &quot;)&quot; &lt;&lt; &quot; to be?&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toSize[B].Value = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (modN &lt; nSize)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toSize[B].nVal = modN;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toSize[B].mVal = modM;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toSize[B].nVal = modN;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modN = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; toSize[B].mVal = modM;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modM ++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B ++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Num ++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modN ++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; int T;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\n \n&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // printing values and placements<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (T &lt; tSize)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Value is:&quot; &lt;&lt; toSize[T].Value &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;M-Placement is:&nbsp; &quot; &lt;&lt; toSize[T].mVal &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;N-Placement is:&nbsp; &quot; &lt;&lt; toSize[T].nVal &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\n&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; T++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
// so it doesn't close immediately<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.clear();<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.ignore(255, '\n');<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.get();<br />
&nbsp; <br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>Vorde</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=692955</guid>
		</item>
		<item>
			<title>Problem setting integer precision in Fortran</title>
			<link>http://www.physicsforums.com/showthread.php?t=692573&amp;goto=newpost</link>
			<pubDate>Sun, 19 May 2013 20:30:58 GMT</pubDate>
			<description><![CDATA[I'm trying to work with big integers but for some reason this program won't compile: 
 
 
Code: 
--------- 
program prob003 
   implicit none 
  ...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to work with big integers but for some reason this program won't compile:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">program prob003<br />
&nbsp;  implicit none<br />
&nbsp;  integer, parameter :: k32 = selected_int_kind(32)<br />
&nbsp;  integer(kind=k32) :: num = 600851475143 <br />
end program prob003</code><hr />
</div>The file name is prob003.f90 and I'm trying to compile with gfortran without any option:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">gfortran prob003.f90</code><hr />
</div>I keep getting this error:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">prob003.f90:3.42:<br />
<br />
&nbsp;  integer(kind=k32) :: num = 600851475143 <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1<br />
Error: Integer too big for its kind at (1). This check can be disabled with the option -fno-range-check</code><hr />
</div>It does compile if I remove 3 digits from that number however. What am I doing wrong?</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>GabDX</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=692573</guid>
		</item>
		<item>
			<title>Nested Loops in Python (really stupid question)</title>
			<link>http://www.physicsforums.com/showthread.php?t=692078&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 18:20:14 GMT</pubDate>
			<description><![CDATA[My code isn't working, and the reason seems to be because nested for loops in python don't work according to my expectations. If I have some code...]]></description>
			<content:encoded><![CDATA[<div>My code isn't working, and the reason seems to be because nested for loops in python don't work according to my expectations. If I have some code like this:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><br />
f1 = open('name_of_file1.txt', 'r')<br />
f2 = open('name_of_file2.txt', 'r')<br />
<br />
for line1 in f1:<br />
&nbsp; &nbsp; #stuff at this level should happen once for every line in file1. Right???<br />
&nbsp; &nbsp; print line1<br />
&nbsp; &nbsp; for line2 in f2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #stuff at this level should happen once for every line in file2. Right???<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print line2</code><hr />
</div>My expectation for the output:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><br />
line 1 from file1<br />
.<br />
.<br />
.<br />
(all lines from file2 here)<br />
.<br />
.<br />
.<br />
line 2 from file1<br />
.<br />
.<br />
.<br />
(all lines from file2 here)<br />
.<br />
.<br />
.<br />
line 3 from file1<br />
.<br />
.<br />
.<br />
(all lines from file2 here)<br />
.<br />
.<br />
.<br />
et cetera</code><hr />
</div>The output that I ACTUALLY get:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">line 1 from file1<br />
.<br />
.<br />
.<br />
(all lines from file2 here)<br />
.<br />
.<br />
.<br />
(all remaining lines from file1 in sequence)</code><hr />
</div>Huh???</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>cepheid</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=692078</guid>
		</item>
		<item>
			<title><![CDATA[Calculating digits of Grahams' Number]]></title>
			<link>http://www.physicsforums.com/showthread.php?t=692047&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 15:20:08 GMT</pubDate>
			<description><![CDATA[I was reading random topics on Wikipedia the other day, and saw something about the first 500 numbers of Grahams' Number. 
 
I want to create a...]]></description>
			<content:encoded><![CDATA[<div>I was reading random topics on Wikipedia the other day, and saw something about the first 500 numbers of Grahams' Number.<br />
<br />
I want to create a program (probably in C#) to calculate as many digits from it as I can, but I haven't be able to make sense of the way it is done. Would someone be able to give me a hint of how the algorithm works. The only examples I was able to find were written in Python, which I wasn't really able to get my head around.</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>madmike159</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=692047</guid>
		</item>
		<item>
			<title>How to read APIs (Python)(PyBrain)</title>
			<link>http://www.physicsforums.com/showthread.php?t=691907&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 19:24:50 GMT</pubDate>
			<description>I am having trouble getting the hang of understanding APIs. After going through tutorials I find myself wanting to see what parameters I can pass to...</description>
			<content:encoded><![CDATA[<div>I am having trouble getting the hang of understanding APIs. After going through tutorials I find myself wanting to see what parameters I can pass to an object. So I look in the api and I see stuff like *args and **kwargs <br />
<br />
e.g. <br />
<a href="http://pybrain.org/docs/api/structure/networks.html?highlight=feedforward#pybrain.structure.networks.FeedForwardNetwork" target="_blank">http://pybrain.org/docs/api/structur...ForwardNetwork</a><br />
<br />
I've looked everywhere to try and find what those *args consist of, but I'm at a loss. Anyone frequently consult API documentation and know what I should be reading?</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>K29</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691907</guid>
		</item>
		<item>
			<title>G++ Shared Library Issues</title>
			<link>http://www.physicsforums.com/showthread.php?t=691786&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 03:16:04 GMT</pubDate>
			<description>Before I switched to Opensuse 12.3, I was running Arch, and doing something like: 
 
Code: 
--------- 
g++ -o test -I ./include/ -L ./lib/ -ltcod...</description>
			<content:encoded><![CDATA[<div>Before I switched to Opensuse 12.3, I was running Arch, and doing something like:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">g++ -o test -I ./include/ -L ./lib/ -ltcod -ltcodxx ./src/main.cpp</code><hr />
</div>with no problems occuring.<br />
<br />
Now, when I try to do that (with everything kept the exact same as when on Arch), I get:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: skipping incompatible lib/libtcod.so when searching for -ltcod<br />
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: cannot find -ltcod<br />
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: skipping incompatible lib/libtcodxx.so when searching for -ltcodxx<br />
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: cannot find -ltcodxx</code><hr />
</div>I also tried including -Wl,-rpath=./lib/ , but it still made no difference.<br />
<br />
Any help as to why the libraries have become incompatible all of a sudden would be greatly appreciated.</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>PPeter</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691786</guid>
		</item>
		<item>
			<title>Velocity from a data set</title>
			<link>http://www.physicsforums.com/showthread.php?t=691628&amp;goto=newpost</link>
			<pubDate>Tue, 14 May 2013 07:23:03 GMT</pubDate>
			<description>I have just about finished this program, I only need to calculate my velocity. I think that this velocity should be calculated by taking the value...</description>
			<content:encoded><![CDATA[<div>I have just about finished this program, I only need to calculate my velocity. I think that this velocity should be calculated by taking the value from the 4th column of my data set here:<a href="https://docs.google.com/file/d/0BzuDEPd26OcheVhiWlZ3STlZU0k/edit?usp=sharing" target="_blank">https://docs.google.com/file/d/0BzuD...it?usp=sharing</a> which have called ivar_3 and multiplying it by the difference of the 1st column in the line of the value and the line preceding it. Is this thought process correct? I have done the following (code I am talking about is in blue), can somebody tell me where I might be going wrong because it will not compile? <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">program WSUPhys_csv<br />
&nbsp; implicit none<br />
<br />
&nbsp; integer :: stat, num_lines, ivar1, ivar2, ivar3, &amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  MaxVert,MaxSide,MaxForward<br />
&nbsp; real :: rvar, Sum_ivar1, Sum_ivar2, Sum_ivar3, &amp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Avg_ivar1, Avg_ivar2, Avg_ivar3, Vel, SumVel, MaxVel<br />
&nbsp; character*80 :: line<br />
&nbsp; logical :: err<br />
&nbsp; <br />
&nbsp; err = .false.<br />
<br />
&nbsp; write(*,*) &quot;Reading file...&quot;<br />
<br />
&nbsp; ! open input file<br />
&nbsp; open(10,file='DATA-002.csv',status='old',iostat=stat)<br />
&nbsp; if (stat .ne. 0) then<br />
&nbsp; &nbsp; err = .true.<br />
&nbsp; &nbsp; write(*,*) 'File cannot be opened !'<br />
&nbsp; &nbsp; go to 99&nbsp;  <br />
&nbsp; end if<br />
<br />
&nbsp; num_lines = 0<br />
&nbsp; Sum_ivar1 = 0<br />
&nbsp; Sum_ivar2 = 0<br />
&nbsp; Sum_ivar3 = 0<br />
&nbsp; MaxVert=0<br />
&nbsp; MaxSide=0<br />
&nbsp; MaxForward=0<br />
&nbsp; <span style="color:Navy;">SumVel=0<br />
&nbsp; MaxVel=0</span><br />
&nbsp; do<br />
&nbsp; &nbsp; read(10,'(A)',end=99, iostat=stat) line <br />
&nbsp; &nbsp; if (stat .ne. 0) then<br />
&nbsp; &nbsp; &nbsp; err = .true.<br />
&nbsp; &nbsp; &nbsp; write(*,*) 'Error reading data !'<br />
&nbsp; &nbsp; &nbsp; go to 99<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; ! skip comment/header lines beginning with &quot;;&quot;<br />
&nbsp; &nbsp; if (adjustl(trim(line(1:1))) .eq. ';') then<br />
&nbsp; &nbsp; &nbsp; cycle<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; ! read string line into numeric variables<br />
&nbsp; &nbsp; read(line,*) rvar, ivar1, ivar2, ivar3<br />
&nbsp; &nbsp; num_lines = num_lines + 1&nbsp; &nbsp; <br />
&nbsp; &nbsp; if (num_lines &lt;=&nbsp; 10) then<br />
&nbsp; &nbsp; &nbsp; write(*,*) num_lines, ':', rvar, ivar1, ivar2, ivar3<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; Sum_ivar1 = Sum_ivar1 + ABS(ivar1) <br />
&nbsp; &nbsp; Sum_ivar2 = Sum_ivar2 + ABS(ivar2) <br />
&nbsp; &nbsp; Sum_ivar3 = Sum_ivar3 + ABS(ivar3)<br />
&nbsp; &nbsp; <span style="color:Navy;">Vel=(ABS(ivar_3))*(rvar-rvar)<br />
&nbsp; &nbsp; SumVel=SumVel+ ABS(Vel)</span><br />
&nbsp; &nbsp; If (ABS(ivar1) &gt; MaxVert) then<br />
&nbsp; &nbsp; &nbsp; MaxVert=ivar1<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; If (ABS(ivar2) &gt; MaxSide) then<br />
&nbsp; &nbsp; &nbsp; MaxSide=ivar1<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; If (ABS(ivar3) &gt; MaxForward) then<br />
&nbsp; &nbsp; &nbsp; MaxForward=ivar1<br />
&nbsp; &nbsp; end if&nbsp;  <br />
&nbsp; &nbsp; <span style="color:Navy;">If (Vel &gt; MaxVel) then<br />
&nbsp; &nbsp; &nbsp; MaxVel=Vel</span><br />
&nbsp; end do<br />
&nbsp; ! close file<br />
&nbsp; 99 continue<br />
&nbsp; close (10)<br />
<br />
&nbsp; ! when file processing OK<br />
&nbsp; if (.not. err) then<br />
&nbsp; &nbsp; write(*,*) '...done.'<br />
&nbsp; &nbsp; ! compute averages<br />
&nbsp; &nbsp; Avg_ivar1 = (Sum_ivar1 / num_lines)<br />
&nbsp; &nbsp; Avg_ivar2 = (Sum_ivar2 / num_lines)<br />
&nbsp; &nbsp; Avg_ivar3 = (Sum_ivar3 / num_lines)<br />
&nbsp; &nbsp; <span style="color:Navy;">AvgVel = (SumVel / num_lines)</span><br />
&nbsp; &nbsp; !<br />
<br />
&nbsp; &nbsp; write(*,*) 'Lines processed: ', num_lines<br />
&nbsp; &nbsp; write(*,*) 'Average vertical acceleration', Avg_ivar1<br />
&nbsp; &nbsp; write(*,*) 'Average sideways acceleration', Avg_ivar2<br />
&nbsp; &nbsp; write(*,*) 'Average forwards acceleration', Avg_ivar3<br />
&nbsp; &nbsp; write(*,*) 'Maximum vertical acceleration', MaxVert<br />
&nbsp; &nbsp; write(*,*) 'Maximum sideways acceleration', MaxSide<br />
&nbsp; &nbsp; write(*,*) 'Maximum forward acceleration ',&nbsp; MaxForward<br />
&nbsp; &nbsp; <span style="color:Navy;">write (*,*) 'Average forward velocity', AvgVel<br />
&nbsp; &nbsp; write (*,*) 'Maximum velocity', MaxVel</span><br />
&nbsp; end if&nbsp; <br />
end program WSUPhys_csv</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>ShoxPhysics</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691628</guid>
		</item>
		<item>
			<title>Fortran 95 and HTML form</title>
			<link>http://www.physicsforums.com/showthread.php?t=691515&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 14:43:29 GMT</pubDate>
			<description><![CDATA[I've got a Fortran 95 program (which basically does few calculations) and I'd like to use it online. So that, the users will input data into a HTML...]]></description>
			<content:encoded><![CDATA[<div>I've got a Fortran 95 program (which basically does few calculations) and I'd like to use it online. So that, the users will input data into a HTML form, the program will run, and it will display the results.<br />
<br />
Would it be possible to do it in the following way?<br />
To run a little program (e.g. PHP) once the user submits the form, then that program would take the input values from the form and write them into a text file. <br />
Then it runs the Fortran program, which reads the input values from the text file and does all the calculations - outputting the results to another text file (and then back to the website).<br />
<br />
If that's possible, how do I put all these steps into one thing, so that they'll be executed one after another?<br />
<br />
<br />
Thank you very much for your help!</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>onlybarca6</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691515</guid>
		</item>
		<item>
			<title>Using a self-coded neural network</title>
			<link>http://www.physicsforums.com/showthread.php?t=691463&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 06:47:27 GMT</pubDate>
			<description><![CDATA[I developed a multi-layer perceptron so I could better understand the underlying structure as well as modify it easily versus MATLAB's nntoolbox...]]></description>
			<content:encoded><![CDATA[<div>I developed a multi-layer perceptron so I could better understand the underlying structure as well as modify it easily versus MATLAB's nntoolbox generate code. I have successfully trained the network for a given set of inputs and targets. The question now is how do I use this trained network with a new set of inputs? I've looked everywhere and I can't seem to find out what procedure I need to take. Would this involve using the weights of the trained network somehow?</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>roldy</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691463</guid>
		</item>
		<item>
			<title>Problem in Extracting Numercial Values in fortran</title>
			<link>http://www.physicsforums.com/showthread.php?t=691363&amp;goto=newpost</link>
			<pubDate>Sun, 12 May 2013 18:57:14 GMT</pubDate>
			<description>Hello all,I have a small doubt. I use F95/90 and IBM compiler.This is a portion of my text file 
----------------------- 
 Alpha Singles Amplitudes 
...</description>
			<content:encoded><![CDATA[<div>Hello all,I have a small doubt. I use F95/90 and IBM compiler.This is a portion of my text file<br />
-----------------------<br />
 Alpha Singles Amplitudes<br />
    15      3    23      4   -0.186952<br />
    15      3    26      4    0.599918<br />
    15      3    31      4    0.105048<br />
    15      3    23      4    0.186952<br />
 Beta  Singles Amplitudes<br />
    15      3    23      4    0.186952<br />
    15      3    26      4   -0.599918<br />
    15      3    31      4   -0.105048<br />
    15      3    23      4   -0.186952<br />
END	<br />
---------------------<br />
I am trying to extract the numerical values from the attached file 1.txt . and I am facing a strange error in the output which I cannot understand. Every time I execute the program it skips the loop between 'Beta' and 'END'. I am trying to read and store the values. <br />
The number of lines inside the Alpha- and beta loop is not fixed. So a simple 'do loop' is of no use to me. I tried the 'do while' but it gives the output as :<br />
-------------------------------------------------------------------------------------<br />
AS    15      3    23      4    -.186952<br />
AS    15      3    26      4     .599918<br />
AS    15      3    31      4     .105048<br />
AS    15      3    23      4     .186952<br />
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.<br />
1525-097 A READ statement using decimal base input found the invalid digit 'e' in the input file.  The program will recover by assuming a zero in its place.<br />
1525-097 A READ statement using decimal base input found the invalid digit 'p' in the input file.  The program will recover by assuming a zero in its place.<br />
1525-097 A READ statement using decimal base input found the invalid digit 'l' in the input file.  The program will recover by assuming a zero in its place.<br />
 This is the end<br />
-------------------------------------------------------------------------------------- <br />
Any suggestions would of of great help. I coudn't find the error in logic in my code.I have attached    the code (Text.txt). <br />
<br />
Thanks in advance</div>


	<br />
	<div style="padding:6px">

	

	

	

	
		<fieldset class="fieldset">
			<legend>Attached Files</legend>
			<table cellpadding="0" cellspacing="3" border="0">
			<tr>
	<td><img class="inlineimg" src="http://www.physicsforums.com/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://www.physicsforums.com/attachment.php?attachmentid=58681&amp;d=1368384875">1.txt</a> (378 Bytes)</td>
</tr><tr>
	<td><img class="inlineimg" src="http://www.physicsforums.com/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://www.physicsforums.com/attachment.php?attachmentid=58682&amp;d=1368384875">Test.txt</a> (1.3 KB)</td>
</tr>
			</table>
		</fieldset>
	

	</div>
]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>equillibrium</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691363</guid>
		</item>
		<item>
			<title>Fortran- maximum values</title>
			<link>http://www.physicsforums.com/showthread.php?t=691269&amp;goto=newpost</link>
			<pubDate>Sun, 12 May 2013 08:57:19 GMT</pubDate>
			<description>Hello I am currently working on a program that will take the values from a .csv file containing multiple data and analyzing them. The file can be...</description>
			<content:encoded><![CDATA[<div>Hello I am currently working on a program that will take the values from a .csv file containing multiple data and analyzing them. The file can be found here:  <a href="https://docs.google.com/file/d/0BzuDEPd26OcheVhiWlZ3STlZU0k/edit?usp=sharing" target="_blank">https://docs.google.com/file/d/0BzuD...it?usp=sharing</a>  The data in question starts in row 11 and is in the first 4 columns. In my program I have labeled these: rvar, ivar1, ivar2, ivar3. Rvar is the value corresponding to a time value in microseconds after start of recording whereas ivar1,ivar2,and ivar3 correspond to the value of the acceleration at that point.  I have already calculated the average value of each of these columns.<br />
<br />
My question is- how do I find the maximum value for ivar1, ivar2 and ivar3 (separately)?<br />
<br />
My current code is below:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">program WSUPhys_csv<br />
&nbsp; implicit none<br />
<br />
&nbsp; integer :: stat, num_lines, ivar1, ivar2, ivar3<br />
&nbsp; real :: rvar<br />
&nbsp; character*80 :: line<br />
&nbsp; <br />
&nbsp; write(*,*) &quot;Reading file...&quot;<br />
<br />
&nbsp; ! open input file<br />
&nbsp; open(10,file='DATA-002.csv',status='old',iostat=stat)<br />
&nbsp; if (stat .ne. 0) then<br />
&nbsp; &nbsp; write(*,*) 'File cannot be opened !'<br />
&nbsp; &nbsp; go to 99&nbsp;  <br />
&nbsp; end if<br />
<br />
&nbsp; num_lines = 0<br />
&nbsp; do<br />
&nbsp; &nbsp; read(10,'(A)',end=99, iostat=stat) line <br />
&nbsp; &nbsp; if (stat .ne. 0) then<br />
&nbsp; &nbsp; &nbsp; write(*,*) 'Error reading data !'<br />
&nbsp; &nbsp; &nbsp; go to 99<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; ! skip comment/header lines beginning with &quot;;&quot;<br />
&nbsp; &nbsp; if (adjustl(trim(line(1:1))) .eq. ';') then<br />
&nbsp; &nbsp; &nbsp; cycle<br />
&nbsp; &nbsp; end if<br />
&nbsp; &nbsp; ! read string line into numeric variables<br />
&nbsp; &nbsp; read(line,*) rvar, ivar1, ivar2, ivar3<br />
&nbsp; &nbsp; num_lines = num_lines + 1&nbsp; &nbsp; <br />
&nbsp; &nbsp; if (num_lines &lt;=&nbsp; 10) then<br />
&nbsp; &nbsp; &nbsp; write(*,*) num_lines, ':', rvar, ivar1, ivar2, ivar3<br />
&nbsp; &nbsp; end if<br />
&nbsp; Sum_ivar1 = Sum_ivar1 + ABS(ivar1) <br />
&nbsp; Sum_ivar2 = Sum_ivar2 + ABS(ivar2) <br />
&nbsp; Sum_ivar3 = Sum_ivar3 + ABS(ivar3)<br />
&nbsp; Max<br />
&nbsp; end do<br />
<br />
&nbsp; ! close file<br />
&nbsp; 99 continue<br />
&nbsp; Avg_ivar1 = (Sum_ivar1 / num_lines)<br />
&nbsp; Avg_ivar2 = (Sum_ivar2 / num_lines)<br />
&nbsp; Avg_ivar3 = (Sum_ivar3 / num_lines)<br />
&nbsp; close (10)<br />
&nbsp; !<br />
&nbsp; write(*,*) '...done.'<br />
&nbsp; write(*,*) 'Lines processed: ', num_lines<br />
&nbsp; write(*,*) 'Average vertical acceleration', Avg_ivar1/1000<br />
&nbsp; write(*,*) 'Average sideways acceleration', Avg_ivar2/1000<br />
&nbsp; write(*,*) 'Average forward acceleration', Avg_ivar3/1000<br />
end program WSUPhys_csv</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>ShoxPhysics</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691269</guid>
		</item>
		<item>
			<title>Overlapping Matches Python</title>
			<link>http://www.physicsforums.com/showthread.php?t=691075&amp;goto=newpost</link>
			<pubDate>Sat, 11 May 2013 06:08:22 GMT</pubDate>
			<description><![CDATA[I'm writing a function to take a string like "aXYb" and return a regex in which the lower case letters act like actual character and the upper case...]]></description>
			<content:encoded><![CDATA[<div>I'm writing a function to take a string like &quot;aXYb&quot; and return a regex in which the lower case letters act like actual character and the upper case become free variables.<br />
<br />
The regex generated from &quot;aXYb&quot; should match anything of the form a([a-z]+)([a-z]+)b. It does. But not exactly as &quot;freely&quot; as I would like. For example, when I re.compile(a([a-z]+)([a-z]+)b).match(&quot;aaxab&quot;), the only tuple I get back is (&quot;ax&quot;, &quot;a&quot;).<br />
<br />
Preferably, I'd like both (&quot;a&quot;, &quot;xa&quot;) and (&quot;ax&quot;, &quot;a&quot;). How can I change &quot;a([a-z]+)([a-z]+)b&quot; to get these results?<br />
<br />
For a little background, it's intended to be used in describing rules for algebraic manipulations (in the abstract algebra sense). The final goal is to be able do a breadth first search of all manipulations until I get to the desired result. The free variables are used in describing the variable part of valid manipulations, like (AB=AC -&gt; B=C). That's why overlapping is absolutely necessary.</div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>TylerH</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691075</guid>
		</item>
		<item>
			<title>MIPS assembly progr.-factorial calculation</title>
			<link>http://www.physicsforums.com/showthread.php?t=691029&amp;goto=newpost</link>
			<pubDate>Fri, 10 May 2013 21:00:45 GMT</pubDate>
			<description><![CDATA[I'm trying to write a MIPS assembly program  that implements the calculation of n! Well i wouldn't be here if i were successful.When i try to run the...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to write a MIPS assembly program  that implements the calculation of n! Well i wouldn't be here if i were successful.When i try to run the following code on PCSpim this appears on the screen:<br />
                &quot;Exception 6 [Bad instruction address] occured and ignored&quot;<br />
Can  anyone help me find my errors?i think my head is going to explode!<br />
<br />
Thanks in advance...<br />
<br />
Here is my code:<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="6" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="alt2">
			<hr />
			
				.data 0x10008000<br />
.word 10<br />
.word 1<br />
.word 0<br />
.ascii &quot;The factorial of 10 is %d \n&quot;<br />
.text<br />
.globl main<br />
<br />
main:<br />
                addi $sp,$sp,-8<br />
	sw $ra,4($sp)<br />
                sw $fp,8($sp)<br />
                addiu $fp,$sp,4<br />
	lw $a0,4($gp) <br />
	jal fact<br />
                <br />
                move $a1,$v0<br />
                <br />
                jal printf<br />
	lw $ra,4($sp)<br />
                lw $fp,8($sp)<br />
	addi $sp,$sp,8<br />
	jr $ra<br />
               <br />
fact:<br />
                addi $sp,$sp,-8<br />
	sw $ra,4($sp)<br />
                sw $fp,8($sp) <br />
                addiu $fp,$sp,4<br />
	sw $a0,0($fp)<br />
  <br />
                lw $v0,0($fp)<br />
	<br />
                move $t0,$zero<br />
                slti $t0,$v0,1<br />
	beq $t0,$zero,L2<br />
	addi $v0,$zero,1<br />
                jr L1<br />
		<br />
	<br />
	<br />
	<br />
<br />
L1:<br />
                lw $ra,4($sp)<br />
                lw $fp,8($sp)<br />
                addiu $sp,$sp,8<br />
                jr $ra<br />
<br />
L2:<br />
                 lw $v1,0($fp)<br />
                 subu $v0,$v1,1<br />
                 move  $a0,$v0<br />
                 jal fact<br />
                 lw $v1,0($fp)<br />
                 mul $v0,$v0,$v1                <br />
   <br />
   <br />
printf:<br />
    li $v0,4<br />
    la $a0,12($gp)<br />
    syscall<br />
	<br />
    li $v0,1<br />
    move $a0,$v1<br />
    syscall	<br />
   
			
			<hr />
		</td>
	</tr>
	</table>
</div></div>

]]></content:encoded>
			<category domain="http://www.physicsforums.com/forumdisplay.php?f=165"><![CDATA[Programming & Comp Sci]]></category>
			<dc:creator>electra123</dc:creator>
			<guid isPermaLink="true">http://www.physicsforums.com/showthread.php?t=691029</guid>
		</item>
	</channel>
</rss>
