<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ascend4.org/index.php?action=history&amp;feed=atom&amp;title=Differentiation_Exercise</id>
	<title>Differentiation Exercise - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ascend4.org/index.php?action=history&amp;feed=atom&amp;title=Differentiation_Exercise"/>
	<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Differentiation_Exercise&amp;action=history"/>
	<updated>2026-05-03T22:43:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ascend4.org/index.php?title=Differentiation_Exercise&amp;diff=98&amp;oldid=prev</id>
		<title>UploadBot: Restored page from Google Cache, uploaded by John Pye</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=Differentiation_Exercise&amp;diff=98&amp;oldid=prev"/>
		<updated>2010-05-13T13:50:04Z</updated>

		<summary type="html">&lt;p&gt;Restored page from Google Cache, uploaded by John Pye&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Please note, the following was used for the application process to [[Category:GSOC2009|GSOC2009]]; while still an interesting academic exercise, it is not valid for 2010 applicants.&amp;#039;&amp;#039;&amp;#039; The [[OpenMP Exercise]] and/or [[ANTLR exercise]] is being used for the [[GSOC2010]] application process. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * The following quiz is provided as an example of what we need for reverse&lt;br /&gt;
 * automatic differentiation. Work as much of this as you can. We are&lt;br /&gt;
 * not out to reinvent the wheel-- if you know of an open-source code that&lt;br /&gt;
 * can do the task or be extended to do the task, you may recycle provided&lt;br /&gt;
 * you cite the source. If recycling, create a single source file with just&lt;br /&gt;
 * the portions needed to do the specified operators.  Simply pointing at &lt;br /&gt;
 * the other code is not considered doing the quiz, however.&lt;br /&gt;
 *&lt;br /&gt;
 * The goal is to convince yourself (and us) you have the basic skills needed to&lt;br /&gt;
 * do the project. When submitting answers, please indicate how many hours you&lt;br /&gt;
 * spent on each part. Partial solutions are fine -- we want to see how you think&lt;br /&gt;
 * not how fast you can code -- but solutions that run are better if you have the time.&lt;br /&gt;
 *&lt;br /&gt;
 * Answers may be submitted in C, C++, java, python, or pseudo-C-code. Both style and substance matter.&lt;br /&gt;
 * For pseudo-C-code, give full details of the data structures used and memory management.&lt;br /&gt;
 * Solutions in C++/python may NOT use operator overloading in any way-- use only the basic object&lt;br /&gt;
 * management features in OO languages.&lt;br /&gt;
 *&lt;br /&gt;
 * Given: &lt;br /&gt;
 * (i) a text file containing, one per line, operators or variables&lt;br /&gt;
 * defining a well-formed scalar equation in postfix notation. Details to follow in (I).&lt;br /&gt;
 * (ii) a text file containing, one per line, variable names and their values separated by whitespace.&lt;br /&gt;
 *&lt;br /&gt;
 * Task 1: Write a function to load the file into a data structure that can be used&lt;br /&gt;
 * to evaluate the equation for any set of values assigned to the variables.&lt;br /&gt;
 * Hint: typically a tree or a postfix array of tokens is used. Some projects use both.&lt;br /&gt;
 * The final result from the function should be an object to be passed to &lt;br /&gt;
 * other functions written in the following tasks.&lt;br /&gt;
 *&lt;br /&gt;
 * Task 2: Write a function (cite sources if borrowing code from other projects)&lt;br /&gt;
 * to read a file of type (ii) above and evaluate the relation.&lt;br /&gt;
 *&lt;br /&gt;
 * Task 3: Find a publication on the web or book in the library explaining&lt;br /&gt;
 * the reverse mode of automatic differentiation. Cite the book/pages and implement&lt;br /&gt;
 * a function computing the first partial derivatives given the inputs&lt;br /&gt;
 * read and data structures created in task1, task2; reverse AD must be used.&lt;br /&gt;
 *&lt;br /&gt;
 * Task 4: Critique your own solution. Tell us how you would make it more general,&lt;br /&gt;
 * Tell us where you think it might be slow and what experiments you would run&lt;br /&gt;
 * to test your theory. Tell us where you would need to add code to manage the memory in &lt;br /&gt;
 * C (especially if you coded in a different language). Tell us anything else&lt;br /&gt;
 * notable about the code you wrote (or stole with citation) that will help us see just&lt;br /&gt;
 * how well you understand the task. If you know your code is incomplete,&lt;br /&gt;
 * create test input files that demonstrate the working features of your code&lt;br /&gt;
 * and at least one test input file that demonstrates each problem area/incompleteness&lt;br /&gt;
 * you know about and the error message output you created to notify the user.&lt;br /&gt;
 * If you know your code is not thread safe during evaluate, explain why and&lt;br /&gt;
 * what you would do about it given proper code-development time.&lt;br /&gt;
 *&lt;br /&gt;
 * Extreme extra credit given: For the restricted set of operators&lt;br /&gt;
 *         listed in (I) below, implement second partial derivatives. The&lt;br /&gt;
 *         set of operators in ascend is much nastier, and in ascend we will&lt;br /&gt;
 *         want to specify only certain variables out of the total set are&lt;br /&gt;
 *         of interest.&lt;br /&gt;
 * &lt;br /&gt;
 * (I) The equation elements are as follows (c notation, floating point functions):&lt;br /&gt;
 * &amp;amp;quot;=&amp;amp;quot;&lt;br /&gt;
 * &amp;amp;quot;+&amp;amp;quot;&lt;br /&gt;
 * &amp;amp;quot;*&amp;amp;quot;&lt;br /&gt;
 * &amp;amp;quot;/&amp;amp;quot;&lt;br /&gt;
