<p>Some of the very early work on complexity theory used a sequential time model -- that is, rather than studying the worst-case runtime of the TM that can produce the correct output on an arbitrary input, they studied machines that would run infinitely and enumerate the correct output for each input in lexicographic order.  The complexity of the machine was then based on the worst-case time gap ("delay") between the enumeration of consecutive outputs.  This model can be used to study the problem of taking an input $1^n$ and producing on output the $2^n$-sized truth table of a language on all inputs of length $n$ , while trying to minimize the average computation time required per input (so $2^n poly(n)$ is considered "efficient" in this model).  This seems pretty similar to the question you're asking.</p>

<p><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.308.7011&amp;rep=rep1&amp;type=pdf">Here</a> is a paper that uses that model.  <a href="https://rjlipton.wordpress.com/2012/06/15/why-the-hartmanis-stearns-conjecture-is-still-open/">Here</a> is a blog post that is only somewhat related, but includes some references that you might find interesting.</p>

<p>One note about this model is that for some NP problems, including SAT, you can print their truth table in polynomial time per bit by exploiting the self-reducibility of the problem.  For example, with SAT, you can always efficiently find the next bit of the truth table by fixing one of the variables, computing the reduced version of the problem under this variable fix, and then looking up the solution to the reduced version of the problem in the truth table that you have computed so far.</p>

CC BY-SA 3.0
2015-09-08T17:59:05.080Z
FYI, the concept of polynomial delay is still relevant in most places that combinatorial enumeration gets used. For example, listing all groups of a given order up to isomorphism, listing all instances of a given graph $H$ in a bigger graph $G$, etc.
Joshua Grochow
CC BY-SA 3.0
2015-09-07T15:15:47.267Z
2015-09-07T15:15:47.267Z
GMB
<p>It's difficult to know what you mean because you're staying at a level that's so high that there's nothing interesting. Specific cases could be very interesting, but the basic idea that having computed a function for one input can make it easier to compute it for other inputs is too general.</p>

<p>It may be that you have a function $f$ such that having computed $f(x)$, you gain some information about $f(g(x))$ for certain choices of functions $g$: there's an equation of the form $\forall x, f(g(x)) = h(f(x))$. The general term for such properties is a <a href="https://en.wikipedia.org/wiki/Morphism">morphism</a>: $f$ is a morphism from $(D,g)$ to $(R,h)$ where $D$ is the domain of $f$ and $R$ is its range. The interesting part is finding useful algebraic structures with such properties.</p>

<p>Sometimes the computation of $f(x)$ involves work that's the same for all possible inputs, or for a subset of possible inputs that are in some sense sufficiently similar. Splitting the computation into a common part and an input-specific part is known as <a href="https://en.wikipedia.org/wiki/Partial_evaluation">partial evaluation</a>. The interesting aspect is finding useful ways to partially evaluate a function, and useful ways to memorize and consult partial results without wasting more time consulting cached partial results than would have been spent recalculating the thing.</p>

CC BY-SA 3.0
2015-09-08T23:54:37.497Z
Sorry to be so vague Gilles.  Your middle paragraph is really interesting and i think is the most similar of anything I've heard about or come across in my search so far.  The fact that there isn't a straight match to my question is an answer in it's own way.
Alan Wolfe
CC BY-SA 3.0
2015-09-08T22:55:53.390Z
2015-09-08T22:55:53.390Z
Gilles 'SO- stop being evil'
<p>This is basically what <strong>dynamic data structures</strong> and <strong>streaming algorithms</strong> are about. A few links, off the top of my Google: </p>

<ul>
<li><a href="http://www.stingergraph.com/papers/HPEC12_Ediger.pdf" rel="nofollow">High performance data structure for streaming graphs</a></li>
<li><a href="http://erikdemaine.org/theses/mpatrascu.pdf" rel="nofollow">Mihai Patrascu's thesis</a></li>
<li><a href="http://arxiv.org/abs/1408.3045" rel="nofollow">Dynamic Integer Sets with Optimal Rank, Select, and Predecessor Search</a></li>
<li><a href="http://www.dis.uniroma1.it/~demetres/docs/dynamic-techniques.pdf" rel="nofollow">Dynamic shortest paths and transitive closures</a></li>
</ul>

<p>For example, a dynamic data structure for shortest paths in a graph computes all shortest paths in a graph, and then when you add or remove edges to the graph should do the least amount of work needed to update all of the shortest path information. (Actually, frequently it is a combination of running time and the space needed for the data structure that is considered, but for the purposes of this question that's just a detail.)</p>

CC BY-SA 3.0
2015-09-08T18:08:06.440Z
2015-09-08T18:08:06.440Z
Joshua Grochow
<p>Many times, we can use <a href="https://en.wikipedia.org/wiki/Linearization" rel="nofollow">Linearization</a> of a function to approximate values near a point to reasonable accuracy. A single answer is generated with expensive algorithms (e.g., $\sqrt{2}\approx1.41421...$) then nearby answers are generated from that answer with a simple algorithm (e.g., $\sqrt{x}\approx0.35355x+0.70711, x\approx2$. Using expensive algorithms, $\sqrt{2.05}\approx1.43178$, while the cheap algorithm produces $\sqrt{2.05}\approx1.43189$. $\sqrt{1.95}\approx1.39642$ (expensive) and $\sqrt{1.95}\approx1.39653$ (cheap) are likewise quite close.</p>

<p>A really simplified version of the above is when we approximate a function as constant near a point, such as the surface gravity of a planet. $f={{m_om_nG}\over{r^2}},a={f\over{m_o}}$ becomes $a=c_n$ where $c_n$ is calculated once at planet $n$'s creation in a game or simulation.</p>

<p>To a large extent though, this "strange concept" is how basic computer science works. We save intermediate results then calculate many end results from that number, rather than re-doing expensive computations repeatedly. It's just that normal programming simplifies the concept further. $s=\sqrt{2}, x=s+4, y=s+9$ is more readable than $x=\sqrt{2}+4, y=x+5$ (especially if we're calculating hundreds of variables), and if we don't know the offsets ahead of time, $s=\sqrt{2}, x=s+O_x, y=s+O_y$ is faster than $x=\sqrt{2}+O_x, y=x+(O_y-O_x)$.</p>

<p>Another way to use previous data is the incremental results methods used in things like data backup and video streaming to save bandwidth and time. Each frame is re-calculated using multiple differential frames rather than being transmitted in its entirety.</p>

<p>A different class of this concept is calculations that require super-slow or real-money-expensive processes, like humans or sending satellites to space. We take these "algorithms" and re-interpret the results in a different context. For example, we can measure irradiance from the Sun near Earth at $1367 {W\over{m^2}}$ using expensive satellite equipment. Now we can calculate irradiance near other bodies quickly and cheaply. For example, $P_{Mars}=P_{Earth}{(1 AU)^2\over(1.52 AU)^2}\approx592{W\over{m^2}}$.</p>

<p>Addendum:<br>
I don't think what you're asking for is possible in a direct sense. If getting $f(x+\Delta x)$ from $f(x)$ is somehow easier than plugging $x+\Delta x$ directly into $f()$ then you can probably simplify $f()$ somehow.</p>

<p>Let's use your example. $f(x_1)=8x_1=h$, so now we want to find $f(x_2)$$=f(x_1+\Delta x)$ as a function of $h$ and something else. $f(x_1+\Delta x)$$=8(x_1+\Delta x)$$=h+8\Delta x$$=h+8(x_2-x_1)$. We could try it as $f(x_2)=f(x_1*k_2)$, which gets $f(x_2)$$=8(x_1k_2)$$=h{{x_2}\over{x_1}}$. In either case, we do more work getting $x_2$ from $x_1$ than just calculating $f(x_2)=8x_2$ directly.</p>

<p>I don't have mathematical proof of this, but I would imagine this holds for any complex function, because a function is <em>already</em> a definition of how to relate inputs to outputs. If you could somehow re-define an extremely complex formula for all inputs relative to a known output, then nobody would bother with the complex formula anymore except to show how they got the fast formula.</p>

CC BY-SA 3.0
2015-09-08T04:42:14.530Z
By "strange concept" I mean the literal interpretation of what I've said. You evaluate some logic circuit of XORs and ANDs in a special way and get back a bit string as an answer. You do an operation (say, XOR for example) using a constant that is based on the inputs to get the right answer. You can then change the inputs, which changes the constant, and by decoding the answer you already have using the new constant, you get the right answer for the changed inputs, without having to reevaluate the logic.
Alan Wolfe
CC BY-SA 3.0
2015-09-08T04:43:58.353Z
Oh but FYI this isn't iterative computation.  I also wanted to say thank you for the response, it has some good interesting info (:
Alan Wolfe
CC BY-SA 3.0
2015-09-08T03:23:23.607Z
2015-09-08T19:35:23.357Z
2015-09-08T19:35:23.357Z
MichaelS
<p>You seem to be asking about <a href="https://en.wikipedia.org/wiki/Incremental_computing">incremental computation</a>.</p>

<p>In general, it takes the following form: we have a function $f$, which is expensive to compute.  We have computed $f(x)$ for a single input $x$.  Now we want to compute $f(x')$, for a second input $x'$ where $x'$ is somehow "similar" to $x$.  It'd be nice if we could take advantage of the fact that we already know $f(x)$ to compute $f(x')$ more quickly than computing it from scratch.  This is the sort of problem that incremental computation helps with.</p>

<p>There are many methods for incremental computation: too many to list here.  The particular method to use will depend on the nature of the function $f$.  The Wikipedia article I linked to has a few references to get you started.  If you want more details, you'll probably need to pick a single function $f$ and ask about that one, or a narrowly-defined class of functions $f$.</p>

<p>You might also be interested in <a href="https://en.wikipedia.org/wiki/Strength_reduction">strength reduction</a> from the compiler optimization literature.</p>

CC BY-SA 3.0
2015-09-07T20:07:42.977Z
Incremental computation looks like a near hit.  The case I'm looking at has it such that "reinterpreting" the result to get another answer doesn't rely on the details of the function/algorithm/circuit at all.  It does seem like there'd be some similar ideas reading up on it though.  I'll check the other as well, thanks for the info!
Alan Wolfe
CC BY-SA 3.0
2015-09-07T20:09:23.837Z
@AlanWolfe, cool, I hope it helps!  If this doesn't match the needs of your particular case, you might want to ask a new question about your specific case and provide more details about your particular case.  (Incidentally, the "re-interpreting" part has me puzzled; I'm not sure where that comes in, so if you ask a new question, you might need to explain that more carefully, or consider whether the "re-interpreting" language is adding anything.)
D.W.
CC BY-SA 3.0
2015-09-07T20:12:15.157Z
I added some more about that to the question. It's hard cause I'm trying to find out if ive found anything remotely novel, or if it's already known, so I don't want to give it all away just to get scooped hehe.
Alan Wolfe
CC BY-SA 3.0
2015-09-07T20:19:15.650Z
@AlanWolfe, I understand, but I'm afraid that kind of question might not be a good fit here.  Playing 'hide the ball' or 'guess what Alan is thinking' is not a good fit for this site format.  If your situation is such that you can't provide information that's relevant or necessary to understand what exactly you're asking, it's possible you might need to figure it out on your own or hire a consultant who will sign a NDA, rather than asking here.  Just my personal opinion; others might differ.
D.W.
CC BY-SA 3.0
2015-09-07T20:20:56.323Z
For sure.  I've gotten great info on some related topics.  That nothing is an exact match seems to point in the right direction and I have more to read about now.
Alan Wolfe
CC BY-SA 3.0
2015-09-07T19:56:42.577Z
2015-09-07T20:19:43.517Z
D.W.
<p>This paper describes a new form of incremental computation: taking derivatives on data-type-valued functions (e.g. List-valued functions).</p>

<p><a href="http://www.informatik.uni-marburg.de/~pgiarrusso/papers/pldi14-ilc-author-final.pdf" rel="nofollow">http://www.informatik.uni-marburg.de/~pgiarrusso/papers/pldi14-ilc-author-final.pdf</a></p>

CC BY-SA 3.0
2015-09-07T21:03:57.300Z
2015-09-07T21:03:57.300Z
NietzscheanAI
<p>For what it's worth, it turns out that this is how quantum computing works.  When it does it's computations, it does so on cubits which can be 1, 0, or a superposition of 1 and 0. If you use superpositional bits, it means that it does the computations on all possible bit value permutations. It's only when the result is "observed" that it collapses into an actual value. Unfortunately you can't (or they don't know how) to clone the result in the unobserved state, so you can't get access to all permutations, only one of them.</p>

CC BY-SA 3.0
2015-09-29T14:05:25.437Z
2015-09-29T14:05:25.437Z
Alan Wolfe
<p>I'm not sure, but you might be talking about what has been termed <strong><a href="https://en.wikipedia.org/wiki/Incremental_computing">incremental computation</a></strong>.</p>

<p>The key idea behind incremental computation is to program in a way such that the program responds to input changes by updating its output while <strong>only re-evaluating those portions of the program affected by the change</strong>. Incremental computing is feasible in situations where input changes lead to relatively small changes in the output. Clearly, in limiting cases one cannot avoid a complete re-computation of the output, but in many cases the results of the previous computation may be re-used to obtain the updated output more quickly than a complete re-evaluation. In many cases, taking advantage of incrementality therefore dramatically improves performance, especially as the input size increases. </p>

<p>Designing and developing applications that respond to incremental modifications, however, is challenging: it often involves developing highly specific, complex algorithms.</p>

<p>This has lead some people to investigate the idea of moving the responsibility to avoid reevaluation where possible to the language run-time: instead of expecting the programmer to develop software for a particular application and a particular class of incremental modifications, the language run-time is tracking the dynamic data dependences of the computation and incrementally updating their output as needed. This is called  or <strong>self-adjusting computation</strong>, and  the person most associated with this programming language approach is Umut Acar. I recommend visiting <a href="http://www.umut-acar.org/self-adjusting-computation">his website</a> for further information.</p>

<p>Note that ideas like this go back to the 1950s. Ad-hoc forms of incremental computing are heavily used in modern web-browsers because you don't want to reprocess ("reflow") the full page when a mutatation (e.g. Javascript performs a DOM operation) is performed. </p>

<p>I also recommend to consider the  related field of <strong><a href="https://en.wikipedia.org/wiki/Online_algorithm">online algorithms</a></strong>.</p>

CC BY-SA 3.0
2015-09-07T19:58:38.370Z
2015-09-07T20:08:08.870Z
2015-09-07T20:08:08.870Z
Martin Berger
<p>I recently came across a strange concept and was wondering if this was a known / named concept in the realm of CS.</p>

<p>The concept is that you evaluate some computation or logical circuit that takes in N number of binary inputs and gives an output. (and if doing multiple of these in parallel it could then be N inputs to M outputs)</p>

<p>You can then change your mind after the fact about the values of the binary inputs you want the algorithm to have evaluated and essentially re-interpret the result of the original equation to get the answer for those different inputs.</p>

<p>The benefit here would be that if there was some complex and lengthy computation, that you could do it once, and then just re-interpret the result to get the answer of that same algorithm for different inputs.</p>

<p>It sounds strange I know, but are there any existing methods for this, or terminology at least?</p>

<p><strong>Example:</strong></p>

<p>As an example let's say you calculated a function $f(x) = x * 8$ for $x=5$ in a specific way that gave you a resulting bit string.  When an operation was done on the bit string, which was a function of the inputs (say, XOR against a number which was the function of the inputs for example), that the value came out to be 40.</p>

<p>But then, you say "OK but what would it be for $f(6)$?".  Since 6 is different than 5, the XOR constant changes, but you can use that new XOR constant against the result you already got from the previous calculations, to get the new correct answer of 48.</p>

<p>The decoding process is the same regardless of the algorithm/function being evaluated.  It is a function of the inputs, and has nothing to do with the details of the function itself (so isn't iterative computation).</p>

<p>it almost seems a little related to a karnaugh map, in that you get something boiled down to the results of the algorithm, no matter how complex the steps were to get to that result originally.</p>

CC BY-SA 3.0
2015-09-07T17:38:49.947Z
What does "re-interpret" mean here? Symbolic computations may do what you want. Other than that, self-adusting computation is the only term that I know and seems related.
Raphael
CC BY-SA 3.0
2015-09-07T17:49:54.487Z
I added an example to hopefully clear it up.
Alan Wolfe
CC BY-SA 3.0
2015-09-08T05:33:40.317Z
Cross-posted on cs.se: http://cs.stackexchange.com/questions/46924/is-it-a-known-concept-to-compute-an-algorithm-once-and-re-interpret-answer-for-d.
Yuval Filmus
CC BY-SA 3.0
2015-09-08T12:26:41.547Z
Like others, I'm not sure what you mean.  Do you mean something like: you write an algorithm that takes in a binary string and returns the result of multiplying by 2 (it tacks a 0 on the right).  Then you change your interpretation of what the input meant and no longer consider it to be the binary representation, but now think of it as a peculiar unary representation where you count the number of 1's to get the natural number it stands for.  Now the algorithm computes the identity function. 

That satisfies having one computation with more than one interpretation, but is it what you meant?
Jim Hefferon
CC BY-SA 3.0
2015-09-08T13:56:55.700Z
That is more along the lines of what I mean Jim yep!  I added some more detailed example info that hopefully helps clarify it, but you have the general idea of what it is I mean, yeah
Alan Wolfe
CC BY-SA 3.0
2015-09-08T16:46:36.827Z
Please don't crosspost! That's impolite towards potential answerers which may waster their time producing redundant answers.
Raphael
CC BY-SA 3.0
2015-09-08T16:49:17.313Z
I posted to CS before finding out that there was a theoretical CS board, which seems more correct.  I can delete this one if you'd prefer, but as there is useful info here, seems better to leave it.
Alan Wolfe
CC BY-SA 3.0
2015-09-09T14:34:14.597Z
Raphael, gotcha on the cross posting and I will avoid in the future. As this is part of research for a CS paper, and theoretical CS received the question well, while regular CS didn't, I really think TCS is the place for it.
Alan Wolfe
<reference-request><terminology>
Is it a Known Concept to Compute an Algorithm Once and Re-Interpret Answer for Different Inputs
Alan Wolfe
# Is it a Known Concept to Compute an Algorithm Once and Re-Interpret Answer for Different Inputs

(Asked by: username_0 on 2015-09-07)

I recently came across a strange concept and was wondering if this was a known / named concept in the realm of CS.

The concept is that you evaluate some computation or logical circuit that takes in N number of binary inputs and gives an output. (and if doing multiple of these in parallel it could then be N inputs to M outputs)

You can then change your mind after the fact about the values of the binary inputs you want the algorithm to have evaluated and essentially re-interpret the result of the original equation to get the answer for those different inputs.

The benefit here would be that if there was some complex and lengthy computation, that you could do it once, and then just re-interpret the result to get the answer of that same algorithm for different inputs.

It sounds strange I know, but are there any existing methods for this, or terminology at least?

**Example:**

As an example let's say you calculated a function $f(x) = x \* 8$ for $x=5$ in a specific way that gave you a resulting bit string. When an operation was done on the bit string, which was a function of the inputs (say, XOR against a number which was the function of the inputs for example), that the value came out to be 40.

But then, you say "OK but what would it be for $f(6)$?". Since 6 is different than 5, the XOR constant changes, but you can use that new XOR constant against the result you already got from the previous calculations, to get the new correct answer of 48.

The decoding process is the same regardless of the algorithm/function being evaluated. It is a function of the inputs, and has nothing to do with the details of the function itself (so isn't iterative computation).

it almost seems a little related to a karnaugh map, in that you get something boiled down to the results of the algorithm, no matter how complex the steps were to get to that result originally.

**Tags:** reference-request, terminology
> **Comments:**
> **username_1**: What does "re-interpret" mean here? Symbolic computations may do what you want. Other than that, self-adusting computation is the only term that I know and seems related.  
> **username_0**: I added an example to hopefully clear it up.  
> **username_2**: Cross-posted on cs.se: http://cs.stackexchange.com/questions/46924/is-it-a-known-concept-to-compute-an-algorithm-once-and-re-interpret-answer-for-d.  
> **username_3**: Like others, I'm not sure what you mean.  Do you mean something like: you write an algorithm that takes in a binary string and returns the result of multiplying by 2 (it tacks a 0 on the right).  Then you change your interpretation of what the input meant and no longer consider it to be the binary representation, but now think of it as a peculiar unary representation where you count the number of 1's to get the natural number it stands for.  Now the algorithm computes the identity function.   That satisfies having one computation with more than one interpretation, but is it what you meant?  
> **username_0**: That is more along the lines of what I mean Jim yep!  I added some more detailed example info that hopefully helps clarify it, but you have the general idea of what it is I mean, yeah  
> **username_1**: Please don't crosspost! That's impolite towards potential answerers which may waster their time producing redundant answers.  
> **username_0**: I posted to CS before finding out that there was a theoretical CS board, which seems more correct.  I can delete this one if you'd prefer, but as there is useful info here, seems better to leave it.  
> **username_0**: Raphael, gotcha on the cross posting and I will avoid in the future. As this is part of research for a CS paper, and theoretical CS received the question well, while regular CS didn't, I really think TCS is the place for it.  

---

## 8 answers

### Answer by username_10 on 2015-09-07. Score: 17 | Accepted answer

I'm not sure, but you might be talking about what has been termed **[incremental computation](https://en.wikipedia.org/wiki/Incremental_computing)**.

The key idea behind incremental computation is to program in a way such that the program responds to input changes by updating its output while **only re-evaluating those portions of the program affected by the change**. Incremental computing is feasible in situations where input changes lead to relatively small changes in the output. Clearly, in limiting cases one cannot avoid a complete re-computation of the output, but in many cases the results of the previous computation may be re-used to obtain the updated output more quickly than a complete re-evaluation. In many cases, taking advantage of incrementality therefore dramatically improves performance, especially as the input size increases.

Designing and developing applications that respond to incremental modifications, however, is challenging: it often involves developing highly specific, complex algorithms.

This has lead some people to investigate the idea of moving the responsibility to avoid reevaluation where possible to the language run-time: instead of expecting the programmer to develop software for a particular application and a particular class of incremental modifications, the language run-time is tracking the dynamic data dependences of the computation and incrementally updating their output as needed. This is called or **self-adjusting computation**, and the person most associated with this programming language approach is Umut Acar. I recommend visiting [his website](http://www.umut-acar.org/self-adjusting-computation) for further information.

Note that ideas like this go back to the 1950s. Ad-hoc forms of incremental computing are heavily used in modern web-browsers because you don't want to reprocess ("reflow") the full page when a mutatation (e.g. Javascript performs a DOM operation) is performed.

I also recommend to consider the related field of **[online algorithms](https://en.wikipedia.org/wiki/Online_algorithm)**.


---

### Answer by username_4 on 2015-09-07. Score: 8

Some of the very early work on complexity theory used a sequential time model -- that is, rather than studying the worst-case runtime of the TM that can produce the correct output on an arbitrary input, they studied machines that would run infinitely and enumerate the correct output for each input in lexicographic order. The complexity of the machine was then based on the worst-case time gap ("delay") between the enumeration of consecutive outputs. This model can be used to study the problem of taking an input $1^n$ and producing on output the $2^n$-sized truth table of a language on all inputs of length $n$ , while trying to minimize the average computation time required per input (so $2^n poly(n)$ is considered "efficient" in this model). This seems pretty similar to the question you're asking.

[Here](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.308.7011&rep=rep1&type=pdf) is a paper that uses that model. [Here](https://rjlipton.wordpress.com/2012/06/15/why-the-hartmanis-stearns-conjecture-is-still-open/) is a blog post that is only somewhat related, but includes some references that you might find interesting.

One note about this model is that for some NP problems, including SAT, you can print their truth table in polynomial time per bit by exploiting the self-reducibility of the problem. For example, with SAT, you can always efficiently find the next bit of the truth table by fixing one of the variables, computing the reduced version of the problem under this variable fix, and then looking up the solution to the reduced version of the problem in the truth table that you have computed so far.

> **Comments:**
> **username_5**: FYI, the concept of polynomial delay is still relevant in most places that combinatorial enumeration gets used. For example, listing all groups of a given order up to isomorphism, listing all instances of a given graph $H$ in a bigger graph $G$, etc.  

---

### Answer by username_6 on 2015-09-08. Score: 6

It's difficult to know what you mean because you're staying at a level that's so high that there's nothing interesting. Specific cases could be very interesting, but the basic idea that having computed a function for one input can make it easier to compute it for other inputs is too general.

It may be that you have a function $f$ such that having computed $f(x)$, you gain some information about $f(g(x))$ for certain choices of functions $g$: there's an equation of the form $\forall x, f(g(x)) = h(f(x))$. The general term for such properties is a [morphism](https://en.wikipedia.org/wiki/Morphism): $f$ is a morphism from $(D,g)$ to $(R,h)$ where $D$ is the domain of $f$ and $R$ is its range. The interesting part is finding useful algebraic structures with such properties.

Sometimes the computation of $f(x)$ involves work that's the same for all possible inputs, or for a subset of possible inputs that are in some sense sufficiently similar. Splitting the computation into a common part and an input-specific part is known as [partial evaluation](https://en.wikipedia.org/wiki/Partial_evaluation). The interesting aspect is finding useful ways to partially evaluate a function, and useful ways to memorize and consult partial results without wasting more time consulting cached partial results than would have been spent recalculating the thing.

> **Comments:**
> **username_0**: Sorry to be so vague Gilles.  Your middle paragraph is really interesting and i think is the most similar of anything I've heard about or come across in my search so far.  The fact that there isn't a straight match to my question is an answer in it's own way.  

---

### Answer by username_8 on 2015-09-07. Score: 5

You seem to be asking about [incremental computation](https://en.wikipedia.org/wiki/Incremental_computing).

In general, it takes the following form: we have a function $f$, which is expensive to compute. We have computed $f(x)$ for a single input $x$. Now we want to compute $f(x')$, for a second input $x'$ where $x'$ is somehow "similar" to $x$. It'd be nice if we could take advantage of the fact that we already know $f(x)$ to compute $f(x')$ more quickly than computing it from scratch. This is the sort of problem that incremental computation helps with.

There are many methods for incremental computation: too many to list here. The particular method to use will depend on the nature of the function $f$. The Wikipedia article I linked to has a few references to get you started. If you want more details, you'll probably need to pick a single function $f$ and ask about that one, or a narrowly-defined class of functions $f$.

You might also be interested in [strength reduction](https://en.wikipedia.org/wiki/Strength_reduction) from the compiler optimization literature.

> **Comments:**
> **username_0**: Incremental computation looks like a near hit.  The case I'm looking at has it such that "reinterpreting" the result to get another answer doesn't rely on the details of the function/algorithm/circuit at all.  It does seem like there'd be some similar ideas reading up on it though.  I'll check the other as well, thanks for the info!  
> **username_8**: @AlanWolfe, cool, I hope it helps!  If this doesn't match the needs of your particular case, you might want to ask a new question about your specific case and provide more details about your particular case.  (Incidentally, the "re-interpreting" part has me puzzled; I'm not sure where that comes in, so if you ask a new question, you might need to explain that more carefully, or consider whether the "re-interpreting" language is adding anything.)  
> **username_0**: I added some more about that to the question. It's hard cause I'm trying to find out if ive found anything remotely novel, or if it's already known, so I don't want to give it all away just to get scooped hehe.  
> **username_8**: @AlanWolfe, I understand, but I'm afraid that kind of question might not be a good fit here.  Playing 'hide the ball' or 'guess what Alan is thinking' is not a good fit for this site format.  If your situation is such that you can't provide information that's relevant or necessary to understand what exactly you're asking, it's possible you might need to figure it out on your own or hire a consultant who will sign a NDA, rather than asking here.  Just my personal opinion; others might differ.  
> **username_0**: For sure.  I've gotten great info on some related topics.  That nothing is an exact match seems to point in the right direction and I have more to read about now.  

---

### Answer by username_5 on 2015-09-08. Score: 4

This is basically what **dynamic data structures** and **streaming algorithms** are about. A few links, off the top of my Google:

* [High performance data structure for streaming graphs](http://www.stingergraph.com/papers/HPEC12_Ediger.pdf)
* [Mihai Patrascu's thesis](http://erikdemaine.org/theses/mpatrascu.pdf)
* [Dynamic Integer Sets with Optimal Rank, Select, and Predecessor Search](http://arxiv.org/abs/1408.3045)
* [Dynamic shortest paths and transitive closures](http://www.dis.uniroma1.it/~demetres/docs/dynamic-techniques.pdf)

For example, a dynamic data structure for shortest paths in a graph computes all shortest paths in a graph, and then when you add or remove edges to the graph should do the least amount of work needed to update all of the shortest path information. (Actually, frequently it is a combination of running time and the space needed for the data structure that is considered, but for the purposes of this question that's just a detail.)


---

### Answer by username_7 on 2015-09-08. Score: 4

Many times, we can use [Linearization](https://en.wikipedia.org/wiki/Linearization) of a function to approximate values near a point to reasonable accuracy. A single answer is generated with expensive algorithms (e.g., $\sqrt{2}\approx1.41421...$) then nearby answers are generated from that answer with a simple algorithm (e.g., $\sqrt{x}\approx0.35355x+0.70711, x\approx2$. Using expensive algorithms, $\sqrt{2.05}\approx1.43178$, while the cheap algorithm produces $\sqrt{2.05}\approx1.43189$. $\sqrt{1.95}\approx1.39642$ (expensive) and $\sqrt{1.95}\approx1.39653$ (cheap) are likewise quite close.

A really simplified version of the above is when we approximate a function as constant near a point, such as the surface gravity of a planet. $f={{m\_om\_nG}\over{r^2}},a={f\over{m\_o}}$ becomes $a=c\_n$ where $c\_n$ is calculated once at planet $n$'s creation in a game or simulation.

To a large extent though, this "strange concept" is how basic computer science works. We save intermediate results then calculate many end results from that number, rather than re-doing expensive computations repeatedly. It's just that normal programming simplifies the concept further. $s=\sqrt{2}, x=s+4, y=s+9$ is more readable than $x=\sqrt{2}+4, y=x+5$ (especially if we're calculating hundreds of variables), and if we don't know the offsets ahead of time, $s=\sqrt{2}, x=s+O\_x, y=s+O\_y$ is faster than $x=\sqrt{2}+O\_x, y=x+(O\_y-O\_x)$.

Another way to use previous data is the incremental results methods used in things like data backup and video streaming to save bandwidth and time. Each frame is re-calculated using multiple differential frames rather than being transmitted in its entirety.

A different class of this concept is calculations that require super-slow or real-money-expensive processes, like humans or sending satellites to space. We take these "algorithms" and re-interpret the results in a different context. For example, we can measure irradiance from the Sun near Earth at $1367 {W\over{m^2}}$ using expensive satellite equipment. Now we can calculate irradiance near other bodies quickly and cheaply. For example, $P\_{Mars}=P\_{Earth}{(1 AU)^2\over(1.52 AU)^2}\approx592{W\over{m^2}}$.

Addendum:  
I don't think what you're asking for is possible in a direct sense. If getting $f(x+\Delta x)$ from $f(x)$ is somehow easier than plugging $x+\Delta x$ directly into $f()$ then you can probably simplify $f()$ somehow.

Let's use your example. $f(x\_1)=8x\_1=h$, so now we want to find $f(x\_2)$$=f(x\_1+\Delta x)$ as a function of $h$ and something else. $f(x\_1+\Delta x)$$=8(x\_1+\Delta x)$$=h+8\Delta x$$=h+8(x\_2-x\_1)$. We could try it as $f(x\_2)=f(x\_1\*k\_2)$, which gets $f(x\_2)$$=8(x\_1k\_2)$$=h{{x\_2}\over{x\_1}}$. In either case, we do more work getting $x\_2$ from $x\_1$ than just calculating $f(x\_2)=8x\_2$ directly.

I don't have mathematical proof of this, but I would imagine this holds for any complex function, because a function is *already* a definition of how to relate inputs to outputs. If you could somehow re-define an extremely complex formula for all inputs relative to a known output, then nobody would bother with the complex formula anymore except to show how they got the fast formula.

> **Comments:**
> **username_0**: By "strange concept" I mean the literal interpretation of what I've said. You evaluate some logic circuit of XORs and ANDs in a special way and get back a bit string as an answer. You do an operation (say, XOR for example) using a constant that is based on the inputs to get the right answer. You can then change the inputs, which changes the constant, and by decoding the answer you already have using the new constant, you get the right answer for the changed inputs, without having to reevaluate the logic.  
> **username_0**: Oh but FYI this isn't iterative computation.  I also wanted to say thank you for the response, it has some good interesting info (:  

---

### Answer by username_9 on 2015-09-07. Score: 2

This paper describes a new form of incremental computation: taking derivatives on data-type-valued functions (e.g. List-valued functions).

<http://www.informatik.uni-marburg.de/~pgiarrusso/papers/pldi14-ilc-author-final.pdf>


---

### Answer by username_0 on 2015-09-29. Score: 0

For what it's worth, it turns out that this is how quantum computing works. When it does it's computations, it does so on cubits which can be 1, 0, or a superposition of 1 and 0. If you use superpositional bits, it means that it does the computations on all possible bit value permutations. It's only when the result is "observed" that it collapses into an actual value. Unfortunately you can't (or they don't know how) to clone the result in the unobserved state, so you can't get access to all permutations, only one of them.


---

