JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
140 stars 26 forks source link

Including ellipses in expressions #1079

Open bmaclach opened 5 years ago

bmaclach commented 5 years ago

In the derivation of IM1 for SSP, there are some equations that contain ellipses, like the ones shown below:

image

I was unable to find a way to include an ellipsis in an Expr in Drasil. There are also some cases where there is an ellipsis between equations, like below:

image

That one can be faked with a Sentence, but we may want to express that as an Expr as well.

smiths commented 5 years ago

This is also a deep problem (like #1080). We only need it currently for the derivation, so we might choose to "fake it" for now. Although, I am not sure how to fake it for the first example above. The second one is an acceptable hack for now, but the first one appears incorrect in the generated documentation.

bmaclach commented 5 years ago

@smiths Right, I had no way to fake the first case. I simply left the ellipses out with a note to add them later.

JacquesCarette commented 5 years ago

The semantics of ellipsis is quite complex (though there are papers out there that try). I'd rather not go there.

Luckily, in both cases, there is a formula that expresses what's going on. The first is a fold. The second is vector recurrence relation. That is the way the semantics should be encoded.

Then we could add some display primitives to the backed of Drasil that allows us to choose an 'exploded' view of certain concepts, so as to recover the above display, if one so wishes.

balacij commented 1 year ago

The ellipses in the first picture confuse me. It looks like it's the same as the second picture (just shown differently). The second one looks like it could be written with a single piecewise function (?).

JacquesCarette commented 1 year ago

The first ... abstracts over repeated application of $\Phi_i$ for i from n-4 to 2. The second ... basically abstracts over a whole bunch of closing ) !!!

But as I said above: we should use a proper mathematical encoding of this, and then have some display options that let us give an "exploded" view of certain indexed definitions.

smiths commented 1 year ago

@balacij you can see the derivation of the equation with the ellipses from SSP for IM:fctSfty. There is a recursive relation where a variable with subscript n is defined in terms of the same variable, but with subscript n-1. The relevant part for the first ellipse appears at the bottom of the first derivation.

I really like Jacques's idea of capturing the recurrence relation mathematically and then generating a view that is easy for the readers of the documents.