&lt;br /&gt;
 * &amp;amp;quot;pow&amp;amp;quot;&lt;br /&gt;
 * &amp;amp;quot;sin&amp;amp;quot;&lt;br /&gt;
 * &amp;amp;quot;variable&amp;amp;quot; variable-name&lt;br /&gt;
 * &amp;amp;quot;constant&amp;amp;quot; real-value&lt;br /&gt;
 * &amp;amp;quot;integer_constant&amp;amp;quot; integer-value&lt;br /&gt;
 * Example: a + b = c * d + 3.14 * pow( sin( e / f ) , 2)&lt;br /&gt;
 * will result in an input file (postfix notation)&lt;br /&gt;
= &lt;br /&gt;
+ &lt;br /&gt;
variable a &lt;br /&gt;
variable b &lt;br /&gt;
+ &lt;br /&gt;
* &lt;br /&gt;
variable c &lt;br /&gt;
variable d &lt;br /&gt;
* &lt;br /&gt;
constant 3.14 &lt;br /&gt;
pow &lt;br /&gt;
sin &lt;br /&gt;
/ &lt;br /&gt;
variable e &lt;br /&gt;
variable f &lt;br /&gt;
integer_constant 2&lt;br /&gt;
 &lt;br /&gt;
* (II) a test input for part (ii) and the example given in (I) would be&lt;br /&gt;
&lt;br /&gt;
a 2.7&lt;br /&gt;
b 0.5&lt;br /&gt;
c 1.1&lt;br /&gt;
d 9.3&lt;br /&gt;
e 6&lt;br /&gt;
f 1.33&lt;br /&gt;
&lt;br /&gt;
*  another test input for part (ii) would be&lt;br /&gt;
&lt;br /&gt;
a 2.7&lt;br /&gt;
b 0.5&lt;br /&gt;
c 1.1&lt;br /&gt;
d 9.3&lt;br /&gt;
e 6&lt;br /&gt;
f 0&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/* Method signature hints (c notation) */&lt;br /&gt;
struct Equation {&lt;br /&gt;
// your details here&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
struct Equation * readEquation(const char * filename);&lt;br /&gt;
int readVariables(struct Equation *eqn, const char * filename);&lt;br /&gt;
&lt;br /&gt;
/* how many distinct variables does the eqn have? */&lt;br /&gt;
int getNumberVariables(struct Equation *eqn);&lt;br /&gt;
&lt;br /&gt;
/* the the name of i-th variable (0..getNumberVariables()-1) */&lt;br /&gt;
const char * getVariableName(struct Equation *eqn, int variable_index);&lt;br /&gt;
&lt;br /&gt;
/* evaluation is computing F = left-hand-side - right-hand-side (the residual error if the&lt;br /&gt;
variable values given do not satify the equation). */&lt;br /&gt;
double *evaluate(struct Equation *eqn);&lt;br /&gt;
&lt;br /&gt;
/* evaluate dF/d(all-variables) partial derivatives).&lt;br /&gt;
  and store results in the given array result[resultLen].&lt;br /&gt;
 */&lt;br /&gt;
int evaluateFirstPartials(struct Equation *eqn, double *result, int resultLen);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [[Category:GSOC2010]]&lt;/div&gt;</summary>
		<author><name>UploadBot</name></author>
	</entry>
</feed>