Is integration and differentiation code sepparate?
Subject: Is integration and differentiation code sepparate?
From: Dr. David Kirkby
Date: Sun, 14 Nov 2010 01:37:08 +0000
On 11/12/10 04:26 PM, Stavros Macrakis wrote:
> For polynomials, it is highly unlikely that random-coefficient tests will
> find any problems.
I thought that might be the case. But for the purposes of developing some test
code, it seemed an easy way to start. I've not testing that many - perhaps
10,000 or so.
If I got some code that I thought was worthwhile, I'd run it overnight. I keep
my Sun on 24/7, so it might as well compute something.
I am using the time of day to seed the random number generator, but I have the
option of commenting that out. In fact, the first few lines of my code have
/* Comment out the next line if you want the same output each time */
#define SEED_RANDOM_NUMBER_GENERATOR
In any case, I would save any failed results.
I can however see the point in general of having one set of data, and testing
new versions against that, to see if there are any regressions.
> By the way, you mention complex powers in your polynomials. Fractional and
> complex powers are not normally considered polynomials (for lots of good
> reasons).
I was not using fractional powers, but I was using complex ones.
These are the sort of things I'd generated
f1=-10 -5*I*x^1 +0*I*x^2 +0*x^3 +1*x^(I*4) -5*I*x^5
f1=-2*I -7*x^1 -5*x^2 -7*x^(I*3) +0*I*x^4 -2*x^5
f1=+5*I -8*x^(I*1) -2*x^2 -8*I*x^3 -4*x^(I*4) -10*I*x^5
f1=-7*I +0*I*x^(I*1) -4*x^(I*2) -5*I*x^(I*3) -3*I*x^4 +8*x^(I*5)
f1=+10*I +0*x^1 -2*x^2 -8*x^(I*3) -10*x^(I*4) -3*I*x^5
f1=-9*I +5*I*x^(I*1) +10*I*x^2 -6*x^(I*3) +4*I*x^4 -7*x^(I*5)
f1=-6 +6*x^1 -2*I*x^2 +9*I*x^(I*3) -7*x^(I*4) -4*I*x^(I*5)
f1=+7*I -1*I*x^(I*1) +3*I*x^(I*2) -6*I*x^(I*3) +8*I*x^(I*4) +0*x^(I*5)
f1=-2 +9*x^(I*1) -1*I*x^2 -3*x^3 -1*I*x^(I*4) -8*x^(I*5)
f1=+10 +7*I*x^(I*1) -2*x^2 +2*I*x^3 +5*I*x^(I*4) +2*I*x^(I*5)
though I had used much higher powers. In the above the probability of a number
being complex was 0.5, but I can change that.
> For non-polynomials, it should of course be true that
> Differentiate(Integrate(f)) = f. However, that does not mean that the
> *form* of Differentiate(Integrate(f)) is the same as f. And determining
> whether two expressions represent the same function is often difficult (in
> fact unsolvable in
> general<http://books.google.com/books?id=B9tC7DOX_oUC&pg=PA81&lpg=PA81&dq=zero-equivalence+unsolvable&source=bl&ots=rhQBOJvapS&sig=hGndNQi1tohzn7VBGidMeojpv64&hl=en&ei=7WndTJKPO4P58Aa9v8jxDw&sa=X&oi=book_result&ct=result&resnum=5&ved=0CDgQ6AEwBA#v=onepage&q=zero-equivalence%20unsolvable&f=false>
> ).
OK, thank you for that. I was not aware that was the case. I know I managed to
get some pretty big expressions from something quite simple.
In which case, substituting x for some real number, should allow the in both my
original function, and what I've differenced would give a reasonable degree of
certainty that there was not a bug. If I could get a numerical result, which was
identical, it is likely the symoblic results were mathematically equal.
Does that make sense?
Dave