text:
Discrete logic design

I have been tasked with building a simple alarm device. It just needs to measure a few inputs and the outputs will respond accordingly (to put it very simply!). To me, it seemed that using a few discrete logic gates would get the job done, but a colleague (who was working on it with me) decided that we should use programmable logic instead. His case won, because firstly, he is more senior than me, and secondly, his main argument was that programmable devices are the future and we want to make future proof products.

My question is if you have a design which could be easily implemented by a few discrete logic gates, is it worth designing with discrete logic any more? IS there any advantage to using them over programmable? Or is it slowly going to be phased out completely by programmable logic? To be clear, I don't want answers of 'I believe this is the case' or 'personally I think this but...' I'd like to know if there are any actual advantages to designing with discrete over programmable and is it worth designing with them these days in consumer electronics products?

• This sounds like a question from the 90s... µC have won, its just so much easier to whack one in and be done than to think about how to connect half a dozen ICs together, let alone the space consumption. – PlasmaHH Apr 6 '18 at 8:01
• Discrete gates have one big advantage. No toolchain. – jonk Apr 6 '18 at 8:03
• No toolchain? What do you mean @jonk – Curious Apr 6 '18 at 8:27
• @PlasmaHH so basically you're saying there is no advantage to designing discrete in the future? – Curious Apr 6 '18 at 8:28
• What @jonk means is, when a microcontroller is used, you need software to create the program for the microcontroller, like an IDE (graphical or textual user interface) and compiler/linker/other tools combination dedicated for the microcontroller you use, called a tool chain. – Michel Keijzers Apr 6 '18 at 8:35

Discrete logic design won't be fully phased out. There will always be applications where using a discrete logic IC is preferable. As has been pointed out, speed is a big advantage, although in a lot of applications, the speed difference is just not that important.

When it comes to the design phase, if you design a circuit that only needs to perform 2 or 3 simple logic functions at different points in the circuit, it will be better to use discrete gates, just to save design time on having to also write the program too.

For systems that need to do more complex logic functions, it would be silly to spend all the time working out a truth table, then figuring out which logic gates go where etc when you could just write a small program. Usually, the more inputs mean the more gates required and the longer it takes to design in discrete.

The place where discrete logic really has the advantage though is in learning. When you are first learning about logic design and how gates work etc, that is where getting hands on with actual logic gates and designing different functions with discrete parts is great. Always a good idea to get an understanding of fundamentals. So, because of that, discrete logic is always going to have a place in this world. As for consumer electronics? The future is definitely programmable.

• Simple answer, good points and answers all the questions asked! Thanks! – Curious Apr 6 '18 at 11:57
• As programmer with an electronics background I would like to state that if you do not work out your truth table, you will spend as much time debugging your program as you will need time to set up your truth table. Your truth table will be nice documentation for your program. – chthon Apr 6 '18 at 14:28
• Yeah, I do agree, truth tables are always useful to have, I'll edit the answer to make it a bit more relevant to this scenario – MCG Apr 6 '18 at 14:30
• The last design I implemented using discrete logic had a timing requirement of "as low as possible" using 5V logic and a comparatively simple program requirement. I could spend a ton of money on a nice shiny FPGAs or just do it the "old school" way. Military spec chips undergo the full voltage swing in picoseconds, will survive the nuclear apocalypse along with the cockroaches, and also happen to cost almost nothing. There will always be a place for discrete logic. – Landak Apr 7 '18 at 14:37

I'm not a professional electronics engineer at all (actually just a beginner), but my few cents are that dedicated discrete logic ICs should only be used if timing is important or if it is a requirement not to use programmable logic.

With a microcontroller you can implement much more complicated logic and it is more flexible. Also it can be reprogrammed without having to change the hardware.

Also when very fast timings are needed that software cannot keep up with, dedicated logic ICs could be used. But for an alarm system this seems unneeded (it does not need a response time of nanoseconds).

                          Discrete logic (ICs)      Programmable logic/
(Microcontrollers)
Nanosecond speed                  x                         -
Just a few 'operators' needed     x                         -
No tool chain needed              x                         -
Cost Efficiency *                 -                         x
PCB / proto size                  -                         x
Flexibility for changing          -                         x
Production cost                   -                         x
Possibility to extend features    -                         x

* Assuming more than a few (different) logic functions needed

• So speed is the main advantage in your opinion? +1 for the answer, I especially like your table! – Curious Apr 6 '18 at 8:29
• Yes, hardware is faster than software, so if you REALLY need the speed, you need hardware ICs, otherwise I would go for 'software' (microcontroller) solutions. Btw, nowadays for more complicated speed sensitive solutions FPGAs are used. – Michel Keijzers Apr 6 '18 at 8:32
• I wasn't planning on using an FPGA, the head engineer has already decided the hardware now! I was just asking the question out of curiosity to see where any advantage lies. By the way, I will be accepting your answer in time if no other answers come up. Just want to give others a chance to answer before accepting prematurely! – Curious Apr 6 '18 at 8:53
• I think your head engineer made the right decisions. An alarm system is typically something that will be extended (getting more inputs from mutliple sources and act on it), even making combinations of them, and later add functionality like sending an automatic SMS, signalling a beeper/alarm signal, maybe some logging of sensors etc. – Michel Keijzers Apr 6 '18 at 8:55
• @MichelKeijzers modern FPGAs are significantly faster than anything that you could accomplish with traditional discrete logic ICs. – Tustique Apr 7 '18 at 0:39

If you're going to create a commercial product, you really shouldn't choose a design because "it's programmable" or because a more senior colleague proposed it. Instead you should estimate risks and costs associated with each design, and pick the one with the lowest cost and acceptable risk level. For a start:

• price of individual components adds to the cost
• required PCB size and complexity adds to the cost
• required design effort and tools adds to the cost
• required testing and certification adds to the cost

• lack of flexibility (e.g. changes in discrete logic requiring a new PCB) is a risk
• lack of experience with a particular technology in your team is a risk
• inability to meet project requirements (e.g. target power consumption) is a risk

If sourcing discrete logic ICs for your particular project is cheaper, your team has experience with such design and you consider the lack of flexibility is not critical, there is no reason not to use discrete logic.

• Very true. So you think there is a future for discrete logic then? – Curious Apr 6 '18 at 11:57
• @Curious I still see individual BJTs and MOSFETs being used to implement basic logic functions here and there. Discrete logic is a useful abstraction for some simple tasks, so I'm convinced it will not disappear completely. – Dmitry Grigoryev Apr 6 '18 at 12:07

One aspect the other answers are forgetting is safety. Discrete logic circuits are way more reliable than much more complex microcontroller designs. I helped building a hydrogen prototype car, all the safety-circuits were designed using discrete logic. Safety and reliability is an aspect you'd might want to consider designing an alarmsystem.

• This is not generally true. One could build a horrendously unsafe discrete system and an incredibly safe and robust system on a processor. Your team didn't have the skills to use a processor, but this does not make it inherently unsafe. You can have massive duplication in a processor, which would be impractical in a discrete system. – awjlogan Apr 6 '18 at 11:26
• @awjlogan You can do both of those things, but your discrete logic emergency stop is never going to fail to activate because an unexpected condition sent another part of it into an infinite loop. Safety-critical systems must be as simple as possible. – immibis Apr 6 '18 at 11:27
• @immibis That's bad design and spec, not inherent to a processor. There is always a possibility of failure in a system, discrete, FPGA, or whatever. Agreed that fail safes should be as simple as possible, that doesn't mean they need to be discrete. – awjlogan Apr 6 '18 at 11:30
• @immibis Discrete logic becomes less reliable than MCUs past a certain design size due to soldering defects alone. And if discrete logic includes triggers, you end up having exactly the same problem with forbidden system states as you do in software. – Dmitry Grigoryev Apr 6 '18 at 11:51
• Discrete parts might act more predictable IN case of a fault... – rackandboneman Apr 6 '18 at 12:28

I have to admit, whenever I have to do some complex combinatorial logic plus some timers, I don't bother with discrete logic at all but always code a minimal assembler program for an ATtiny (use a PIC if you like those better).

The combinatorial logic is at maximum 20 lines of assembler (several lookup tables). Each software timer adds another 10 lines. Hardware timers even less. You even gain advantage of having an A/D converter, Comparator, PWM generation on board, should you need those.

The only disadvantage is you had to flash this part. Sometimes that's a show-stopper, but it's seldom the case. The big advantage is you need much less space on the board, routing is much simpler, and you can easily change the logic functions if required.

The remaining use-case for separate logic ICs is when things have to work quicker than 1µs.

• A little off topic, but the ATTiny x17/x16 parts have two built in 3-input LUTs. Very handy indeed! – awjlogan Apr 6 '18 at 12:18

In the end product - probably not many advantages to discrete logic if we are talking a consumer device. Exceptions would be something that needs to be very rugged against adverse conditions, or very easy to completely characterize (the actual complexity and potential for hidden bugs is much higher with something firmware based), or that you want to be able to build again from very similar parts for decades to come (74xx footprints change very very slowly even if the technology letters change :) ).

Something that you can actually do better with discretes is self-timing, asynchronous logic (completion of one thing immediately triggers another thing). The legitimacy of such designs is a holy war topic. Do not worry, the synchronous people will want to beat you but you just have to take their clock away, they will be nonsensically waiting forever for it.

When it comes to design methodology, I'd say it depends on the preferred style of the designer - a CPLD device that you could literally rewire live ("let's touch that wire to pins until something clicks in"), in a ratsnest view, and under power from a host PC (with simulated sparks when you touch a wire to a pin, preferrably, just for ambience) would certainly be well liked by people preferring discrete logic :)


text:
## GLAD: Learning Sparse Graph Recovery

25 Sep 2019 (modified: 11 Mar 2020)ICLR 2020 Conference Blind SubmissionReaders: Everyone
• Original Pdf: pdf
• Keywords: Meta learning, automated algorithm design, learning structure recovery, Gaussian graphical models
• TL;DR: A data-driven learning algorithm based on unrolling the Alternating Minimization optimization for sparse graph recovery.
• Abstract: Recovering sparse conditional independence graphs from data is a fundamental problem in machine learning with wide applications. A popular formulation of the problem is an $\ell_1$ regularized maximum likelihood estimation. Many convex optimization algorithms have been designed to solve this formulation to recover the graph structure. Recently, there is a surge of interest to learn algorithms directly based on data, and in this case, learn to map empirical covariance to the sparse precision matrix. However, it is a challenging task in this case, since the symmetric positive definiteness (SPD) and sparsity of the matrix are not easy to enforce in learned algorithms, and a direct mapping from data to precision matrix may contain many parameters. We propose a deep learning architecture, GLAD, which uses an Alternating Minimization (AM) algorithm as our model inductive bias, and learns the model parameters via supervised learning. We show that GLAD learns a very compact and effective model for recovering sparse graphs from data.

format: plain


text:
# Average Score

Time Limit: 2 Seconds

Memory Limit: 65536 KB

## Description

Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis.

After a mid-term exam, Bob was anxious about his grade. He went to the professor asking about the result of the exam. The professor said:

"Hummm... I am giving lessons to two classes. If you were in the other class, the average scores of both classes will increase."

Now, you are given the scores of all students in the two classes, except for the Bob's. Please calculate the possible range of Bob's score. All scores shall be integers within [0, 100].

## Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

The first line contains two integers N (2 <= N <= 50) and M (1 <= M <= 50) indicating the number of students in Bob's class and the number of students in the other class respectively.

The next line contains N - 1 integers A1, A2, .., AN-1 representing the scores of other students in Bob's class.

The last line contains M integers B1, B2, .., BM representing the scores of students in the other class.

## Output

For each test case, output two integers representing the minimal possible score and the maximal possible score of Bob.

It is guaranteed that the solution always exists.

## Sample Input

2
4 3
5 5 5
4 4 3
6 5
5 5 4 5 3
1 3 2 2 1

## Sample Output

4 4
2 4

None

None


text:
# Marpa

Marpa is a modern Earley parser that can parse all common grammars in linear time, and can handle all context free grammars (CFGs). Jeffrey Kegler developed the algorithm, implemented it as the C library libmarpa, and created a convenient Perl5 interface.


text:
# Non-isomorphic line bundles detected by sub-curves?

This seems like it should be easy, but unfortunately I don't see how to do it.

Let $X$ be a variety; I'm happy to assume that $X$ is quasiprojective. If $L_1$ and $L_2$ are two non-isomorphic line bundles on $X$, then can we find a curve $C$ in $X$ such that $L_1$ and $L_2$ restrict to non-isomorphic bundles on $C$? (In other words, is non-isomorphism of line bundles detected by curves?)

I think that for a general hyperplane section $H$ of $X$, the map $Pic(X) \rightarrow Pic(H)$ should be injective for some range of dimensions, which maybe breaks down for surfaces. So this reduces immediately to the case of $\dim X \approx 2$, but then...

• You might look at the answer to the following MO question: mathoverflow.net/questions/233157/…. That question assumes that $X$ is a projective surface. Assuming $X$ is a normal, quasi-projective variety, there is always a normal projective compactification to which both $\mathcal{L}_1$ and $\mathcal{L}_2$ extend as invertible sheaves. – Jason Starr Aug 3 '16 at 18:01

Here is a proof for $\dim X=2$, projective and smooth. We may replace $L_1, L_2$ by $L_1\otimes L_2^{-1}=L$ and thus suffices to prove that if $L$ is not trivial, it is not trivial restricted to some curve. Take $H$ a large hypersurface section. Then $H^1(L-H)$ can be assumed to be zero and so if $L_{|H}$ is trivial,, we can assume that $H^0(L)\neq 0$ and thus $L=D$ for some effective curve and since $L\neq 0$, $D>0$. Now, restricted to $H$, it is clear that this line bundle has positive degree and can not be trivial.
• Just to compare this proof with the proof in that other MO post, here the choice of sufficiently ample divisor $H$ depends, a priori, on $L$. In that other MO post, the goal was to prove that there exists a single ample hyperplane section (after base change to a bigger algebraically closed field, if the ground field is countable) that simultaneously works for all $L$. But that is not what user84144 asked, and Mohan's proof is definitely simpler. – Jason Starr Aug 3 '16 at 18:08


text:
# monthplot

0th

Percentile

##### Plot a Seasonal or other Subseries from a Time Series

These functions plot seasonal (or other) subseries of a time series. For each season (or other category), a time series is plotted.

Keywords
ts, hplot
##### Usage
monthplot(x, ...)
"monthplot"(x, labels = NULL, ylab = choice, choice = "seasonal", ...)
"monthplot"(x, labels = NULL, ylab = choice, choice = "sea", ...)
"monthplot"(x, labels = NULL, times = time(x), phase = cycle(x), ylab = deparse(substitute(x)), ...)
"monthplot"(x, labels = 1L:12L, ylab = deparse(substitute(x)), times = seq_along(x), phase = (times - 1L)%%length(labels) + 1L, base = mean, axes = TRUE, type = c("l", "h"), box = TRUE, add = FALSE, col = par("col"), lty = par("lty"), lwd = par("lwd"), col.base = col, lty.base = lty, lwd.base = lwd, ...)
##### Arguments
x
Time series or related object.
labels
Labels to use for each ‘season’.
ylab
y label.
times
Time of each observation.
phase
Indicator for each ‘season’.
base
Function to use for reference line for subseries.
choice
Which series of an stl or StructTS object?
...
Arguments to be passed to the default method or graphical parameters.
axes
Should axes be drawn (ignored if add = TRUE)?
type
Type of plot. The default is to join the points with lines, and "h" is for histogram-like vertical lines.
box
Should a box be drawn (ignored if add = TRUE?
Should thus just add on an existing plot.
col, lty, lwd
Graphics parameters for the series.
col.base, lty.base, lwd.base
Graphics parameters for the segments used for the reference lines.
##### Details

These functions extract subseries from a time series and plot them all in one frame. The ts, stl, and StructTS methods use the internally recorded frequency and start and finish times to set the scale and the seasons. The default method assumes observations come in groups of 12 (though this can be changed).

If the labels are not given but the phase is given, then the labels default to the unique values of the phase. If both are given, then the phase values are assumed to be indices into the labels array, i.e., they should be in the range from 1 to length(labels).

##### Value

These functions are executed for their side effect of drawing a seasonal subseries plot on the current graphical window.

##### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

ts, stl, StructTS

##### Aliases
• monthplot
• monthplot.default
• monthplot.ts
• monthplot.stl
• monthplot.StructTS
##### Examples
library(stats) require(graphics) ## The CO2 data fit <- stl(log(co2), s.window = 20, t.window = 20) plot(fit) op <- par(mfrow = c(2,2)) monthplot(co2, ylab = "data", cex.axis = 0.8) monthplot(fit, choice = "seasonal", cex.axis = 0.8) monthplot(fit, choice = "trend", cex.axis = 0.8) monthplot(fit, choice = "remainder", type = "h", cex.axis = 0.8) par(op) ## The CO2 data, grouped quarterly quarter <- (cycle(co2) - 1) %/% 3 monthplot(co2, phase = quarter) ## see also JohnsonJohnson
Documentation reproduced from package stats, version 3.2.2, License: Part of R 3.2.2

### Community examples

Looks like there are no examples yet.


text:
## [CS143-PA3] Semantic Analyzer

full file link https://github.com/Aria461863631/cs143/tree/master/PA4

used files

• semant.c: write semantic analysis in semant() function
• semant.h: header file
• cool-tree.h or cool-tree.handcode.h: add additional declarations
• symtab_example.cc: example for using SymbolTable

### Inheritance

start implementing ClassTable for representing the inheritance graph.

requirements

• All class names are globally visible.

• inheritance graph be acyclic

• basic classes
It is an error to inherit from or redefine Int, Str, Bool.
It is an error to redefine the IO class.
A class can make use of the methods in the IO class by inheriting from IO.
• It is also an error if class A inherits from class B but class B is not defined.

### Naming and Scoping

The type environment consists of three parts:

• the name of the current class $C$

• an object environment $O$ is a function of the form $$O(v) = T$$which assigns the type $T$ to object identifier $v$.

• a method environment $M$ it is a function of the form $$M (C, f ) = (T_1 , . . . , T _{n−1} , T _n )$$

• $C$ is a class name (a type), $f$ is a method name, and $t_1 , . . . , t_n$ are types.
• The tuple of types is the signature of the method.
• The interpretation of signatures is that
in class $C$ the method $f$ has formal parameters of types $(t_1 , . . . , t_{n−1} )$—in that order—and a return type $t_n$

using symbol table to represent type environment

install symbol tables

In Cool all attributes have scope local to the class, and all methods have global scope.

first install global method table

then install object table

### Type Checking

implemented in a single traversal over AST

type environment is passed down the tree: from parent to child

types are passed up the tree: from child to parent

method

attribute

### Code Generator Interface

For every expression node, its type field must be set to the Symbol naming the type inferred by your type checker.

static vs dynamic

The dynamic type of an object is the class $C$ that is used in the new C expression that created it

Soundness theorem for Cool type system;

$\forall E, dynamic\_type(E) \le static\_type(E)$

all operations that can be used on an object of type $C$ can also be used on an object of type $C^{‘} \le C$

static-dispatch

if

case

• Case expressions provide runtime type tests on objects.
• First, $e_0$ is evaluated and its dynamic type C noted.
• Next, from among the branches the branch with the least type $T_k$ such that $C ≤ T_k$ is selected. The identifier $x_k$ is bound to the value of $e_0$ and the expression $e_k$ is evaluated.
• The result of the case is the value of $e_k$

let-init

• Typing a multiple let
let $x_1 : T_1 [← e_1 ], x_2 : T_2 [← e_2], . . . , x_n : T_n [← e_n ]$ in $e$
is defined to be the same as typing
let $x_1 : T_1 [← e_1 ]$ in (let_expr…)

new

var

### SELF_TYPE

The type SELF_TYPE is used to refer to the type of the self variable.

Note that the meaning of SELF_TYPE is not fixed, but depends on the class in which it is used.

• $SELF\_TYPE_C$ to refers to an occurrence of SELF_TYPE in the body of C

cannot return self with a concrete type

inheritance rule

Let $T$ and $T^{‘}$ be any types but SELF_TYPE

$SELF\_TYPE_C \le SELF\_TYPE_C$

• In Cool we never compare SELF_TYPE coming from different classes

$SELF\_TYPE_C \le T$ if $C \le T$

• $SELF\_TYPE_C$ can be any subtype of C, including C itself

$T \le SELF\_TYPE_C$ always false

least upper bound rule

lub($SELF\_TYPE_C$, $SELF\_TYPE_C$) = $SELF\_TYPE_C$

lub($SELF\_TYPE_C$,$T$) = lub($C$, $T$)

lub($T$,$SELF\_TYPE_C$) = lub($C$, $T$)

Finally, SELF TYPE may be used in the following places:

• new SELF_TYPE

• the return type of a method

• the declared type of a let variable

• the declared type of an attribute.

• actual arguments of methods ( ≤ declared arguments type )

• type of dispatch expression

No other uses of SELF_TYPE are permitted.

• classname

• static dispatch

• formal parameters

functions


text:
# Two spheres having masses M (sphere 1) and 2M (sphere 2) and radii R and 2R, respectively, are relea

1. Nov 17, 2014

### whatisphys

1. The problem statement, all variables and given/known data

Two spheres having masses M (sphere 1) and 2M (sphere 2) and radii R and 2R, respectively, are released from rest when the distance between their centers is 8R.
How fast will sphere 1 be moving when they collide? Assume that the two spheres interact only with each other. Enter your answer in units of sqrt(GM/R).
How fast will sphere 2 be moving when they collide? Enter your answer in units of sqrt(GM/R)
2. Relevant equations
-Gmm/r
(mv^2)/2
m1v1 + m2v2 = 0 since starts at rest

3. The attempt at a solution

Okay.
So what I did was I first calculated initial PE and Final PE. I then calculated the change in PE which turned out to be -5GM^2/12R
Then, I equated it to deltaKE = -deltaPE which i got as (Mv1^2)/2 + (2Mv2^2)/2 = 5GM/12R.
I used conservation of momentum to find out the ratio of V1 to V2 which was V2 = -1/2(V1)
After that I substituted that to the equation above and solved for V1 as 20GM/36R.
But it says it is wrong. Any help would be appreciated. Thank you

2. Nov 17, 2014

### Simon Bridge

3. Nov 17, 2014

### whatisphys

PEi = GM2M/8R = -GM^2/4R and PEf = GM2M/3R = -2GM^2/3R

delta PE = Final - initial

make them so that they have common base which is -8GM^2/12R + 3GM^2/12R

4. Nov 17, 2014

### Simon Bridge

OK I see ... so for conservaton of energy and momentum respectively you got:

$$v_1^2 + 4v_2^2 = \frac{10}{12}\frac{GM}{R}\\ v_1 + 2v_2 = 0$$ ... after dividing through by M in both equations and multiplying through by 2 in the top one.


text:
### I'm having trouble compiling <project name here>

First, make sure that you can compile that project natively on whatever platform you're attempting to compile it on. Once you are assured of that, search around the internet to see if anyone else has run into issues cross-compiling that project for that platform. In particular, most smaller projects should be just fine, but larger projects (and especially anything that does any kind of bootstrapping) may need some extra smarts smacked into their build system to support cross-compiling. Finally, if you're still stuck, try reaching out for help on the #binarybuilder channel in the JuliaLang slack.

### How do I use this to compile my Julia code?

This package does not compile Julia code; it compiles C/C++/Fortran dependencies. Think about that time you wanted to use IJulia and you needed to download/install libnettle. The purpose of this package is to make generated tarballs that can be downloaded/installed painlessly as possible.

### What is this I hear about the macOS SDK license agreement?

Apple restricts distribution and usage of the macOS SDK, a necessary component to build software for macOS targets. Please read the Apple and Xcode SDK agreement for more information on the restrictions and legal terms you agree to when using the SDK to build software for Apple operating systems. Copyright law is a complex area and you should not take legal advice from FAQs on the internet. This toolkit is designed to primarily run on Linux, though it can of course be used within a virtualized environment on a macOS machine or directly by running Linux Apple hardware. The Docker runner implements the virtualization approach on macOS machines. BinaryBuilder.jl, by default, will not automatically download or use the macOS SDK on non-apple host operating systems, unless the BINARYBUILDER_AUTOMATIC_APPLE environment variable is set to true.

### Are there other environment variables I can use?

Yes, take a look.

Absolutely! There's nothing Julia-specific about the binaries generated by the cross-compilers used by BinaryBuilder.jl. Although the best interface for interacting with this software will always be the Julia interface defined within this package, you are free to use these software tools for other projects as well. Note that the cross-compiler image is built through a multistage bootstrapping process, see this repository for more information. Further note the macOS SDK license agreement tidbit above.

### At line XXX, ABORTED (Operation not permitted)!

Some linux distributions have a bug in their overlayfs implementation that prevents us from mounting overlay filesystems within user namespaces. See this Ubuntu kernel bug report for a description of the situation and how Ubuntu has patched it in their kernels. To work around this, you can launch BinaryBuilder.jl in "privileged container" mode. BinaryBuilder should auto-detect this situation, however if the autodetection is not working or you want to silence the warning, you can set the BINARYBUILDER_RUNNER environment variable to privileged. Unfortunately, this involves running sudo every time you launch into a BinaryBuilder session, but on the other hand, this successfully works around the issue on distributions such as Arch linux.

### Can I publish a JLL package locally without going through Yggdrasil?

You can always build a JLL package on your machine with the --deploy flag to the build_tarballs.jl script. Read the help (--help) for more information.

A common use case is that you want to build a JLL package for, say, Libfoo, that will be used as dependency to build Quxlib, and you want to make sure that building both Libfoo and Quxlib will work before submitting all the pull requests to Yggdrasil. You can prepare the build_tarballs.jl script for Libfoo and then build and deploy it with

julia --color=yes build_tarballs.jl --debug --verbose --deploy="MY_USERNAME/Libfoo_jll.jl"

replacing MY_USERNAME with your GitHub username: this will build the tarballs for all the platforms requested and upload them to a release of the MY_USERNAME/Libfoo_jll.jl, where the JLL package will also be created. As explained above, you can pass argument the list of triplets of the platforms for you which you want to build the tarballs, in case you want to compile only some of them. In the Julia REPL, you can install this package as any unregistered package with

]add https://github.com/MY_USERNAME/Libfoo_jll.jl.git

or develop it with

]dev https://github.com/MY_USERNAME/Libfoo_jll.jl.git

Since this package is unregistered, you have to use the full PackageSpec specification to add it as dependency of the local builder for Quxlib:

    Dependency(PackageSpec(; name = "Libfoo_jll",  uuid = "...", url = "https://github.com/MY_USERNAME/Libfoo_jll.jl.git"))

You can of course in turn build and deply this package with

julia --color=yes build_tarballs.jl --debug --verbose --deploy="MY_USERNAME/Quxlib_jll.jl"

### Can I install packages in the build environment?

Yes, but it's unlikely that you'll need to. The build environment is based on Alpine Linux (triplet: x86_64-linux-musl) so you can use apk to install packages in it. However, if you need runtime libraries or programs for the target system these packages won't help you. The package manager is useful only to install utilities, tools or libraries that are needed exclusively at compile time on the build system.

### What are those numbers in the list of sources? How do I get them?

The list of sources is a vector of BinaryBuilder.AbstractSources. What the hash is depends on what the source is:

• For a FileSource or an ArchiveSource, the hash is a 64-character SHA256 checksum. If you have a copy of that file, you can compute the hash in Julia with

using SHA
open(path_to_the_file, "r") do f
bytes2hex(sha256(f))
end

where path_to_the_file is a string with the path to the file. Alternatively, you can use the command line utilities curl and shasum to compute the hash of a remote file:

\$ curl -L http://example.org/file.tar.gz | shasum -a 256

replacing http://example.org/file.tar.gz with the actual URL of the file you want to download.

• For a GitSource, the hash is the 40-character SHA1 hash of the revision you want to checkout. For reproducibility you must indicate a specific revision, and not a branch or tag name, which are moving targets.


text:
# Why do I always have a grey corner on my plot? [closed]

I have encountered a very wired plotting issue:

I had a script to plot 6 triangles together in one graph as below (first figure). However, as you could see there are always two grey parts in the corner that come from nowhere. When I simply plot these two triangles, they look perfect as in the second & third figure.

Could anybody tell me what mistake I have made? Thanks so much in advance!

Yi

• Clipping. Show a MWE (i.e. code that produces the problem) for more advice. Or look it up in the documentation for Plot and post your own answer. – Michael E2 Aug 18 at 15:04
• Add PlotRange->All to each of your plots, once they are calculated you can't adjust it above what was set. – Kuba Aug 19 at 9:16
• closely related: 14260 – Kuba Aug 19 at 9:16


text:
# How fast will an object with a mass of 24 kg accelerate if a force  30 N is constantly applied to it?

Jun 29, 2018

$a = 1.25$

#### Explanation:

$F = m a$
where F=force in newtons ($N$)
m is mass in kilograms ($k g$)
a is acceleration in metres per second squared ($\frac{m}{s} ^ 2$)

$30 = 24 a$
$a = \frac{30}{24} = \frac{5}{4} = 1.25$

Jun 29, 2018

color(violet)("Acceleration " a = 1.25 m * sec^-2

#### Explanation:

$\text{Force = mass x Acceleration i.e } F = m a$

Given : F = 30 N, m = 24 Kg, a = ?

$a = \frac{30}{24} = 1.25 m \cdot {\sec}^{-} 2$


text:
## Elementary Algebra

Recall that velocity is equal to change in distance over change in time. We call t the time it takes the on the way back. Thus, we obtain: $\frac{40}{t-1} = \frac{42}{t} +4$ We create common denominators and solve for t: $\frac{40t}{t(t-1)} = \frac{42(t-1)}{t(t-1)} + \frac{4t(t-1)}{t(t-1)}$ Since the denominators are the same, we cancel them out and solve. (Recall, t cannot be negative.) $40t = 42t -42 +4t^2 -4t \\ 0 = 4t^2 -2t -42 \\ (2t-7)(t+3) \\ t=3.5$ Thus, on the way back: $v = 42/3.5 = 12$ This means that he was going 16 mph on the way out.


text:
# Volume

Volume file formats, such as OpenVDB, will allow storage of much larger datasets while being optimized for random access to volume data, which is more efficient for rendering. OpenVDB is an open source C++ library comprising a novel hierarchical data structure and a suite of tools for the efficient storage and manipulation of sparse volumetric data discretized on three-dimensional grids.

For information on working with Maya's volumetric fluids, click here.

A tutorial on how to write volumes to OpenVDB from Houdini can be found here.

Volumes can only receive indirect lighting from other emissive volumes when the Volume Ray Depth is above 0.

Arnold Volume. Type: OpenVDB.

Custom AOVs are not currently supported with volumes.

To reduce the amount of noise in a volume, you must ensure that the lights in your scene have enough 'volume samples'.

#### Filename

The location of the VDB file.

Ensure that the IPR is not running when updating the file, otherwise, the bounding box will not display at the correct size in the viewport.

#### Grids

A list of OpenVDB grids to read and make available as channels in the volume shading context. Examples of Grid names are density, fuel, heat, temperature or velocity.

#### Use File Sequence

Reads a sequence of VDB files.

#### Frame

Specifies the frame of the sequence to be rendered.

Keframe set for 'Frame' and hashtag used in 'Filename' when using VDB sequence

#### Automatic Step Size

Sets the minimum voxel size defined in the VDB as the step size.

#### Step Size

Sets the size for sampling inside the volume. It should be small enough to capture the smallest feature in the volume (aka the Nyquist limit). If the size is too large, aliasing, bias or banding will appear. Smaller (and therefore more accurate) sizes will increase render times while larger sizes will render more quickly.

##### Step Scale

A scaling factor applied to the step size, mostly useful when the Volume Step is set to Automatic, to modulate the automatic value. For low frequency, smoke-like volumes, a value of 4 is a reasonable starting point.

Enlarge the volume by Padding. This is useful when displacing a volume with a noise for example. Note that this slack applies not only to the bounding box but also to the voxels used for ray extents inside the bounding box. When velocity motion blur is enabled, some extra padding is computed, based on the maximum value of the velocity field, and the maximum of the velocity padding and user padding is applied. When padding exceeds the bounding box maximum dimension, the ray extents acceleration makes little sense and is disabled, so you should set the padding as tightly as possible.

For best performance, this should be set as low as possible, while still covering the maximum displacement amount.

The amount of padding to add to the volume bounds for displacement

#### Compress

Compress grids to reduce memory usage, enabled by default. This is a lossy compression, however, in most cases renders will be almost the same. If there is a problem, however, this parameter can be used to disable lossy compression.

#### Velocity Grids

Either 1 vector grid (eg. v or vel) or 3 float grids (eg. vel.xvel.yvel.z) representing the velocity field, to be used for motion blur. No motion blur will occur if an invalid combination of grids or if no grids are specified. Note that all velocity grids declared here are also available as channels in the shading context.

#### Velocity Scale

A scale factor for the velocity field. A value of 0 disables motion blur.

#### Velocity FPS

Sets the frames per second velocity value.

#### Motion Start

The time at which the first motion key of the shape is sampled. Other motion keys must be uniformly spaced within this range. Times can be absolute or relative as long as shutter and motion times use the same convention. By convention, the times are frame relative. For example, start and end times -0.5 to 0.5 indicate that two motion keys will be sampled midway between the previous and current frame, and the current frame and next frame. This is applied to cameras, lights, and shapes.

#### Motion End

The time at which the last motion key of the shape is sampled. Other motion keys must be uniformly spaced within this range. Times can be absolute or relative as long as shutter and motion times use the same convention. By convention, the times are frame relative. For example, start and end times -0.5 to 0.5 indicate that two motion keys will be sampled midway between the previous and current frame, and the current frame and next frame. This is applied to cameras, lights, and shapes.

#### Velocity Threshold

Controls filtering of noisy velocities resulting in the faster rendering of motion blur from physics simulations. The default value of 0.001 should have little to no visual impact. Setting it to zero disables filtering entirely.

If you need to further edit the result of the reading of a channel, for instance, to color correct it, there are the Volume Sample RGB and Volume Sample Float shaders.

## Type

#### Implicit

Volume implicit nodes can be used to load OpenVDB files for rendering volumes and implicit surfaces respectively.

Implicit type volume .vdb file

#### Solver

The uniform solver may be used for arbitrary fields. It works by taking small steps through the field to find the surface. This makes it relatively slow, but suitable for arbitrary fields generated by a procedural texture shader for example. When the field is a level set, for example from a level set grid in a VDB file, the levelset solver may be used instead for better performance and quality. Level sets guide the solver towards the surface, to converge quickly with few steps.

#### Threshold

The surface is defined where the field value equals the threshold. The surface is defined by the implicit equation: $field(x) = threshold$

#### Samples

The number of samples used to find intersection points. Increase this value to avoid artifacts such as holes.

#### Field Channel

Volume channel used as the field to define the implicit surface.

#### Field

Shader to generate the scalar field used to define the implicit surface.

#### Reducing Noise

To reduce the amount of noise in a volume, you must ensure that any lights in your scene have sufficient 'volume samples', or alternatively that you have enough AA samples.

#### Volumes and Atmosphere Volume

Currently, Atmosphere Volume does not compose well against volumes. This is because atmospheres return a single flat result that is opacity mapped on top of whatever is in the background of the pixel.

Left: floor plane geometry hidden. Right: floor plane geometry visible. Fluid renders incorrectly.

• No labels


text:
## an insufficient puzzle

Posted in Books, Kids, Statistics with tags , , , on January 12, 2022 by xi'an

A rather peculiar and challenging question on X validated,  concerning the absolute impossibility of a conditional expectation, given a non-sufficient statistic, being still a statistic (i.e., being independent on the parameter θ). Inspired from the following except from Hogg and Craig. Namely, could there exist a specific function φ(·) such that E[φ(Y¹)|Y³] does not depend on the parameter θ? I could not find a satisfactory explanation right away (and the question remains unanswered!)

After posting this entry, I thought anew that cases when the unbiased estimator φ(Y¹) is not a bijective transform of Y¹ would work as a counter-example, since Y³=φ(Y¹) is not sufficient but E[φ(Y¹) |φ(Y¹) ]=φ(Y¹) is not involving θ… And this case does not exhibit a paradox in that the variance does not decrease any further.

## A discrete Bernoulli factory

Posted in Books, Kids, Statistics with tags , , , , , , on October 18, 2021 by xi'an

A rather confusing (and now closed) question on X validated contained an interesting challenge of simulating an arbitrary discrete distribution using a single (standard) dice. It indeed made me think of the (more challenging) Bernoulli factory problem of simulating B(f(p)) using a B(p) simulator (with p unknown). I still do not see what the optimal solution is but the core challenge is to avoid simulating U(0,1) variate by exploiting the discrete nature of the target. Which may be an issue if the probabilities of the target are irrational and one is considering the cdf inversion approach. An alternative is to use an accept-reject approach, which also works for discrete distributions, by first deriving an instrumental distribution on the discrete support of the target from dice rolls, second finding the maximum of the ratio instrument to target, and third devising a discrete approach to selecting a generation with a probability taking a finite number of values. Which may prove quite costly. Finally, the least debatable approach is to turn the dice into a Uniform generator by using each draw as a digit in the base 5 representation of this Uniform variate, up to the precision desired for the resolution, and then apply the most efficient algorithm for the target distribution.

## ensemble Metropolis-Hastings

Posted in Books, Kids, Statistics with tags , , , , , on October 14, 2021 by xi'an

A question on X validated about ensemble MCMC samplers had me try twice to justify the Metropolis-Hasting ratio the authors used. To recap, ensemble sampling moves a cloud of points (just like our bouncy particle sampler) one point X at a time by using another point Z as a pivot or origin and moving randomly X along the line [XZ]. In the paper,  the distribution of the rescaling is symmetric in the sense that f(z)=f(1/z). I indeed started by perceiving the basic step of the sampler as a Metropolis-within-Gibbs step along a random direction. But it did not work as the direction depends on the current X. I then wondered at a possible importance sampling interpretation compensating for the change of scale, but it was leading to the wrong power anyway. Before hitting the fact that this was actually a change of radius in the space with origin Z, leaving the angular coordinates invariant. Which explained for the power (n-1) in the Metropolis ratio, in agreement with a switch to polar coordinates.

## 1 / duh?!

Posted in Books, R, Statistics, University life with tags , , , , , , , on September 28, 2021 by xi'an

An interesting case on X validated of someone puzzled by the simulation (and variance) of the random variable 1/X when being able to simulate X. And being surprised at the variance of the ratio being way larger than the variances of both numerator and denominator.

## mixed feelings

Posted in Books, Kids, Statistics with tags , , , , on September 9, 2021 by xi'an

Two recent questions on X validated about mixtures:

1. One on the potential negative explosion of the E function in the EM algorithm for a mixture of components with different supports:  “I was hoping to use the EM algorithm to fit a mixture model in which the mixture components can have differing support. I’ve run into a problem during the M step because the expected log-likelihood can be [minus] infinite” Which mistake is based on a confusion between the current parameter estimate and the free parameter to optimise.
2. Another one on the Gibbs sampler apparently failing for a two-component mixture with only the weights unknown, when the components are close to one another:  “The algorithm works fine if $$σ$$ is far from $$1$$ but it does not work anymore for $$σ$$ close to $$1$$.” Which did not see a wide posterior as a possible posterior when both components are similar and hence delicate to distinguish from one another.


text:
As much as I hate Adobe Air some deluded companies think its the best way to make software and I’ve been forced on more than one occasion to deploy it to the whole network, which leads nicely into the big problem… There is no MSI and just as annoying software for it are .air files that it wants to install…

Adobe Air does have a silent install option so its deployment can be scripted, my (& my companies) method of deploying silent exes is to use this script:

The script documents what you need to do but the install line for Adobe Air would be:

Subsitute X & Y in the key for the version you are deploying e.g. 4-0. You will need to use this method to update Air in the future, so specifying the version number saves you having to remove the key later. Obviously drop the -eulaAccepted if you can’t accept it for the end user and want them to do it themselves.

Air provides an installer for apps that you can run silently, but you need to run it after Air has installed (In most cases I only depoy air when it is actually needed so its going out at the same time as an app).

Our script has another install function called Install_After that takes a 4th option. This 4th option is a key to check before running the install, the install will then only procede if that key exists. Taking this into account the install line for an Air app would be:

This ensures that the installer wont be run before Air is installed and can even be used to make sure that a new version of Air is installed before running.

The installed app will not have a shortcut anywhere so you will need to add them manually using your domain.

Thats about it, our script makes deploying stuff via silent exes quite easy and safe. You can use GPP to delete the key files and have the script automatically re-install the software (unless the exe see the target product and ignores the request).

Deploying Adobe Air and Air Apps

This site uses Akismet to reduce spam. Learn how your comment data is processed.


text:
# Equal sized partitions without overlap

Suppose $E$ elements are partitioned into sets of equal size $P$ (e.g. elements 1 through 9 could be partitioned as $\{1,3,7\}\{2,6,9\}\{4,5,8\}$). Clearly $P|E$.

Call two partitions with sets of equal size ‘orthogonal’ (for lack of a better adjective) if no two sets share more than one element. (So $\{1,2,4\}\{3,5,6\}\{7,8,9\}$ is orthogonal to the partition above, while $\{1,2,3\}\{4,5,6\}\{7,8,9\}$ is not since 1 and 3, as well as 4 and 5, are grouped together in both partitions.)

Call a set of partitions, all pairwise orthogonal, ‘complete’ if every two elements appear together exactly one set. For example, if $E=9$ and $P=3$,

$\{1,2,3\}\{4,5,6\}\{7,8,9\}$,

$\{1,4,7\}\{2,5,8\}\{3,6,9\}$,

$\{1,5,9\}\{2,6,7\}\{3,4,8\}$,

$\{1,6,8\}\{2,4,9\}\{3,5,7\}$

is a complete set.

This question has two parts: first, for what values of $E$ and $P$ is there a complete set of orthogonal partitions? With a little bit of thought it is apparent that $(P-1)$ must divide $(E-1)$, but it is not obvious that this is sufficient. ($E=P^2$ always allows a solution, as does $P=2$ with $E\ge 2$. $E=15$, $P=3$ also has a solution, which I eventually found by trial and error.)

Second, if a complete set exists for $E$ and $P$, is there a procedure to find such a set? (I am particularly interested in $E=28$ and $P=4$.)

(Apologies for the invented notation and terminology; I am not a combinatorist.)

-
It seems you mean "no two sets share more than one element"? – joriki Aug 24 '12 at 13:36
This is called the social golfer problem. According to MathWorld this is an unsolved problem, but I'm not sure whether that means that the first part of your question can't be answered. Here are some more links: math.SE, Math Games, and a page by Warwick Harvey. – joriki Aug 24 '12 at 13:52
Actually the Math Games link contains a solution to the $E=28$, $P=4$ instance you're particularly interested in. – joriki Aug 24 '12 at 14:08
joriki- thanks for the links. Yes, I do mean that no two sets share more than one element. – Mark R. Aug 24 '12 at 17:53
@joriki- the articles you mentioned do suggest to me that both questions are generally unsolved. That's disappointing, but the specific solutions that have been found are all I needed (if not all I wanted). Thanks for your help. – Mark R. Aug 24 '12 at 18:29


text:
Problem 61E

61. If $F(x)=f(g(x))$, where $f(-2)=8, f^{\prime}(-2)=4, f^{\prime}(5)=3$, $g(5)=-2$, and $g^{\prime}(5)=6$, find $F^{\prime}(5)$


text:
# Bipartite graphs with alternating edge colorings

I would like to find all graphs or lattices which satisfy the following conditions:

(1) Graph is bipartite with vertex types $$A$$ and $$B$$ ($$A$$-vertices only connected to $$B$$-vertices and vice-versa)

(2) All edges have coloring either $$x$$ or $$y$$, with $$x\neq y$$

(3) Degree at $$A$$-vertices: $$p = p_x + p_y$$, where $$p_x$$ = number of edges at an $$A$$-vertex with coloring $$x$$ and $$p_y$$ = number of edges with coloring $$y$$

(4) Degree at $$B$$-vertices: $$q = q_x + q_y$$, where $$q_x$$ = number of edges at a $$B$$-vertex with coloring $$x$$ and $$q_y$$ = number of edges with coloring $$y$$

(5) Require that $$\displaystyle \frac{p_x}{p_y} > 1$$, and $$\displaystyle \frac{q_x}{q_y} < 1$$

Graph may have finite or infinite number of vertices (finite graphs do not need to satisfy the degree requirement on the boundary vertices, but the number of bulk vertices should be $$\gg1$$)

A special case that can be considered is: $$p = q$$, $$p_x = q_y$$, $$p_y = q_x$$

• Which graphs satisfy conditions (1)–(5)?

From looking at various graphs by hand, the only graph I've found which satisfies these conditions is the Bethe lattice in the infinite case or the Cayley tree in the finite case. Are there others as well?

Some graphs which do not work are the (hyper)cubic lattice, the hexagonal lattice, and the Penrose tiling.

• If the Bethe lattice and Cayley tree are the only graphs which satisfy these conditions, how would one prove that?

New contributor
PartonWavicle is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• I don't understand the "coordination number requirement on the boundary vertices". Can you explain it? – Bullet51 May 14 at 15:41
• "Coordination number" means degree, edited question to correct this. To clarify, it means that the vertices on the boundary of the graph do not need to have the same degree as the vertices in the bulk of the graph. For example, the vertices on the boundary of the Cayley tree only have degree 1, regardless of the degree of the bulk vertices. – PartonWavicle May 14 at 15:54
• I'm confused what you mean by "cycles can be allowed"; trees are acyclic by definition. – PartonWavicle May 14 at 15:56
• How is the boundary defined? What is the boundary of a vertex-transitive cubic graph? – Bullet51 May 14 at 15:57
• It means that there exists non-trees satisfying the conditions. – Bullet51 May 14 at 15:58


text:
# Thread: Properties of 4-Sided figures.

1. ## Properties of 4-Sided figures.

Find angle E.
This is a Parallelogram. NOT a triangle!!!
Its kinda easy but I keep getting confused, so please could anyone tell me how to do this?

2. Hello, ProMathematics!

Find angle e.

This is a Parallelogram. NOT a triangle!!!
. . It is not a pentagon either ... so what's your point?

Code:
            *  *  *  *  *  *  *
*  *              *
*     *           *
*        *        *
*           * 93' *
* 35'        e *  *
*  *  *  *  *  *  *

We're expected to know this fact:
. . Adjacent angles of a parallelogram are supplementary.

Hence: . $35^o + (e + 93^o) \;=\;180^o$

Now solve for e.

3. But, each pair of angles between 2 parallel sides add up to 180''. SO???? This is like <e= 180''-(92+35) = 53''
Is this the way to do it? If yes, YOU ARE MY SAVIOR TODAY!!!!


text:
$$\renewcommand\AA{\unicode{x212B}}$$

# McStas - A neutron ray-trace simulation package¶

## Introduction to McStas¶

The McStas neutron ray-tracing simulation package is a versatile tool for producing accurate simulations of neutron scattering instruments at reactors and pulsed spallation sources. McStas is extensively used for design and optimization of instruments, virtual experiments, and user training. McStas is an abbreviation for Monte Carlo Simulation of triple axis spectrometers, but allows for describing and simulating any type of neutron scattering instrument.


text:
# Otto cycle

Last updated

An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines. [1]

## Contents

The Otto cycle is a description of what happens to a gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The gas that is subjected to those changes is called the system. The system, in this case, is defined to be the fluid (gas) within the cylinder. By describing the changes that take place within the system, it will also describe in inverse, the system's effect on the environment. In the case of the Otto cycle, the effect will be to produce enough net work from the system so as to propel an automobile and its occupants in the environment.

The Otto cycle is constructed from:

Top and bottom of the loop: a pair of quasi-parallel and isentropic processes (frictionless, adiabatic reversible).
Left and right sides of the loop: a pair of parallel isochoric processes (constant volume).

The isentropic process of compression or expansion implies that there will be no inefficiency (loss of mechanical energy), and there be no transfer of heat into or out of the system during that process. The cylinder and piston are assumed to be impermeable to heat during that time. Work is performed on the system during the lower isentropic compression process. Heat flows into the Otto cycle through the left pressurizing process and some of it flows back out through the right depressurizing process. The summation of the work added to the system plus the heat added minus the heat removed yields the net mechanical work generated by the system.

## Processes

The processes are described by: [2] [ page needed ]

• Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
• Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead center (BDC) to top dead center (TDC).
• Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead center. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
• Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
• Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead center.
• Process 1–0 the mass of air is released to the atmosphere in a constant pressure process.

The Otto cycle consists of isentropic compression, heat addition at constant volume, isentropic expansion, and rejection of heat at constant volume. In the case of a four-stroke Otto cycle, technically there are two additional processes: one for the exhaust of waste heat and combustion products at constant pressure (isobaric), and one for the intake of cool oxygen-rich air also at constant pressure; however, these are often omitted in a simplified analysis. Even though those two processes are critical to the functioning of a real engine, wherein the details of heat transfer and combustion chemistry are relevant, for the simplified analysis of the thermodynamic cycle, it is more convenient to assume that all of the waste-heat is removed during a single volume change.

## History

The four-stroke engine was first patented by Alphonse Beau de Rochas in 1861. [3] Before, in about 1854–57, two Italians (Eugenio Barsanti and Felice Matteucci) invented an engine that was rumored to be very similar, but the patent was lost.

The first person to build a working four-stroke engine, a stationary engine using a coal gas-air mixture for fuel (a gas engine), was German engineer Nicolaus Otto. [4] This is why the four-stroke principle today is commonly known as the Otto cycle and four-stroke engines using spark plugs often are called Otto engines.

## Processes

The system is defined to be the mass of air that's drawn from the atmosphere into the cylinder, compressed by the piston, heated by the spark ignition of the added fuel, allowed to expand as it pushes on the piston, and finally exhausted back into the atmosphere. The mass of air is followed as its volume, pressure and temperature change during the various thermodynamic steps. As the piston is capable of moving along the cylinder, the volume of the air changes with its position in the cylinder. The compression and expansion processes induced on the gas by the movement of the piston are idealised as reversible, i.e., no useful work is lost through turbulence or friction and no heat is transferred to or from the gas during those two processes. Energy is added to the air by the combustion of fuel. Useful work is extracted by the expansion of the gas in the cylinder. After the expansion is completed in the cylinder, the remaining heat is extracted and finally the gas is exhausted to the environment. Useful mechanical work is produced during the expansion process and some of that used to compress the air mass of the next cycle. The useful mechanical work produced minus that used for the compression process is the net work gained and that can be used for propulsion or for driving other machines. Alternatively the useful work gained is the difference between the heat added and the heat removed.

### Process 0–1 intake stroke (blue shade)

A mass of air (working fluid) is drawn into the cylinder, from 0 to 1, at atmospheric pressure (constant pressure) through the open intake valve, while the exhaust valve is closed during this process. The intake valve closes at point 1.

### Process 1–2 compression stroke (B on diagrams)

Piston moves from crank end (BDC, bottom dead centre and maximum volume) to cylinder head end (TDC, top dead centre and minimum volume) as the working gas with initial state 1 is compressed isentropically to state point 2, through compression ratio (V1/V2). Mechanically this is the isentropic compression of the air/fuel mixture in the cylinder, also known as the compression stroke. This isentropic process assumes that no mechanical energy is lost due to friction and no heat is transferred to or from the gas, hence the process is reversible. The compression process requires that mechanical work be added to the working gas. Generally the compression ratio is around 9–10:1 (V1:V2) for a typical engine. [5]

### Process 2–3 ignition phase (C on diagrams)

The piston is momentarily at rest at TDC. During this instant, which is known as the ignition phase, the air/fuel mixture remains in a small volume at the top of the compression stroke. Heat is added to the working fluid by the combustion of the injected fuel, with the volume essentially being held constant. The pressure rises and the ratio ${\displaystyle (P_{3}/P_{2})}$ is called the "explosion ratio".

### Process 3–4 expansion stroke (D on diagrams)

The increased high pressure exerts a force on the piston and pushes it towards the BDC. Expansion of working fluid takes place isentropically and work is done by the system on the piston. The volume ratio ${\displaystyle V_{4}/V_{3}}$ is called the "isentropic expansion ratio". (For the Otto cycle is the same as the compression ratio ${\displaystyle V_{1}/V_{2}}$). Mechanically this is the expansion of the hot gaseous mixture in the cylinder known as expansion (power) stroke.

### Process 4–1 idealized heat rejection (A on diagrams)

The piston is momentarily at rest at BDC. The working gas pressure drops instantaneously from point 4 to point 1 during a constant volume process as heat is removed to an idealized external sink that is brought into contact with the cylinder head. In modern internal combustion engines, the heat-sink may be surrounding air (for low powered engines), or a circulating fluid, such as coolant. The gas has returned to state 1.

### Process 1–0 exhaust stroke

The exhaust valve opens at point 1. As the piston moves from "BDC" (point 1) to "TDC" (point 0) with the exhaust valve opened, the gaseous mixture is vented to the atmosphere and the process starts anew.

## Cycle analysis

In the process 1–2 the piston does work on the gas and in process 3–4 the gas does work on the piston during those isentropic compression and expansion processes, respectively. Processes 2–3 and 4–1 are isochoric processes; heat is transferred into the system from 2—3 and out of the system from 4—1 but no work is done on the system or extracted from the system during those processes. No work is done during an isochoric (constant volume) process because addition or removal of work from a system requires the movement of the boundaries of the system; hence, as the cylinder volume does not change, no shaft work is added to or removed from the system.

Four different equations are used to describe those four processes. A simplification is made by assuming changes of the kinetic and potential energy that take place in the system (mass of gas) can be neglected and then applying the first law of thermodynamics (energy conservation) to the mass of gas as it changes state as characterized by the gas's temperature, pressure, and volume. [2] [ page needed ] [6] [ page needed ]

During a complete cycle, the gas returns to its original state of temperature, pressure and volume, hence the net internal energy change of the system (gas) is zero. As a result, the energy (heat or work) added to the system must be offset by energy (heat or work) that leaves the system. In the analysis of thermodynamic systems, the convention is to account energy that enters the system as positive and energy that leaves the system is accounted as negative.

Equation 1a.

During a complete cycle, the net change of energy of the system is zero:

${\displaystyle \Delta E=E_{\text{in}}-E_{\text{out}}=0}$

The above states that the system (the mass of gas) returns to the original thermodynamic state it was in at the start of the cycle.

Where ${\displaystyle E_{\text{in}}}$is energy added to the system from 1–2–3 and ${\displaystyle E_{\text{out}}}$ is energy removed from the system from 3–4–1. In terms of work and heat added to the system

Equation 1b:

${\displaystyle W_{1-2}+Q_{2-3}+W_{3-4}+Q_{4-1}=0}$

Each term of the equation can be expressed in terms of the internal energy of the gas at each point in the process:

${\displaystyle W_{1-2}=U_{2}-U_{1}}$
${\displaystyle Q_{2-3}=U_{3}-U_{2}}$
${\displaystyle W_{3-4}=U_{4}-U_{3}}$
${\displaystyle Q_{4-1}=U_{1}-U_{4}}$

The energy balance Equation 1b becomes

${\displaystyle W_{1-2}+Q_{2-3}+W_{3-4}+Q_{4-1}=\left(U_{2}-U_{1}\right)+\left(U_{3}-U_{2}\right)+\left(U_{4}-U_{3}\right)+\left(U_{1}-U_{4}\right)=0}$

To illustrate the example we choose [ dubious ] some values to the points in the illustration:

${\displaystyle U_{1}=1}$
${\displaystyle U_{2}=5}$
${\displaystyle U_{3}=9}$
${\displaystyle U_{4}=4}$

These values are arbitrarily but rationally [ dubious ] selected. The work and heat terms can then be calculated.

The energy added to the system as work during the compression from 1 to 2 is

${\displaystyle \left(U_{2}-U_{1}\right)=\left(5-1\right)=4}$

The energy added to the system as heat from point 2 to 3 is

${\displaystyle \left({U_{3}-U_{2}}\right)=\left(9-5\right)=4}$

The energy removed from the system as work during the expansion from 3 to 4 is

${\displaystyle \left(U_{4}-U_{3}\right)=\left(4-9\right)=-5}$

The energy removed from the system as heat from point 4 to 1 is

${\displaystyle \left(U_{1}-U_{4}\right)=\left(1-4\right)=-3}$

The energy balance is

${\displaystyle \Delta E=+4+4-5-3=0}$

Note that energy added to the system is counted as positive and energy leaving the system is counted as negative and the summation is zero as expected for a complete cycle that returns the system to its original state.

From the energy balance the work out of the system is:

${\displaystyle \sum {\text{Work}}=W_{1-2}+W_{3-4}=\left(U_{2}-U_{1}\right)+\left(U_{4}-U_{3}\right)=4-5=-1}$

The net energy out of the system as work is -1, meaning the system has produced one net unit of energy that leaves the system in the form of work.

The net heat out of the system is:

${\displaystyle \sum {\text{Heat}}=Q_{2-3}+Q_{4-1}=\left(U_{3}-U_{2}\right)+\left(U_{1}-U_{4}\right)=4-3=1}$

As energy added to the system as heat is positive. From the above it appears as if the system gained one unit of heat. This matches the energy produced by the system as work out of the system.

Thermal efficiency is the quotient of the net work from the system, to the heat added to system. Equation 2:

${\displaystyle \eta ={\frac {W_{1-2}+W_{3-4}}{Q_{2-3}}}={\frac {\left(U_{2}-U_{1}\right)+\left(U_{4}-U_{3}\right)}{\left(U_{3}-U_{2}\right)}}}$
${\displaystyle \eta =1+{\frac {U_{1}-U_{4}}{\left(U_{3}-U_{2}\right)}}=1+{\frac {(1-4)}{(9-5)}}=0.25}$

Alternatively, thermal efficiency can be derived by strictly heat added and heat rejected.

${\displaystyle \eta ={\frac {Q_{2-3}+Q_{4-1}}{Q_{2-3}}}=1+{\frac {\left(U_{1}-U_{4}\right)}{\left(U_{3}-U_{2}\right)}}}$

Supplying the fictitious values

${\displaystyle \eta =1+{\frac {1-4}{9-5}}=1+{\frac {-3}{4}}=0.25}$

In the Otto cycle, there is no heat transfer during the process 1–2 and 3–4 as they are isentropic processes. Heat is supplied only during the constant volume processes 2–3 and heat is rejected only during the constant volume processes 4–1.

The above values are absolute values that might, for instance [ dubious ] , have units of joules (assuming the MKS system of units are to be used) and would be of use for a particular engine with particular dimensions. In the study of thermodynamic systems the extensive quantities such as energy, volume, or entropy (versus intensive quantities of temperature and pressure) are placed on a unit mass basis, and so too are the calculations, making those more general and therefore of more general use. Hence, each term involving an extensive quantity could be divided by the mass, giving the terms units of joules/kg (specific energy), meters3/kg (specific volume), or joules/(kelvin·kg) (specific entropy, heat capacity) etc. and would be represented using lower case letters, u, v, s, etc.

Equation 1 can now be related to the specific heat equation for constant volume. The specific heats are particularly useful for thermodynamic calculations involving the ideal gas model.

${\displaystyle C_{\text{v}}=\left({\frac {\delta u}{\delta T}}\right)_{\text{v}}}$

Rearranging yields:

${\displaystyle \delta u=(C_{\text{v}})(\delta T)}$

Inserting the specific heat equation into the thermal efficiency equation (Equation 2) yields.

${\displaystyle \eta =1-\left({\frac {C_{\text{v}}(T_{4}-T_{1})}{C_{\text{v}}(T_{3}-T_{2})}}\right)}$

Upon rearrangement:

${\displaystyle \eta =1-\left({\frac {T_{1}}{T_{2}}}\right)\left({\frac {T_{4}/T_{1}-1}{T_{3}/T_{2}-1}}\right)}$

Next, noting from the diagrams ${\displaystyle T_{4}/T_{1}=T_{3}/T_{2}}$ (see isentropic relations for an ideal gas), thus both of these can be omitted. The equation then reduces to:

Equation 2:

${\displaystyle \eta =1-\left({\frac {T_{1}}{T_{2}}}\right)}$

Since the Otto cycle uses isentropic processes during the compression (process 1 to 2) and expansion (process 3 to 4) the isentropic equations of ideal gases and the constant pressure/volume relations can be used to yield Equations 3 & 4. [7]

Equation 3:

${\displaystyle \left({\frac {T_{2}}{T_{1}}}\right)=\left({\frac {p_{2}}{p_{1}}}\right)^{(\gamma -1)/{\gamma }}}$

Equation 4:

${\displaystyle \left({\frac {T_{2}}{T_{1}}}\right)=\left({\frac {V_{1}}{V_{2}}}\right)^{(\gamma -1)}}$
where
${\displaystyle {\gamma }=\left({\frac {C_{\text{p}}}{C_{\text{v}}}}\right)}$
${\displaystyle {\gamma }}$ is the specific heat ratio
The derivation of the previous equations are found by solving these four equations respectively (where ${\displaystyle R}$ is the specific gas constant):
${\displaystyle C_{\text{p}}\ln \left({\frac {V_{1}}{V_{2}}}\right)-R\ln \left({\frac {p_{2}}{p_{1}}}\right)=0}$
${\displaystyle C_{\text{v}}\ln \left({\frac {T_{2}}{T_{1}}}\right)-R\ln \left({\frac {V_{2}}{V_{1}}}\right)=0}$
${\displaystyle C_{\text{p}}=\left({\frac {\gamma R}{\gamma -1}}\right)}$
${\displaystyle C_{\text{v}}=\left({\frac {R}{\gamma -1}}\right)}$

Further simplifying Equation 4, where ${\displaystyle r}$ is the compression ratio ${\displaystyle (V_{1}/V_{2})}$:

Equation 5:

${\displaystyle \left({\frac {T_{2}}{T_{1}}}\right)=\left({\frac {V_{1}}{V_{2}}}\right)^{(\gamma -1)}=r^{(\gamma -1)}}$

From inverting Equation 4 and inserting it into Equation 2 the final thermal efficiency can be expressed as:[ page needed ] [6] [ page needed ]

Equation 6:

${\displaystyle \eta =1-\left({\frac {1}{r^{(\gamma -1)}}}\right)}$

From analyzing equation 6 it is evident that the Otto cycle efficiency depends directly upon the compression ratio ${\displaystyle r}$. Since the ${\displaystyle \gamma }$ for air is 1.4, an increase in ${\displaystyle r}$ will produce an increase in ${\displaystyle \eta }$. However, the ${\displaystyle \gamma }$ for combustion products of the fuel/air mixture is often taken at approximately 1.3. The foregoing discussion implies that it is more efficient to have a high compression ratio. The standard ratio is approximately 10:1 for typical automobiles. Usually this does not increase much because of the possibility of autoignition, or "knock", which places an upper limit on the compression ratio. [2] [ page needed ] During the compression process 1–2 the temperature rises, therefore an increase in the compression ratio causes an increase in temperature. Autoignition occurs when the temperature of the fuel/air mixture becomes too high before it is ignited by the flame front. The compression stroke is intended to compress the products before the flame ignites the mixture. If the compression ratio is increased, the mixture may auto-ignite before the compression stroke is complete, leading to "engine knocking". This can damage engine components and will decrease the brake horsepower of the engine.

## Power

The power produced by the Otto cycle is an energy developed per unit of time. The Otto engines are called four-stroke engines. The intake stroke and compression stroke require one rotation of the engine crankshaft. The power stroke and exhaust stroke require another rotation. For two rotations there is one work generating stroke..

From the above cycle analysis the net work produced by the system :

${\displaystyle \sum {\text{ Work}}=W_{1-2}+W_{3-4}=\left(U_{2}-U_{1}\right)+\left(U_{4}-U_{3}\right)=+4-5=-1}$

(again, using the sign convention, the minus sign implies energy is leaving the system as work)

If the units used were MKS the cycle would have produced one joule of energy in the form of work. For an engine of a particular displacement, such as one liter, the mass of gas of the system can be calculated assuming the engine is operating at standard temperature (20 °C) and pressure (1 atm). Using the Universal Gas Law the mass of one liter of gas is at room temperature and sea level pressure:

${\displaystyle M={\frac {PV}{RT}}}$
V=0.001 m3, R=0.286 kJ/(kg·K), T=293 K, P=101.3 kN/m2
M=0.00121 kg

At an engine speed of 3000 RPM there are 1500 work-strokes/minute or 25 work-strokes/second.

${\displaystyle \sum {\text{ Work}}=1\,{\text{J}}/({\text{kg}}\cdot {\text{stroke}})\times 0.00121\,{\text{kg}}=0.00121\,{\text{J}}/{\text{stroke}}}$

Power is 25 times that since there are 25 work-strokes/second

${\displaystyle P=25\times 0.00121=0.0303\,{\text{J}}/{\text{s}}\;{\text{or}}\;{\text{W}}}$

If the engine uses multiple cylinders with the same displacement, the result would be multiplied by the number of cylinders. These results are the product of the values of the internal energy that were assumed for the four states of the system at the end each of the four strokes (two rotations). They were selected only for the sake of illustration, and are obviously of low value. Substitution of actual values from an actual engine would produce results closer to that of the engine. Whose results would be higher than the actual engine as there are many simplifying assumptions made in the analysis that overlook inefficiencies. Such results would overestimate the power output.

## Increasing power and efficiency

The difference between the exhaust and intake pressures and temperatures means that some increase in efficiency can be gained by use of a turbocharger, removing from the exhaust flow some part of the remaining energy and transferring that to the intake flow to increase the intake pressure. A gas turbine can extract useful work energy from the exhaust stream and that can then be used to pressurize the intake air. The pressure and temperature of the exhausting gases would be reduced as they expand through the gas turbine and that work is then applied to the intake gas stream, increasing its pressure and temperature. The transfer of energy amounts to an efficiency improvement and the resulting power density of the engine is also improved. The intake air is typically cooled so as to reduce its volume as the work produced per stroke is a direct function of the amount of mass taken into the cylinder; denser air will produce more work per cycle. Practically speaking the intake air mass temperature must also be reduced to prevent premature ignition in a petrol fueled engine; hence, an intercooler is used to remove some energy as heat and so reduce the intake temperature. Such a scheme both increases the engine's efficiency and power.

The application of a supercharger driven by the crankshaft does increase the power output (power density) but does not increase efficiency as it uses some of the net work produced by the engine to pressurize the intake air and fails to extract otherwise wasted energy associated with the flow of exhaust at high temperature and a pressure to the ambient.

## Related Research Articles

In thermodynamics, an adiabatic process is a type of thermodynamic process that occurs without transferring heat or mass between the thermodynamic system and its environment. Unlike an isothermal process, an adiabatic process transfers energy to the surroundings only as work. As a key concept in thermodynamics, the adiabatic process supports the theory that explains the first law of thermodynamics.

A Carnot heat engine is a heat engine that operates on the Carnot cycle. The basic model for this engine was developed by Nicolas Léonard Sadi Carnot in 1824. The Carnot engine model was graphically expanded by Benoît Paul Émile Clapeyron in 1834 and mathematically explored by Rudolf Clausius in 1857, work that led to the fundamental thermodynamic concept of entropy. The Carnot engine is the most efficient heat engine which is theoretically possible. The efficiency depends only upon the absolute temperatures of the hot and cold heat reservoirs between which it operates.

The compression ratio is the ratio between the volume of the cylinder and combustion chamber in an internal combustion engine at their maximum and minimum values.

The Diesel cycle is a combustion process of a reciprocating internal combustion engine. In it, fuel is ignited by heat generated during the compression of air in the combustion chamber, into which fuel is then injected. This is in contrast to igniting the fuel-air mixture with a spark plug as in the Otto cycle (four-stroke/petrol) engine. Diesel engines are used in aircraft, automobiles, power generation, diesel–electric locomotives, and both surface ships and submarines.

In thermodynamics and engineering, a heat engine is a system that converts heat to mechanical energy, which can then be used to do mechanical work. It does this by bringing a working substance from a higher state temperature to a lower state temperature. A heat source generates thermal energy that brings the working substance to the higher temperature state. The working substance generates work in the working body of the engine while transferring heat to the colder sink until it reaches a lower temperature state. During this process some of the thermal energy is converted into work by exploiting the properties of the working substance. The working substance can be any system with a non-zero heat capacity, but it usually is a gas or liquid. During this process, some heat is normally lost to the surroundings and is not converted to work. Also, some energy is unusable because of friction and drag.

The ideal gas law, also called the general gas equation, is the equation of state of a hypothetical ideal gas. It is a good approximation of the behavior of many gases under many conditions, although it has several limitations. It was first stated by Benoît Paul Émile Clapeyron in 1834 as a combination of the empirical Boyle's law, Charles's law, Avogadro's law, and Gay-Lussac's law. The ideal gas law is often written in an empirical form:

In thermodynamics, an isentropic process is an idealized thermodynamic process that is both adiabatic and reversible. The work transfers of the system are frictionless, and there is no net transfer of heat or matter. Such an idealized process is useful in engineering as a model of and basis of comparison for real processes. This process is idealized because reversible processes do not occur in reality; thinking of a process as both adiabatic and reversible would show that the initial and final entropies are the same, thus, the reason it is called isentropic. Thermodynamic processes are named based on the effect they would have on the system. Even though in reality it is not necessarily possible to carry out an isentropic process, some may be approximated as such.

In thermodynamics, an isothermal process is a type of thermodynamic process in which the temperature T of a system remains constant: ΔT = 0. This typically occurs when a system is in contact with an outside thermal reservoir, and a change in the system occurs slowly enough to allow the system to be continuously adjusted to the temperature of the reservoir through heat exchange. In contrast, an adiabatic process is where a system exchanges no heat with its surroundings (Q = 0).

The Brayton cycle is a thermodynamic cycle that describes the operation of certain heat engines that have air or some other gas as their working fluid. The original Brayton engines used a piston compressor and piston expander, but modern gas turbine engines and airbreathing jet engines also follow the Brayton cycle. Although the cycle is usually run as an open system, it is conventionally assumed for the purposes of thermodynamic analysis that the exhaust gases are reused in the intake, enabling analysis as a closed system.

In thermodynamics, an isobaric process is a type of thermodynamic process in which the pressure of the system stays constant: ΔP = 0. The heat transferred to the system does work, but also changes the internal energy (U) of the system. This article uses the physics sign convention for work, where positive work is work done by the system. Using this convention, by the first law of thermodynamics,

A compressor is a mechanical device that increases the pressure of a gas by reducing its volume. An air compressor is a specific type of gas compressor.

The Rankine cycle is an idealized thermodynamic cycle describing the process by which certain heat engines, such as steam turbines or reciprocating steam engines, allow mechanical work to be extracted from a fluid as it moves between a heat source and heat sink. The Rankine cycle is named after William John Macquorn Rankine, a Scottish polymath professor at Glasgow University.

In thermal physics and thermodynamics, the heat capacity ratio, also known as the adiabatic index, the ratio of specific heats, or Laplace's coefficient, is the ratio of the heat capacity at constant pressure to heat capacity at constant volume. It is sometimes also known as the isentropic expansion factor and is denoted by γ (gamma) for an ideal gas or κ (kappa), the isentropic exponent for a real gas. The symbol γ is used by aerospace and chemical engineers.

A thermodynamic cycle consists of a linked sequence of thermodynamic processes that involve transfer of heat and work into and out of the system, while varying pressure, temperature, and other state variables within the system, and that eventually returns the system to its initial state. In the process of passing through a cycle, the working fluid (system) may convert heat from a warm source into useful work, and dispose of the remaining heat to a cold sink, thereby acting as a heat engine. Conversely, the cycle may be reversed and use work to move heat from a cold source and transfer it to a warm sink thereby acting as a heat pump. If at every point in the cycle the system is in thermodynamic equilibrium, the cycle is reversible. Whether carried out reversible or irreversibly, the net entropy change of the system is zero, as entropy is a state function.

In thermodynamics, the thermal efficiency is a dimensionless performance measure of a device that uses thermal energy, such as an internal combustion engine, steam turbine, steam engine, boiler, furnace, refrigerator, ACs etc.

A polytropic process is a thermodynamic process that obeys the relation:

The Lenoir cycle is an idealized thermodynamic cycle often used to model a pulse jet engine. It is based on the operation of an engine patented by Jean Joseph Etienne Lenoir in 1860. This engine is often thought of as the first commercially produced internal combustion engine. The absence of any compression process in the design leads to lower thermal efficiency than the more well known Otto cycle and Diesel cycle.

A Carnot cycle is an ideal thermodynamic cycle proposed by French physicist Sadi Carnot in 1824 and expanded upon by others in the 1830s and 1840s. By Carnot's theorem, it provides an upper limit on the efficiency of any classical thermodynamic engine during the conversion of heat into work, or conversely, the efficiency of a refrigeration system in creating a temperature difference through the application of work to the system.

Thermodynamic heat pump cycles or refrigeration cycles are the conceptual and mathematical models for heat pump, air conditioning and refrigeration systems. A heat pump is a mechanical system that allows for the transmission of heat from one location at a lower temperature to another location at a higher temperature. Thus a heat pump may be thought of as a "heater" if the objective is to warm the heat sink, or a "refrigerator" or “cooler” if the objective is to cool the heat source. In either case, the operating principles are similar. Heat is moved from a cold place to a warm place.

The Fickett–Jacobs cycle is a conceptual thermodynamic cycle that allows to compute an upper limit to the amount of mechanical work obtained from a cycle using an unsteady detonation process (explosive). The Fickett–Jacobs (FJ) cycle is based on Chapman–Jouguet (CJ) theory, an approximation for the detonation wave's velocity during a detonation. This cycle is researched for rotating detonation engines (RDE), considered to be more efficient than the classical combustion engines that are based on the Brayton or Humphrey cycles.

## References

1. Wu, Chih. Thermodynamic Cycles: Computer-aided Design and Optimization . New York: M. Dekker, 2004. page 99
2. Moran, Michael J., and Howard N. Shapiro. Fundamentals of Engineering Thermodynamics. 6th ed. Hoboken, N.J. : Chichester: Wiley ; John Wiley, 2008. Print.
3. Mike Busch. "150-Year-Old Technology". Sport Aviation: 26.
4. Gunston, Bill (1999). Development of Piston Aero Engines (2 ed.). Sparkford, UK: Patrick Stephens Ltd. p. 21. ISBN   978-0-7509-4478-6.
5. "Heat Cycles - Electropeaedia". Woodbank Communications Ltd. Retrieved 2011-04-11.
6. Gupta, H. N. Fundamentals of Internal Combustion. New Delhi: Prentice-Hall, 2006. Print.
7. Reynolds & Perkins (1977). . McGraw-Hill. pp.  249. ISBN   978-0-07-052046-2.


text:
# Does MousePosition["Graphics"] give coordinates in outermost Graphics?

It seems that this issue has been raised a few times, but what exactly does MousePosition["Graphics"] answer?

This code

Dynamic @ p
Graphics[
EventHandler[
Disk[], {"MouseMoved" :> (p = MousePosition["Graphics"])}]]

nicely displays mouse position in the "current graphics" coordinate.

But try to put the graphics in another Graphics (GraphicsColumn in this case):

Dynamic @ p
GraphicsColumn @
List @ Graphics[
EventHandler[
Disk[], {"MouseMoved" :> (p = MousePosition["Graphics"])}]]

The coordinates now seem to be in the coordinate system defined by GraphicsColumn.

I will greatly appreciate any answer with a workaround (even not so generic solution).

P.S. Interesting enough GraphicsColumn breaks LocatorPane behaviour. LocatorPane manages to get correct coordinates (it uses custom LocatorPaneBox) but locators do not display:

pts = {};
GraphicsColumn @
List @ LocatorPane[Dynamic[pts], Graphics[Circle[]],
LocatorAutoCreate -> All]
Dynamic[pts]

• Whenever possible I try to use Row, Column, and Grid directly instead of their Graphics variants for other reasons. This works as expected, Column@{Dynamic@{p,p2},Graphics[EventHandler[Disk[],{"MouseMoved":>(p=MousePosition["Graphics"])}],Frame->True],Graphics[EventHandler[Disk[],{"MouseMoved":>(p2=MousePosition["Graphics"])}],Frame->True]}, but it doesn't have head Graphics so it might not work for your use case. Dec 27 '21 at 0:07

MousePosition["Graphics"]  should be changed to MousePosition[{"Graphics", Graphics}] to limit the coordinate system to the innermost expression with head Graphics.


text:
Provides a user friendly interface around package functionality to produce a nowcast from observed preprocessed data, and a series of user defined models. By default a model that assumes a fixed parametric reporting distribution with a flexible expectation model is used. Explore the individual model components for additional documentation and see the package case studies for example model specifications for different tasks.

Usage

epinowcast(
data,
reference = epinowcast::enw_reference(parametric = ~1, distribution = "lognormal",
non_parametric = ~0, data = data),
report = epinowcast::enw_report(non_parametric = ~0, structural = ~0, data = data),
expectation = epinowcast::enw_expectation(r = ~0 + (1 | day:.group), generation_time =
c(1), observation = ~1, latent_reporting_delay = c(1), data = data),
missing = epinowcast::enw_missing(formula = ~0, data = data),
obs = epinowcast::enw_obs(family = "negbin", data = data),
fit = epinowcast::enw_fit_opts(sampler = epinowcast::enw_sample, nowcast = TRUE, pp =
FALSE, likelihood = TRUE, debug = FALSE, output_loglik = FALSE),
model = epinowcast::enw_model(),
priors,
...
)

Arguments

data

Output from enw_preprocess_data().

reference

The reference time indexed reporting process model specification as defined using enw_reference().

report

The report time indexed reporting process model specification as defined using enw_report().

expectation

The expectation model specification as defined using enw_expectation(). By default this is set to be a highly flexible random effect by reference date for each group and thus weakly informed. Depending on your context (and in particular the density of data reporting) other choices that enforce more assumptions may be more appropriate (for example a weekly random walk (specified using rw(week, by = .group))).

missing

The missing reference date model specification as defined using enw_missing(). By default this is set to not be used.

obs

The observation model as defined by enw_obs(). Observations are also processed within this function for use in modelling.

fit

Model fit options as defined using enw_fit_opts(). This includes the sampler function to use (with the package default being enw_sample()), whether or now a nowcast should be used, etc. See enw_fit_opts() for further details.

model

The model to use within fit. By default this uses enw_model().

priors

A data.frame with the following variables: variable, mean, sd describing normal priors. Priors in the appropriate format are returned by enw_reference() as well as by other similar model specification functions. Priors in this data.frame replace the default priors specified by each model component.

...

Additional model modules to pass to model. User modules may be used but currently require the supplied model to be adapted.

Value

A object of the class "epinowcast" which inherits from enw_preprocess_data() and data.table, and combines the output from the sampler specified in enw_fit_opts().

Other epinowcast: plot.epinowcast(), summary.epinowcast()

Examples

if (FALSE) { # interactive()
library(data.table)
library(ggplot2)

# Use 2 cores
options(mc.cores = 2)
# Load and filter germany hospitalisations
nat_germany_hosp <-
germany_covid19_hosp[location == "DE"][age_group %in% "00+"]
nat_germany_hosp <- enw_filter_report_dates(
nat_germany_hosp,
latest_date = "2021-10-01"
)
# Make sure observations are complete
nat_germany_hosp <- enw_complete_dates(
nat_germany_hosp,
by = c("location", "age_group")
)
# Make a retrospective dataset
retro_nat_germany <- enw_filter_report_dates(
nat_germany_hosp,
remove_days = 40
)
retro_nat_germany <- enw_filter_reference_dates(
retro_nat_germany,
include_days = 40
)
# Get latest observations for the same time period
latest_obs <- enw_latest_data(nat_germany_hosp)
latest_obs <- enw_filter_reference_dates(
latest_obs,
remove_days = 40, include_days = 20
)
# Preprocess observations (note this maximum delay is likely too short)
pobs <- enw_preprocess_data(retro_nat_germany, max_delay = 20)
# Fit the default nowcast model and produce a nowcast
# Note that we have reduced samples for this example to reduce runtimes
nowcast <- epinowcast(pobs,
fit = enw_fit_opts(
save_warmup = FALSE, pp = TRUE,
chains = 2, iter_warmup = 500, iter_sampling = 500
)
)
nowcast
# plot the nowcast vs latest available observations
plot(nowcast, latest_obs = latest_obs)

# plot posterior predictions for the delay distribution by date
plot(nowcast, type = "posterior") +
facet_wrap(vars(reference_date), scale = "free")
}


text:
# Complex Representations in SU(3)

Good evening,

I am just reading the wonderful book by H. Georgi "Lie Algebras in Particle Physics", and I'm having a problem with one of the proves. While talking about complex representations especially in SU(3) the author states that the conjugate representation of a representation with Dynkin coefficients (n,m) has Dynkin coefficients (m,n). He argues that the highest weight of (n,m) is $n\mu^1+m\mu^2$ while the lowest one is $-n\mu^2-m\mu^1$, where $\mu^i$ are the fundamental weights, while the heighest weight of (m,n) is just $n\mu^2+m\mu^1$, so it is the negative of the lowest weight of (n,m) and from that he follows over a few steps that (m,n) must be the conjugate representation. What I don't get, and what Georgi doesn't really explain, is why $-n\mu^2-m\mu^1$ shall be the lowest weight of (n,m). I worked it out for some examples, but I can't figure out a simple argument for all n,m (as it should be, if Georgi doesn't bother to explain further). Do you have some ideas? Greetings from Heidelberg,

Markus Zetto

• Greetings Markus. The question might be more suitable for physics, but I am not sure about it. Either way notation and context would need be explained for anyone to understand stuff. – mathreadler Nov 8 '17 at 21:28
• I can do that, but I'm not shure where exactly I've been too sloppy. n and m are just some non-negative integers, the Dynkin coefficients of the representation. I don't think that further context is needed other than that we are working in the Lie Algebra of SU(3) (but I actually am more of a physicists, so if you desire more mathematical rigor, I should mention that as the title suggests, the book is also made for physicists) – Intergalakti Nov 8 '17 at 21:45
• Is your question about why the lowest weight has the negative of the coefficients of the highest weight? Or why the complex conjugate representation exchanges the two coefficients? Or both? – ziggurism Nov 8 '17 at 22:16
• Yes, it's about why the lowest weight the negative of the coefficients of the highest weight, but with n and m interchanged. – Intergalakti Nov 9 '17 at 7:53


text:
## Trigonometry (11th Edition) Clone

The graph of all the complex numbers, $z$, will be a horizontal line passing through the imaginary axis at $i$.
For $z = x + yi$, The imaginary part of $z$ is 1, shall mean, $y = 1$ or $z = x + i$ The graph of all the complex numbers, $z$, satisfying the captioned condition will be a horizontal line passing through the imaginary axis at $i$.