Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

It is necessary to have purpose. -- Alice #1, "I, Mudd", stardate 4513.3


devel / comp.lang.fortran / Automatic Differentiation

SubjectAuthor
* Automatic DifferentiationDaniel Feenberg
+- Re: Automatic DifferentiationRon Shepard
+* Re: Automatic DifferentiationThomas Koenig
|`* Re: Automatic Differentiationgah4
| `* Re: Automatic DifferentiationThomas Koenig
|  +* Re: Automatic Differentiationgah4
|  |+- Re: Automatic DifferentiationThomas Koenig
|  |+* Re: Automatic DifferentiationSpiros Bousbouras
|  ||`* Re: Automatic DifferentiationArjen Markus
|  || `* Re: Automatic DifferentiationRon Shepard
|  ||  +- Re: Automatic Differentiationgah4
|  ||  `- Re: Automatic DifferentiationThomas Koenig
|  |`- Re: Automatic DifferentiationIan Gay
|  +* Re: Automatic DifferentiationDaniel Feenberg
|  |+- Re: Automatic DifferentiationArjen Markus
|  |`- Re: Automatic Differentiationgah4
|  `* Re: Automatic DifferentiationStefan Ram
|   `* Re: Automatic DifferentiationThomas Koenig
|    +- Re: Automatic DifferentiationStefan Ram
|    +- Re: Automatic DifferentiationStefan Ram
|    `* Re: Automatic Differentiationgah4
|     `- Re: Automatic DifferentiationRon Shepard
+- Re: Automatic Differentiationgah4
+- Re: Automatic DifferentiationDavid Duffy
+* Re: Automatic DifferentiationJeff Ryman
|`- Re: Automatic DifferentiationArjen Markus
`- Re: Automatic DifferentiationLouis Krupp

Pages:12
Automatic Differentiation

<18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2169&group=comp.lang.fortran#2169

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:29e6:b0:44a:2d0f:bf63 with SMTP id jv6-20020a05621429e600b0044a2d0fbf63mr12482146qvb.93.1650888304756;
Mon, 25 Apr 2022 05:05:04 -0700 (PDT)
X-Received: by 2002:a25:31c2:0:b0:641:660f:230f with SMTP id
x185-20020a2531c2000000b00641660f230fmr15572658ybx.472.1650888304535; Mon, 25
Apr 2022 05:05:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 25 Apr 2022 05:05:04 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=71.192.180.75; posting-account=UKzVQwoAAAC0p4fW4nFhSsDyRRVgSJiF
NNTP-Posting-Host: 71.192.180.75
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Subject: Automatic Differentiation
From: feenberg@gmail.com (Daniel Feenberg)
Injection-Date: Mon, 25 Apr 2022 12:05:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 22
 by: Daniel Feenberg - Mon, 25 Apr 2022 12:05 UTC

There are a number of hits to "fortran automatic differentiation" but the only one that claims to be available without cost is ADIFOR, from the Argonne Laboratory. On various web pages I have found 5 email addresses and 3 phone numbers. According to the web page, potential users should write to one of the addresses for access to the program itself.
I have writen to Paul Hovland (hovland@mcs.anl.gov) and Alan Carle (carle@rice.edu) but I have received no response from either. Another page at ANL (https://www.anl.gov/partnerships/adifor-automatic-differentiation-of-fortran-77 ) gives the 2 phone numbers but neither is in service. A webpage at Rice University (http://www.crpc.rice.edu/newsletters/sum95/news.adifor.html ) adds another email address (bischof@mcs.anl.gov ), also no response there. These pages are 30 years old, so no real surprise. partners@anl.gov did respond and was referred to the same web page that proved uninformative above.

It seems like a very well documented and useful program. It seems a shame for it to die. I do have a large F77 program so I do expect it would be useful for me.

Daniel Feenberg
National Bureau of Economic Research
Cambridge MA 02138

Re: Automatic Differentiation

<8Yz9K.6818$_Ol4.2018@fx08.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2170&group=comp.lang.fortran#2170

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx08.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0)
Gecko/20100101 Thunderbird/91.8.1
Subject: Re: Automatic Differentiation
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 20
Message-ID: <8Yz9K.6818$_Ol4.2018@fx08.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Mon, 25 Apr 2022 11:25:39 -0500
X-Received-Bytes: 2610
 by: Ron Shepard - Mon, 25 Apr 2022 16:25 UTC

On 4/25/22 7:05 AM, Daniel Feenberg wrote:
> There are a number of hits to "fortran automatic differentiation" but the only one that claims to be available without cost is ADIFOR, from the Argonne Laboratory. On various web pages I have found 5 email addresses and 3 phone numbers. According to the web page, potential users should write to one of the addresses for access to the program itself.
>
> I have writen to Paul Hovland (hovland@mcs.anl.gov) and Alan Carle (carle@rice.edu) but I have received no response from either. Another page at ANL (https://www.anl.gov/partnerships/adifor-automatic-differentiation-of-fortran-77 ) gives the 2 phone numbers but neither is in service. A webpage at Rice University (http://www.crpc.rice.edu/newsletters/sum95/news.adifor.html ) adds another email address (bischof@mcs.anl.gov ), also no response there. These pages are 30 years old, so no real surprise. partners@anl.gov did respond and was referred to the same web page that proved uninformative above.
>
> It seems like a very well documented and useful program. It seems a shame for it to die. I do have a large F77 program so I do expect it would be useful for me.
>
> Daniel Feenberg
> National Bureau of Economic Research
> Cambridge MA 02138

The Paul Hovland contact should be active. This is still an active area
of research for that group. The code works also with f90+ (modules,
operators, defined types, etc.), but I do not know the current status
regarding the most recent language versions.

Chris Bischof moved to Aachen, Germany about 15 years ago, but I think
he is also still active in that area of research.

$.02 -Ron Shepard

Re: Automatic Differentiation

<t46iir$uun$2@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2171&group=comp.lang.fortran#2171

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Mon, 25 Apr 2022 16:34:35 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t46iir$uun$2@newsreader4.netcologne.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Injection-Date: Mon, 25 Apr 2022 16:34:35 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:f179:0:7285:c2ff:fe6c:992d";
logging-data="31703"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 25 Apr 2022 16:34 UTC

Daniel Feenberg <feenberg@gmail.com> schrieb:

> There are a number of hits to "fortran automatic differentiation"
> but the only one that claims to be available without cost is ADIFOR,
> from the Argonne Laboratory. On various web pages I have found 5
> email addresses and 3 phone numbers. According to the web page,
> potential users should write to one of the addresses for access
> to the program itself.

What exactly do you need differentiated?

If you want fully automated Fortran-to-Fortran conversion, then
I don't have anything.

If you can massage your formulas so Maxima can accept them,
like

(%i1) display2d:false;

(%o1) false
(%i2) diff(sin(x^2),x);

(%o2) 2*x*cos(x^2)

from which you can massage the outputs into valid Fortran.

Maple (which isn't free) can write fixed-form Fortran code.

Re: Automatic Differentiation

<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2172&group=comp.lang.fortran#2172

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:2683:b0:69c:8c9c:5f80 with SMTP id c3-20020a05620a268300b0069c8c9c5f80mr11447141qkp.367.1650916364948;
Mon, 25 Apr 2022 12:52:44 -0700 (PDT)
X-Received: by 2002:a05:6902:2d0:b0:625:2a16:2469 with SMTP id
w16-20020a05690202d000b006252a162469mr17786377ybh.386.1650916364819; Mon, 25
Apr 2022 12:52:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 25 Apr 2022 12:52:44 -0700 (PDT)
In-Reply-To: <t46iir$uun$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:74de:b1d7:43d3:1290;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:74de:b1d7:43d3:1290
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
Subject: Re: Automatic Differentiation
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 25 Apr 2022 19:52:44 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 35
 by: gah4 - Mon, 25 Apr 2022 19:52 UTC

On Monday, April 25, 2022 at 9:34:39 AM UTC-7, Thomas Koenig wrote:

(snip)

> What exactly do you need differentiated?
> If you want fully automated Fortran-to-Fortran conversion, then
> I don't have anything.
> If you can massage your formulas so Maxima can accept them,
> like
>
(snip)

> (%i2) diff(sin(x^2),x);
>
> (%o2) 2*x*cos(x^2)
I read just a little of the description, which mentions functions
and subroutines.

Yes there are a few ways to differentiate an expression, in Fortran or not,
and get the result. But now consider a whole Fortran function!

You might have a Fortran function with loops and IFs and all, and
desire a similar function returning the derivative of that one.
A program (or you) could go through statement by statement,
adding after each statement, a statement to evaluate the
derivative of that one. Later statements will likely need both
the value of variables, and also (from the product rule and
chain rule) the derivative.

Re: Automatic Differentiation

<810cd1d1-0470-45cc-b4c0-a51c101aaa51n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2173&group=comp.lang.fortran#2173

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ae9:d61e:0:b0:69e:d1e5:6e9f with SMTP id r30-20020ae9d61e000000b0069ed1e56e9fmr11088300qkk.680.1650917023094;
Mon, 25 Apr 2022 13:03:43 -0700 (PDT)
X-Received: by 2002:a25:d0d4:0:b0:646:f932:5d0f with SMTP id
h203-20020a25d0d4000000b00646f9325d0fmr12349777ybg.456.1650917022897; Mon, 25
Apr 2022 13:03:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 25 Apr 2022 13:03:42 -0700 (PDT)
In-Reply-To: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:74de:b1d7:43d3:1290;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:74de:b1d7:43d3:1290
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <810cd1d1-0470-45cc-b4c0-a51c101aaa51n@googlegroups.com>
Subject: Re: Automatic Differentiation
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 25 Apr 2022 20:03:43 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 34
 by: gah4 - Mon, 25 Apr 2022 20:03 UTC

On Monday, April 25, 2022 at 5:05:06 AM UTC-7, feen...@gmail.com wrote:
> There are a number of hits to "fortran automatic differentiation"
> but the only one that claims to be available without cost is ADIFOR,

This reminds me of a system I knew years ago called Prose.
It seems to be mentioned here, along with the follow-on: fortranCalculus:

https://goal-driven.net/compiler-intro-&-history/history.html

Prose was developed and available in the 1970's, and it seems from
above gone by 1980. It was 1978 when I knew about it.

It is an interpreted language that includes the ability to keep track
of derivatives along with each variable, and then use them in the
included solvers, or in user-written code.

About that time, it occurred to me, since all Fortran compilers I
knew used library routines for complex multiply and divide, that
you could replace those with routines that return the value and
derivative. That is, that use the calculus product rule and
quotient rule for each operation. In that case, any expression
that you could write with +, -, *, and /, would return the value and
its derivative. I don't remember thinking about it up to **, or
built-in functions, but you could also do it for them.

In any case, the idea for Prose, and I presume fortranCalculus
(that seems the capitalization they use) is to keep derivatives
along with each variable, and use them as needed, but built
into the language.

Otherwise, I have much fun with the TI-92 calculator, which
has a derivative operator, and can generate symbolic derivatives
of expressions entered.

Re: Automatic Differentiation

<t46vde$8sm$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2174&group=comp.lang.fortran#2174

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Mon, 25 Apr 2022 20:13:34 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t46vde$8sm$1@newsreader4.netcologne.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de>
<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
Injection-Date: Mon, 25 Apr 2022 20:13:34 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:f179:0:7285:c2ff:fe6c:992d";
logging-data="9110"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 25 Apr 2022 20:13 UTC

gah4 <gah4@u.washington.edu> schrieb:
> On Monday, April 25, 2022 at 9:34:39 AM UTC-7, Thomas Koenig wrote:
>
> (snip)
>
>> What exactly do you need differentiated?
>
>> If you want fully automated Fortran-to-Fortran conversion, then
>> I don't have anything.
>
>> If you can massage your formulas so Maxima can accept them,
>> like
>>
> (snip)
>
>> (%i2) diff(sin(x^2),x);
>>
>> (%o2) 2*x*cos(x^2)
>
> I read just a little of the description, which mentions functions
> and subroutines.
>
> Yes there are a few ways to differentiate an expression, in Fortran or not,
> and get the result. But now consider a whole Fortran function!
>
> You might have a Fortran function with loops and IFs and all, and
> desire a similar function returning the derivative of that one.
> A program (or you) could go through statement by statement,
> adding after each statement, a statement to evaluate the
> derivative of that one. Later statements will likely need both
> the value of variables, and also (from the product rule and
> chain rule) the derivative.

With IFs, it is really hard - what should the derivative of

if (x > 0.1) then
foo = 1+x
else
foo = -1-x
end if

be?

Also, you usually want many derivatives for a filling a Jacobi
matrix, which should be well-behaved, and your function should at
least be continuous, or you will get into hot water with whatever
you plan to do with that matrix.

Re: Automatic Differentiation

<d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2175&group=comp.lang.fortran#2175

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:2a8e:b0:443:8a10:c1ca with SMTP id jr14-20020a0562142a8e00b004438a10c1camr13728419qvb.88.1650918829920;
Mon, 25 Apr 2022 13:33:49 -0700 (PDT)
X-Received: by 2002:a0d:d953:0:b0:2f7:d5ce:f204 with SMTP id
b80-20020a0dd953000000b002f7d5cef204mr9052533ywe.502.1650918829785; Mon, 25
Apr 2022 13:33:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 25 Apr 2022 13:33:49 -0700 (PDT)
In-Reply-To: <t46vde$8sm$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:74de:b1d7:43d3:1290;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:74de:b1d7:43d3:1290
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
Subject: Re: Automatic Differentiation
From: gah4@u.washington.edu (gah4)
Injection-Date: Mon, 25 Apr 2022 20:33:49 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 55
 by: gah4 - Mon, 25 Apr 2022 20:33 UTC

On Monday, April 25, 2022 at 1:13:37 PM UTC-7, Thomas Koenig wrote:
> gah4 <ga...@u.washington.edu> schrieb:

(snip)

> > You might have a Fortran function with loops and IFs and all, and
> > desire a similar function returning the derivative of that one.
> > A program (or you) could go through statement by statement,
> > adding after each statement, a statement to evaluate the
> > derivative of that one. Later statements will likely need both
> > the value of variables, and also (from the product rule and
> > chain rule) the derivative.

> With IFs, it is really hard - what should the derivative of
> if (x > 0.1) then
> foo = 1+x
> else
> foo = -1-x
> end if
What it should do is easy, but what you do with the result, is where
it gets harder:

if (x > 0.1) then
foo = 1+x
dfoodx = 1
else
foo = -1-x
dfoodx = -1
end if

> Also, you usually want many derivatives for a filling a Jacobi
> matrix, which should be well-behaved, and your function should at
> least be continuous, or you will get into hot water with whatever
> you plan to do with that matrix.

It does help to have a good understanding of the problem you are
working in, and especially where things can go wrong.

But usually the problem is more general, and so outside the derivative problem.

I do remember doing much non-linear least-squares fitting, with the usual
Newton's method solver. You might have a function that can only be evaluated
for positive values, but it tries for negative values anyway.

Now, if it is using sqrt, the function value and its derivative will
have problems when it goes negative.

I do remember, though hand computing some derivatives to put
into least-squares fitting programs. Automating might have
been nice to have.

Re: Automatic Differentiation

<t472dq$a6d$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2176&group=comp.lang.fortran#2176

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Mon, 25 Apr 2022 21:04:58 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t472dq$a6d$1@newsreader4.netcologne.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de>
<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
<d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 25 Apr 2022 21:04:58 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:f179:0:7285:c2ff:fe6c:992d";
logging-data="10445"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Mon, 25 Apr 2022 21:04 UTC

gah4 <gah4@u.washington.edu> schrieb:

> I do remember, though hand computing some derivatives to put
> into least-squares fitting programs. Automating might have
> been nice to have.

A few decades ago, I started using REDUCE for automatically
calculating derivatives, which I then transferred to FORTRAN to
do some calculations with equations of state, and then transferred
them to F77 using an editor.

It was nice, but the expressions became really big (naming the
program EXPAND might have been more appropriate).

A few years later, Maple sold site-wide licenses to all universities
of the state of Baden-Württemberg, and I started using that.

Re: Automatic Differentiation

<t47am9$utv$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2177&group=comp.lang.fortran#2177

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!xPvm3XcqrOPFJ3ePU5HxpQ.user.46.165.242.75.POSTED!not-for-mail
From: davidD@qimr.edu.au (David Duffy)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Mon, 25 Apr 2022 23:26:03 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t47am9$utv$1@gioia.aioe.org>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Injection-Info: gioia.aioe.org; logging-data="31679"; posting-host="xPvm3XcqrOPFJ3ePU5HxpQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.4-20191224 ("Millburn") (Linux/5.4.0-109-generic (x86_64))
X-Notice: Filtered by postfilter v. 0.9.2
 by: David Duffy - Mon, 25 Apr 2022 23:26 UTC

Daniel Feenberg <feenberg@gmail.com> wrote:
> There are a number of hits to "fortran automatic differentiation"
> but the only one that claims to be available without cost is ADIFOR,
> from the Argonne Laboratory. On various web pages I have found 5 email
> addresses and 3 phone numbers. According to the web page, potential
> users should write to one of the addresses for access to the program
> itself.

http://www.autodiff.org/?module=Tools&language=Fortran77

lists quite a few that still seem to be free. I last used TAPENADE,
which still offers a service where you upload your subroutine(s) that
you want to equip.

Some posters upthread were wondering why such a technology has not
been replaced by symbolic differentiation. The autodiff.org FAQ mentions

How big a function can one differentiate using AD? The largest
application to date is a 1.6 million line FEM code written in Fortran 77.

Cheers, David Duffy.

Re: Automatic Differentiation

<fc2af464-1a7d-4c8a-aa97-e458d9b93988n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2178&group=comp.lang.fortran#2178

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a37:9b0f:0:b0:69f:4fe9:1b8c with SMTP id d15-20020a379b0f000000b0069f4fe91b8cmr4751727qke.293.1650930913177;
Mon, 25 Apr 2022 16:55:13 -0700 (PDT)
X-Received: by 2002:a25:d0d4:0:b0:646:f932:5d0f with SMTP id
h203-20020a25d0d4000000b00646f9325d0fmr13180156ybg.456.1650930912951; Mon, 25
Apr 2022 16:55:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Mon, 25 Apr 2022 16:55:12 -0700 (PDT)
In-Reply-To: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=64.124.31.115; posting-account=5z--qAoAAACnug7j_OOF1c_Rr7Nr64Gy
NNTP-Posting-Host: 64.124.31.115
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc2af464-1a7d-4c8a-aa97-e458d9b93988n@googlegroups.com>
Subject: Re: Automatic Differentiation
From: rymanjc@outlook.com (Jeff Ryman)
Injection-Date: Mon, 25 Apr 2022 23:55:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jeff Ryman - Mon, 25 Apr 2022 23:55 UTC

On Monday, April 25, 2022 at 5:05:06 AM UTC-7, feen...@gmail.com wrote:
> There are a number of hits to "fortran automatic differentiation" but the only one that claims to be available without cost is ADIFOR, from the Argonne Laboratory. On various web pages I have found 5 email addresses and 3 phone numbers. According to the web page, potential users should write to one of the addresses for access to the program itself.
>
> I have writen to Paul Hovland (hov...@mcs.anl.gov) and Alan Carle (ca...@rice.edu) but I have received no response from either. Another page at ANL (https://www.anl.gov/partnerships/adifor-automatic-differentiation-of-fortran-77 ) gives the 2 phone numbers but neither is in service. A webpage at Rice University (http://www.crpc.rice.edu/newsletters/sum95/news.adifor.html ) adds another email address (bis...@mcs.anl.gov ), also no response there.. These pages are 30 years old, so no real surprise. part...@anl.gov did respond and was referred to the same web page that proved uninformative above..
>
> It seems like a very well documented and useful program. It seems a shame for it to die. I do have a large F77 program so I do expect it would be useful for me.
>
> Daniel Feenberg
> National Bureau of Economic Research
> Cambridge MA 02138

Although it hasn't been worked on in some time there is also GRESS 3.0 from RSICC. See https://rsicc.ornl.gov/codes/psr/psr2/psr-231.html . It was only for Fortran 77. Although software with CCC- and DLC- designations have a fee, the last time I checked PSR- packages were still no cost.

Re: Automatic Differentiation

<ec981d60-c2fa-4e6c-b0ee-cb2aaa203682n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2179&group=comp.lang.fortran#2179

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:1767:b0:456:f39:4cbb with SMTP id et7-20020a056214176700b004560f394cbbmr10909815qvb.37.1650963666862;
Tue, 26 Apr 2022 02:01:06 -0700 (PDT)
X-Received: by 2002:a0d:e645:0:b0:2f4:dbd6:261e with SMTP id
p66-20020a0de645000000b002f4dbd6261emr21086244ywe.7.1650963666652; Tue, 26
Apr 2022 02:01:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 02:01:06 -0700 (PDT)
In-Reply-To: <fc2af464-1a7d-4c8a-aa97-e458d9b93988n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.231.213.70; posting-account=A91wAAoAAADgBUxBX6QqsrSD26GLhVp8
NNTP-Posting-Host: 136.231.213.70
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <fc2af464-1a7d-4c8a-aa97-e458d9b93988n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec981d60-c2fa-4e6c-b0ee-cb2aaa203682n@googlegroups.com>
Subject: Re: Automatic Differentiation
From: arjen.markus895@gmail.com (Arjen Markus)
Injection-Date: Tue, 26 Apr 2022 09:01:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 37
 by: Arjen Markus - Tue, 26 Apr 2022 09:01 UTC

On Tuesday, April 26, 2022 at 1:55:14 AM UTC+2, rym wrote:
> On Monday, April 25, 2022 at 5:05:06 AM UTC-7, feen wrote:
> > There are a number of hits to "fortran automatic differentiation" but the only one that claims to be available without cost is ADIFOR, from the Argonne Laboratory. On various web pages I have found 5 email addresses and 3 phone numbers. According to the web page, potential users should write to one of the addresses for access to the program itself.
> >
> > I have writen to Paul Hovland and Alan Carle but I have received no response from either. Another page at ANL (https://www.anl.gov/partnerships/adifor-automatic-differentiation-of-fortran-77 ) gives the 2 phone numbers but neither is in service. A webpage at Rice University (http://www.crpc.rice..edu/newsletters/sum95/news.adifor.html ) adds another email address, also no response there. These pages are 30 years old, so no real surprise. part at anl.gov did respond and was referred to the same web page that proved uninformative above.
> >
> > It seems like a very well documented and useful program. It seems a shame for it to die. I do have a large F77 program so I do expect it would be useful for me.
> >
> > Daniel Feenberg
> > National Bureau of Economic Research
> > Cambridge MA 02138
> Although it hasn't been worked on in some time there is also GRESS 3.0 from RSICC. See https://rsicc.ornl.gov/codes/psr/psr2/psr-231.html . It was only for Fortran 77. Although software with CCC- and DLC- designations have a fee, the last time I checked PSR- packages were still no cost.

If a commercial solution is somehow acceptable, then NAG may have an alternative. I have worked with it a couple of years and it does what you want. I do not know more about ADIFOR than you.

Regards,

Arjen

PS I removed the email addresses to keep Google groups happy.

Re: Automatic Differentiation

<3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2181&group=comp.lang.fortran#2181

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:6206:b0:2f1:d7bc:7522 with SMTP id hj6-20020a05622a620600b002f1d7bc7522mr15059598qtb.556.1650975207238;
Tue, 26 Apr 2022 05:13:27 -0700 (PDT)
X-Received: by 2002:a25:9909:0:b0:624:57e:d919 with SMTP id
z9-20020a259909000000b00624057ed919mr20477349ybn.494.1650975207025; Tue, 26
Apr 2022 05:13:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 05:13:26 -0700 (PDT)
In-Reply-To: <t46vde$8sm$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=71.192.180.75; posting-account=UKzVQwoAAAC0p4fW4nFhSsDyRRVgSJiF
NNTP-Posting-Host: 71.192.180.75
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>
Subject: Re: Automatic Differentiation
From: feenberg@gmail.com (Daniel Feenberg)
Injection-Date: Tue, 26 Apr 2022 12:13:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 71
 by: Daniel Feenberg - Tue, 26 Apr 2022 12:13 UTC

On Monday, April 25, 2022 at 4:13:37 PM UTC-4, Thomas Koenig wrote:
> gah4 <ga...@u.washington.edu> schrieb:
> > On Monday, April 25, 2022 at 9:34:39 AM UTC-7, Thomas Koenig wrote:
> >
> > (snip)
> >
> >> What exactly do you need differentiated?
> >
I have a program that calculates income tax liability for any year from 1960-2023, and for any state. It is used by economists and others to estimate after tax income and prices in survey or administrative data. You can see it at http://taxsim.nber.org/taxsim35 . I have a hundred of so lines of fortran in the program to get the analytic derivative of federal tax with respect to earnings, but it would be too much work (and confusion) to do the states too, or any other types of income or deduction. There are different tax treatments for different types of income and deduction. I do use finite differences but they uncover many discontinuities, which are a problem for users.

> >> If you want fully automated Fortran-to-Fortran conversion, then
> >> I don't have anything.
> >
> >> If you can massage your formulas so Maxima can accept them,
> >> like
> >>
> > (snip)
> >
> >> (%i2) diff(sin(x^2),x);
> >>
> >> (%o2) 2*x*cos(x^2)
> >

I am familiar with symbolic computation programs, but that isn't what I am looking for. The whole program (excluding the user interface) is more than 20,000 lines of code. (Note for non-US readers: The US income tax system is very complicated compared to European ones, and it changes every year in every state. Sometimes it is just a parameter value that changes, but new provisions are common and old ones expire with regularity). Converting it all to Macsyma would be a chore. The documentation for ADIFOR is very clear, so I am still hoping to get it running.

> > I read just a little of the description, which mentions functions
> > and subroutines.
> >

> With IFs, it is really hard - what should the derivative of
>
> if (x > 0.1) then
> foo = 1+x
> else
> foo = -1-x
> end if
>
> be?
>
The AD program is another program, and when it executes the value of x would be a known constant. In my application dfoo/dx would be plus or minus one, depending on the value of x. The computer doesn't know about real numbers, but that doesn't bother me.

> Also, you usually want many derivatives for a filling a Jacobi
> matrix, which should be well-behaved, and your function should at
> least be continuous, or you will get into hot water with whatever
> you plan to do with that matrix.

It does seem that almost all authors of automatic differentiation software assume the application is for a Jacobi matrix but that isn't my application..

Daniel Feenberg

Re: Automatic Differentiation

<ZlDbRng+vmcK7PX0B@bongo-ra.co>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2182&group=comp.lang.fortran#2182

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Tue, 26 Apr 2022 12:35:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <ZlDbRng+vmcK7PX0B@bongo-ra.co>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de> <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 26 Apr 2022 12:35:35 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="85f2fb42fe4adebbcd02c52a8923f285";
logging-data="10051"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SQbXSeTT1RWS8GnlmwAFT"
Cancel-Lock: sha1:7p+/V8cSmJz95TqdHHnFWZVWEDs=
In-Reply-To: <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Tue, 26 Apr 2022 12:35 UTC

On Mon, 25 Apr 2022 13:33:49 -0700 (PDT)
gah4 <gah4@u.washington.edu> wrote:
> On Monday, April 25, 2022 at 1:13:37 PM UTC-7, Thomas Koenig wrote:
> > gah4 <ga...@u.washington.edu> schrieb:
>
> (snip)
>
> > > You might have a Fortran function with loops and IFs and all, and
> > > desire a similar function returning the derivative of that one.
> > > A program (or you) could go through statement by statement,
> > > adding after each statement, a statement to evaluate the
> > > derivative of that one. Later statements will likely need both
> > > the value of variables, and also (from the product rule and
> > > chain rule) the derivative.
>
> > With IFs, it is really hard - what should the derivative of
>
> > if (x > 0.1) then
> > foo = 1+x
> > else
> > foo = -1-x
> > end if
>
> What it should do is easy, but what you do with the result, is where
> it gets harder:
>
> if (x > 0.1) then
> foo = 1+x
> dfoodx = 1
> else
> foo = -1-x
> dfoodx = -1
> end if

Actually the derivative is not defined for x = 0.1 , foo is not even
continuous for x = 0.1

Re: Automatic Differentiation

<fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2183&group=comp.lang.fortran#2183

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:d0b:b0:446:59c7:8390 with SMTP id 11-20020a0562140d0b00b0044659c78390mr16352704qvh.41.1650979097845;
Tue, 26 Apr 2022 06:18:17 -0700 (PDT)
X-Received: by 2002:a25:73d1:0:b0:645:dba2:67c with SMTP id
o200-20020a2573d1000000b00645dba2067cmr16272281ybc.522.1650979097679; Tue, 26
Apr 2022 06:18:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 06:18:17 -0700 (PDT)
In-Reply-To: <ZlDbRng+vmcK7PX0B@bongo-ra.co>
Injection-Info: google-groups.googlegroups.com; posting-host=136.231.213.70; posting-account=A91wAAoAAADgBUxBX6QqsrSD26GLhVp8
NNTP-Posting-Host: 136.231.213.70
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de> <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
<ZlDbRng+vmcK7PX0B@bongo-ra.co>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>
Subject: Re: Automatic Differentiation
From: arjen.markus895@gmail.com (Arjen Markus)
Injection-Date: Tue, 26 Apr 2022 13:18:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 13
 by: Arjen Markus - Tue, 26 Apr 2022 13:18 UTC

On Tuesday, April 26, 2022 at 2:35:39 PM UTC+2, Spiros Bousbouras wrote:

> Actually the derivative is not defined for x = 0.1 , foo is not even
> continuous for x = 0.1

The function is continuous and differentiable on intervals not include x = 0.1. And that is exactly how it can be treated. Mind you, you do get results that are geared to precisely the surroundings of the input So, with discontinuous or non-smooth functions, you may need to consider different régimes.

Regards,

Arjen

Re: Automatic Differentiation

<024018e2-80dc-465f-8917-d8cc096e629en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2184&group=comp.lang.fortran#2184

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:c2b:b0:446:512a:26f7 with SMTP id a11-20020a0562140c2b00b00446512a26f7mr16313954qvd.38.1650979237465;
Tue, 26 Apr 2022 06:20:37 -0700 (PDT)
X-Received: by 2002:a25:59c4:0:b0:645:7d91:db7b with SMTP id
n187-20020a2559c4000000b006457d91db7bmr20462970ybb.273.1650979237131; Tue, 26
Apr 2022 06:20:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 06:20:36 -0700 (PDT)
In-Reply-To: <3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=136.231.213.70; posting-account=A91wAAoAAADgBUxBX6QqsrSD26GLhVp8
NNTP-Posting-Host: 136.231.213.70
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de> <3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <024018e2-80dc-465f-8917-d8cc096e629en@googlegroups.com>
Subject: Re: Automatic Differentiation
From: arjen.markus895@gmail.com (Arjen Markus)
Injection-Date: Tue, 26 Apr 2022 13:20:37 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 17
 by: Arjen Markus - Tue, 26 Apr 2022 13:20 UTC

On Tuesday, April 26, 2022 at 2:13:29 PM UTC+2, feen wrote:

> I am familiar with symbolic computation programs, but that isn't what I am looking for. The whole program (excluding the user interface) is more than 20,000 lines of code. (Note for non-US readers: The US income tax system is very complicated compared to European ones, and it changes every year in every state. Sometimes it is just a parameter value that changes, but new provisions are common and old ones expire with regularity). Converting it all to Macsyma would be a chore. The documentation for ADIFOR is very clear, so I am still hoping to get it running.

> Daniel Feenberg

So you have been able to find it? I failed to do so.

Regards,

Arjen

Re: Automatic Differentiation

<UzT9K.880052$aT3.636348@fx09.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2185&group=comp.lang.fortran#2185

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0)
Gecko/20100101 Thunderbird/91.8.1
Subject: Re: Automatic Differentiation
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de>
<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
<d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
<ZlDbRng+vmcK7PX0B@bongo-ra.co>
<fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 25
Message-ID: <UzT9K.880052$aT3.636348@fx09.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Tue, 26 Apr 2022 09:45:07 -0500
X-Received-Bytes: 2706
 by: Ron Shepard - Tue, 26 Apr 2022 14:45 UTC

On 4/26/22 8:18 AM, Arjen Markus wrote:
> On Tuesday, April 26, 2022 at 2:35:39 PM UTC+2, Spiros Bousbouras wrote:
>
>> Actually the derivative is not defined for x = 0.1 , foo is not even
>> continuous for x = 0.1
>
> The function is continuous and differentiable on intervals not include x = 0.1. And that is exactly how it can be treated. Mind you, you do get results that are geared to precisely the surroundings of the input So, with discontinuous or non-smooth functions, you may need to consider different régimes.

The left derivative is defined at x=0.1, but the right derivative is
not. And the function is discontinuous there. This is a common situation
with physical simulations, for example at phase transitions where some
physical properties are discontinuous as a function of say, temperature
or pressure. If you look at a complicated phase diagram of, say water,
with several solid phases, a liquid phase, a gas phase, and a
supercritical region, then you will see many such boundaries along
trajectories in (T,P) phase space.

This situation also occurs artificially when, for example, different
algorithms are used to evaluate a function in its domain. The
mathematical function may not have any boundary regions, but the
piecewise approximations might have them. In practice, even common
functions, e.g. trig functions such as sin(x), cos(x), etc., are often
evaluated in this piecewise way.

$.02 -Ron Shepard

Re: Automatic Differentiation

<6482ce94-e2c7-4a04-96c9-3a3c329d28c6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2186&group=comp.lang.fortran#2186

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:4113:b0:69f:10ee:bd3d with SMTP id j19-20020a05620a411300b0069f10eebd3dmr13448772qko.631.1650989902372;
Tue, 26 Apr 2022 09:18:22 -0700 (PDT)
X-Received: by 2002:a25:d0d4:0:b0:646:f932:5d0f with SMTP id
h203-20020a25d0d4000000b00646f9325d0fmr16454266ybg.456.1650989902157; Tue, 26
Apr 2022 09:18:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 09:18:21 -0700 (PDT)
In-Reply-To: <UzT9K.880052$aT3.636348@fx09.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:e4f7:e24:f7be:caff;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:e4f7:e24:f7be:caff
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de> <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
<ZlDbRng+vmcK7PX0B@bongo-ra.co> <fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>
<UzT9K.880052$aT3.636348@fx09.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6482ce94-e2c7-4a04-96c9-3a3c329d28c6n@googlegroups.com>
Subject: Re: Automatic Differentiation
From: gah4@u.washington.edu (gah4)
Injection-Date: Tue, 26 Apr 2022 16:18:22 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: gah4 - Tue, 26 Apr 2022 16:18 UTC

On Tuesday, April 26, 2022 at 7:45:12 AM UTC-7, Ron Shepard wrote:

(snip on discontinuous derivatives)

> This situation also occurs artificially when, for example, different
> algorithms are used to evaluate a function in its domain. The
> mathematical function may not have any boundary regions, but the
> piecewise approximations might have them. In practice, even common
> functions, e.g. trig functions such as sin(x), cos(x), etc., are often
> evaluated in this piecewise way.

They are. And presumably this would show up in doing numerical
derivatives using those functions, though I don't know that I have
ever seen the problem. Might not be hard to find, though.

Re: Automatic Differentiation

<c2df75bc-ce01-43dd-a735-746898cd63bdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2187&group=comp.lang.fortran#2187

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:1722:b0:69e:e99a:db06 with SMTP id az34-20020a05620a172200b0069ee99adb06mr13788538qkb.534.1650993656423;
Tue, 26 Apr 2022 10:20:56 -0700 (PDT)
X-Received: by 2002:a81:7993:0:b0:2f1:b7f4:efc4 with SMTP id
u141-20020a817993000000b002f1b7f4efc4mr21799625ywc.459.1650993656198; Tue, 26
Apr 2022 10:20:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Tue, 26 Apr 2022 10:20:55 -0700 (PDT)
In-Reply-To: <3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:e4f7:e24:f7be:caff;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:e4f7:e24:f7be:caff
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de> <3a94d777-9323-45c9-bdf3-4c49e67b15afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c2df75bc-ce01-43dd-a735-746898cd63bdn@googlegroups.com>
Subject: Re: Automatic Differentiation
From: gah4@u.washington.edu (gah4)
Injection-Date: Tue, 26 Apr 2022 17:20:56 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 63
 by: gah4 - Tue, 26 Apr 2022 17:20 UTC

On Tuesday, April 26, 2022 at 5:13:29 AM UTC-7, feen...@gmail.com wrote:

(snip)

> The AD program is another program, and when it executes the value of x would
> be a known constant. In my application dfoo/dx would be plus or minus one,
> depending on the value of x.

Reading this one:

https://en.wikipedia.org/wiki/PROSE_modeling_language

reminded me of the difference between symbolic derivatives and
AD (automatic derivatives). For AD, with each mathematical operation,
and for that matter, statement, you compute the value and its derivatives.
You then propagate them with the chain rule, and other calculus rules,
step by step. Each step uses the values from the previous step.

I suspect in many cases, it will result in less redundant calculations
that you would get from the whole symbolic derivative.

If you want to (and I don't know why you would)

compute y=sin(sin(sin(x)))
and also dy/dx

then with my nearby TI-92 you get:

y=sin(sin(sin(x)))
dydx = cos(x) * cos(sin(x)) * cos(sin(sin(x)))

If instead you expand, in the way that AD might do it:

v=sin(x)
w=sin(v)
y=sin(w)

then:
v=sin(x)
dvdx = cos(x)

w=sin(v)
dwdx = cos(v) * dvdx

y=sin(w)
dydx = cos(w) * dwdx

only six function evaluations instead of nine.

Convenient to do internally in an interpreted language,
(or internally in a compiler), a little harder in Fortran source.

> The computer doesn't know about real numbers, but that doesn't bother me.

(snip)

> It does seem that almost all authors of automatic differentiation software assume
> the application is for a Jacobi matrix but that isn't my application.

At some point, the Jacobi matrix is a convenient way to write down
the derivatives. And then after that, the Hessian matrix.

But yes, the Jacobi matrix, and often Hessian matrix, are used in a variety
of optimization algorithms, and so popular in AD systems.

Re: Automatic Differentiation

<t49dvt$r9k$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2188&group=comp.lang.fortran#2188

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!rocksolid2!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Tue, 26 Apr 2022 18:34:37 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t49dvt$r9k$1@newsreader4.netcologne.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de>
<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
<d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
<ZlDbRng+vmcK7PX0B@bongo-ra.co>
<fc7d8325-7689-40b3-b166-260c984b44bdn@googlegroups.com>
<UzT9K.880052$aT3.636348@fx09.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 26 Apr 2022 18:34:37 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-f179-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:f179:0:7285:c2ff:fe6c:992d";
logging-data="27956"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Tue, 26 Apr 2022 18:34 UTC

Ron Shepard <nospam@nowhere.org> schrieb:
> On 4/26/22 8:18 AM, Arjen Markus wrote:
>> On Tuesday, April 26, 2022 at 2:35:39 PM UTC+2, Spiros Bousbouras wrote:
>>
>>> Actually the derivative is not defined for x = 0.1 , foo is not even
>>> continuous for x = 0.1
>>
>> The function is continuous and differentiable on intervals not include x = 0.1. And that is exactly how it can be treated. Mind you, you do get results that are geared to precisely the surroundings of the input So, with discontinuous or non-smooth functions, you may need to consider different régimes.
>
> The left derivative is defined at x=0.1, but the right derivative is
> not. And the function is discontinuous there.

And, of course, 0.1 is not even exactly representable in your
typical binary floating-point type (which is why I chose it that
way).

The question is: What should automatic differentiation do
with this sort of thing?

>This is a common situation
> with physical simulations, for example at phase transitions where some
> physical properties are discontinuous as a function of say, temperature
> or pressure. If you look at a complicated phase diagram of, say water,
> with several solid phases, a liquid phase, a gas phase, and a
> supercritical region, then you will see many such boundaries along
> trajectories in (T,P) phase space.

Agreed. There is a reason for using, for example, enthalpy
and entropy as variables.

> This situation also occurs artificially when, for example, different
> algorithms are used to evaluate a function in its domain. The
> mathematical function may not have any boundary regions, but the
> piecewise approximations might have them. In practice, even common
> functions, e.g. trig functions such as sin(x), cos(x), etc., are often
> evaluated in this piecewise way.

Getting this right is _very_ hard indeed.

Re: Automatic Differentiation

<t49kdg$1la3$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2189&group=comp.lang.fortran#2189

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!ogIE0hSHQIL0E19QjZSNfQ.user.46.165.242.75.POSTED!not-for-mail
From: gay@sfu.ca (Ian Gay)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Tue, 26 Apr 2022 13:24:16 -0700
Organization: SFU
Lines: 63
Message-ID: <t49kdg$1la3$1@gioia.aioe.org>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com> <t46vde$8sm$1@newsreader4.netcologne.de> <d0830982-4564-4144-8b4f-5d9902721933n@googlegroups.com>
Reply-To: gay@sfuu.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Injection-Info: gioia.aioe.org; logging-data="54595"; posting-host="ogIE0hSHQIL0E19QjZSNfQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: KNode/0.10.9
X-Notice: Filtered by postfilter v. 0.9.2
 by: Ian Gay - Tue, 26 Apr 2022 20:24 UTC

gah4 wrote:

> On Monday, April 25, 2022 at 1:13:37 PM UTC-7, Thomas Koenig wrote:
>> gah4 <ga...@u.washington.edu> schrieb:
>
> (snip)
>
>> > You might have a Fortran function with loops and IFs and all, and
>> > desire a similar function returning the derivative of that one.
>> > A program (or you) could go through statement by statement,
>> > adding after each statement, a statement to evaluate the
>> > derivative of that one. Later statements will likely need both
>> > the value of variables, and also (from the product rule and
>> > chain rule) the derivative.
>
>> With IFs, it is really hard - what should the derivative of
>
>> if (x > 0.1) then
>> foo = 1+x
>> else
>> foo = -1-x
>> end if
>
> What it should do is easy, but what you do with the result, is where
> it gets harder:
>
> if (x > 0.1) then
> foo = 1+x
> dfoodx = 1
> else
> foo = -1-x
> dfoodx = -1
> end if
>
>> Also, you usually want many derivatives for a filling a Jacobi
>> matrix, which should be well-behaved, and your function should at
>> least be continuous, or you will get into hot water with whatever
>> you plan to do with that matrix.
>
> It does help to have a good understanding of the problem you are
> working in, and especially where things can go wrong.
>
> But usually the problem is more general, and so outside the derivative
> problem.
>
> I do remember doing much non-linear least-squares fitting, with the
> usual
> Newton's method solver. You might have a function that can only be
> evaluated for positive values, but it tries for negative values
> anyway.

In this case, use ln(x) as your variable instead of x.

>
> Now, if it is using sqrt, the function value and its derivative will
> have problems when it goes negative.
>
> I do remember, though hand computing some derivatives to put
> into least-squares fitting programs. Automating might have
> been nice to have.

--
*********** To reply by e-mail, make w single in address **************

Re: Automatic Differentiation

<X_XaK.380715$f2a5.216995@fx48.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2197&group=comp.lang.fortran#2197

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx48.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.1
Subject: Re: Automatic Differentiation
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
From: lkrupp@invalid.pssw.com.invalid (Louis Krupp)
In-Reply-To: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 15
Message-ID: <X_XaK.380715$f2a5.216995@fx48.iad>
X-Complaints-To: abuse(at)newshosting.com
NNTP-Posting-Date: Fri, 29 Apr 2022 20:36:07 UTC
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Fri, 29 Apr 2022 14:36:07 -0600
X-Received-Bytes: 2326
 by: Louis Krupp - Fri, 29 Apr 2022 20:36 UTC

On 4/25/2022 6:05 AM, Daniel Feenberg wrote:
> There are a number of hits to "fortran automatic differentiation" but the only one that claims to be available without cost is ADIFOR, from the Argonne Laboratory. On various web pages I have found 5 email addresses and 3 phone numbers. According to the web page, potential users should write to one of the addresses for access to the program itself.
>
> I have writen to Paul Hovland (hovland@mcs.anl.gov) and Alan Carle (carle@rice.edu) but I have received no response from either. Another page at ANL (https://www.anl.gov/partnerships/adifor-automatic-differentiation-of-fortran-77 ) gives the 2 phone numbers but neither is in service. A webpage at Rice University (http://www.crpc.rice.edu/newsletters/sum95/news.adifor.html ) adds another email address (bischof@mcs.anl.gov ), also no response there. These pages are 30 years old, so no real surprise. partners@anl.gov did respond and was referred to the same web page that proved uninformative above.
>
> It seems like a very well documented and useful program. It seems a shame for it to die. I do have a large F77 program so I do expect it would be useful for me.
>
> Daniel Feenberg
> National Bureau of Economic Research
> Cambridge MA 02138

You've probably tried this, but the ANL partnerships page also mentions
adifor@mcs.anl.gov in what looks like a screwed-up link.

Louis

Re: Automatic Differentiation

<derivative-20220504181241@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2202&group=comp.lang.fortran#2202

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: 4 May 2022 17:15:23 GMT
Organization: Stefan Ram
Lines: 39
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <derivative-20220504181241@ram.dialup.fu-berlin.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com> <t46vde$8sm$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de FBa0uOPRlNMR0vVxzNGbbANhAFeV3JigHb24IzCqnU4ias
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 4 May 2022 17:15 UTC

Thomas Koenig <tkoenig@netcologne.de> writes:
>With IFs, it is really hard - what should the derivative of
> if (x > 0.1) then
> foo = 1+x
> else
> foo = -1-x
> end if
>be?

There is /numeric/ and /symbolic/ differentiation.

Numerically, one can easily get an approximation for anything
as a difference quotient for a small difference, but needs
to take care, because some results might not be correct
(when the function changes too fast or is not differentiable
at that point).

Symbolically, one can also differentiate anything by taking
the steps a mathematician would take for manual symbolic
differentiation. Since FORTRAN was designed for numerical
mathematics, writing symbolic differentiation in FORTRAN
might be a tad more difficult than in a language like LISP
that was made for list processing. What is more difficult
actually is /simplifying/ the raw result of the symbolic
differentiation to some reasonable and human-readable
expression (in the case of large and complex expressions).

Now, to your question: My first idea would be

if (x > 0.1) then
result = 1
else
result = -1
end if

as a first coarse approximation. (Some thoughts about
the behavior at exactly x=0.1 might have to be added.)

Re: Automatic Differentiation

<t4ud3s$1f3$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2203&group=comp.lang.fortran#2203

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-f207-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Date: Wed, 4 May 2022 17:28:28 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t4ud3s$1f3$1@newsreader4.netcologne.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com>
<t46iir$uun$2@newsreader4.netcologne.de>
<ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com>
<t46vde$8sm$1@newsreader4.netcologne.de>
<derivative-20220504181241@ram.dialup.fu-berlin.de>
Injection-Date: Wed, 4 May 2022 17:28:28 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-f207-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:f207:0:7285:c2ff:fe6c:992d";
logging-data="1507"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Wed, 4 May 2022 17:28 UTC

Stefan Ram <ram@zedat.fu-berlin.de> schrieb:
> Thomas Koenig <tkoenig@netcologne.de> writes:
>>With IFs, it is really hard - what should the derivative of
>> if (x > 0.1) then
>> foo = 1+x
>> else
>> foo = -1-x
>> end if
>>be?
>
> There is /numeric/ and /symbolic/ differentiation.
>
> Numerically, one can easily get an approximation for anything
> as a difference quotient for a small difference, but needs
> to take care, because some results might not be correct
> (when the function changes too fast or is not differentiable
> at that point).
>
> Symbolically, one can also differentiate anything by taking
> the steps a mathematician would take for manual symbolic
> differentiation. Since FORTRAN was designed for numerical
> mathematics, writing symbolic differentiation in FORTRAN
> might be a tad more difficult than in a language like LISP
> that was made for list processing. What is more difficult
> actually is /simplifying/ the raw result of the symbolic
> differentiation to some reasonable and human-readable
> expression (in the case of large and complex expressions).
>
> Now, to your question: My first idea would be
>
> if (x > 0.1) then
> result = 1
> else
> result = -1
> end if
>
> as a first coarse approximation. (Some thoughts about
> the behavior at exactly x=0.1 might have to be added.)

There is no "exactly x=0.1" in binary floating point (and I'm not
sure that even a single Fortran compiler supports decimal floating
point, despite radix being present in selected_real_kind), which
is why I chose that particular number, to add a bit of difficulty.

However, when you differentiate, there are usually certain
assumptions, which are violated in this case - people sort of expect
that integrating what you differentiated gets the same result
(plus a constant). Since there is no way to specify the Dirac
delta function (ok, so it's a distribution) in floating point,
that's not given.

Or people my want to use it for something useful like evaluating
sensitivies, or for root-finding, or... all of that is likely
to fall down in the face of discontinuity.

Re: Automatic Differentiation

<distribution-20220504193659@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2204&group=comp.lang.fortran#2204

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Supersedes: <distribution-20220504185458@ram.dialup.fu-berlin.de>
Date: 4 May 2022 18:38:50 GMT
Organization: Stefan Ram
Lines: 22
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <distribution-20220504193659@ram.dialup.fu-berlin.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com> <t46vde$8sm$1@newsreader4.netcologne.de> <derivative-20220504181241@ram.dialup.fu-berlin.de> <t4ud3s$1f3$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de YOkdUhbV+L+pxmGe8EzU5Qx12nUFgnPTiQnodluk4Recun
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 4 May 2022 18:38 UTC

Supersedes: <distribution-20220504185458@ram.dialup.fu-berlin.de>
[to use a more common notation]

Thomas Koenig <tkoenig@netcologne.de> writes:
> Since there is no way to specify the Dirac
>delta function (ok, so it's a distribution) in floating point,
>that's not given.

As far as I understand it, what is a distribution is the
mapping from f to f(0)=

S_0^oo f(x) delta(x) dx,

while "delta" in isolaton still just is a symbol.

With more Unicode symbols: the mapping from f to f(0)

∫₀°° f(x) δ(x) dx,

is a distribution, while "δ" alone still is just a symbol.

Re: Automatic Differentiation

<integration-20220504200045@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2205&group=comp.lang.fortran#2205

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.fortran
Subject: Re: Automatic Differentiation
Supersedes: <differentiation-20220504183830@ram.dialup.fu-berlin.de>
Date: 4 May 2022 19:05:41 GMT
Organization: Stefan Ram
Lines: 48
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <integration-20220504200045@ram.dialup.fu-berlin.de>
References: <18d0a177-dfda-40ba-aeea-e4f83f6d5876n@googlegroups.com> <t46iir$uun$2@newsreader4.netcologne.de> <ba27b0bb-2883-4b1b-9884-b65d8551fb1dn@googlegroups.com> <t46vde$8sm$1@newsreader4.netcologne.de> <derivative-20220504181241@ram.dialup.fu-berlin.de> <t4ud3s$1f3$1@newsreader4.netcologne.de> <differentiation-20220504183830@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 8OmChXbY5RKFPOqH+T2e0gGOSnqb67RKBHPktY0qeWnLXQ
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 4 May 2022 19:05 UTC

Supersedes: <differentiation-20220504183830@ram.dialup.fu-berlin.de>
[correcting the integral via "PS" below]

Thomas Koenig <tkoenig@netcologne.de> writes:
>Stefan Ram <ram@zedat.fu-berlin.de> schrieb:
>>Now, to your question: My first idea would be
>>if (x > 0.1) then
>> result = 1
>>else
>> result = -1
>>end if
>> as a first coarse approximation. (Some thoughts about
>> the behavior at exactly x=0.1 might have to be added.)
>However, when you differentiate, there are usually certain
>assumptions, which are violated in this case - people sort of expect
>that integrating what you differentiated gets the same result
>(plus a constant). Since there is no way to specify the Dirac
>delta function (ok, so it's a distribution) in floating point,
>that's not given.

I since have cancelled my post, because I only learned about
the meaning of "automatic differentiation" after writing it.

Given

1 if x > 0.1
x =
-1 , otherwise.

, what would be the integral? I think it would be

x+C0 if x > 0.1
x =
-x+C1 , otherwise.

If one has the additional information that the integral
is continuous, then one could conclude that C1 = 0.2 + C0.

PS: Using the usual definition of "integration" as the
"surface under the curve", one would indeed assume
continuity and, therefore, C1 = 0.2 + C0.

My above integral with two different constants C1 and C0
would be more adequate for a definition of "integration" as
a task to find out which piecewise continuous functions
could have a given function as their derivative.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor