text:
# Command and Control Tutorial

## Introduction

Command and Control is a new LabVIEW template added for the 2016 season which organizes robot code into commands and controllers for a collection of robot-specific subsystems. Each subsystem has an independent control loop or state machine running at the appropriate rate for the mechanism and high-level commands that update desired operations and set points. This makes it very easy for autonomous code to build synchronous sequences of commands. Meanwhile, TeleOp benefits because it can use the same commands without needing to wait for completion, allowing for easy cancellation and initiation of new commands according to the drive team input. Each subsystem has a panel displaying its sensor and control values over time, and command tracing to aid in debugging.

### What is Command and Control?

Command and Control recognizes that FRC® robots tend to be built up of relatively independent mechanisms such as Drive, Shooter, Arm, etc. Each of these is referred to as a subsystem and needs code that will coordinate the various sensors and actuators of the subsystem in order to complete requested commands, or actions, such as «Close Gripper» or «Lower Arm». One of the key principles of this framework is that subsystems will each have an independent controller loop that is solely responsible for updating motors and other actuators. Code outside of the subsystem controller can issue commands which may change the robot’s output, but should not directly change any outputs. The difference is very subtle but this means that outputs can only possibly be updated from one location in the project. This speeds up debugging a robot behaving unexpectedly by giving you the ability to look through a list of commands sent to the subsystem rather than searching your project for where an output may have been modified. It also becomes easier to add an additional sensor, change gearing, or disable a mechanism without needing to modify code outside of the controller.

Game code, primarily consisting of Autonomous and TeleOp, will typically need to update set points and react to the state of certain mechanisms. For Autonomous, it is very common to define the robot’s operation as a sequence of operations – drive here, pick that up, carry it there, shoot it, etc. Commands can be wired sequentially with additional logic to quickly build complex routines. For teleOp, the same commands can execute asynchronously, allowing the robot to always process the latest driver inputs, and if implemented properly, new commands will interrupt, allowing the drive team to quickly respond to field conditions while also taking advantage of automated commands and command sequences.

### Why should I use Command and Control?

Command and Control adds functionality to the existing LabVIEW project templates, allowing code to scale better with more sophisticated robots and robot code. Subsystems are used to abstract the details of the implementation, and game code is built from sequences of high level command VIs. The commands themselves are VIs that can update set points, perform numerical scaling/mapping between engineering units and mechanism units, and offer synchronization options. If physical changes are made to the robot, such as changing a gearing ratio, changes can be made to just a few command Vis to reflect this change across the entire code base.

I/O encapsulation makes for more predictable operation and quicker debugging when resource conflicts do occur. Because each command is a VI, you are able to single step through commands or use the built in Trace functionality to view a list of all commands sent to each subsystem.The framework uses asynchronous notification and consistent data propagation making it easy to program a sequence of commands or add in simple logic to determine the correct command to run.

## Part 1: Project Explorer

The Project Explorer provides organization for all of the Vis and files you will use for your robot system. Below is a description of the major components in the Project Explorer to help with the expansion of our system. The most frequently used items have been marked in bold.

My Computer

The items that define operation on the computer that the project was loaded on. For a robot project, this is used as a simulation target and is populated with simulation files.

Sim Support Files

The folder containing 3D CAD models and description files for the simulated robot.

Documents the PWM channels and robot info you will need in order to write robot code that matches the wiring of the simulated robot.

Dependencies

Shows the files used by the simulated robot’s code. This will populate when you designate the code for the simulated robot target.

Build Specifications

This will contain the files that define how to build and deploy code for the simulated robot target.

Target (roboRIO-TEAM-FRC.local)

The items that define operation on the roboRIO located at (address).

Drive

The subsystem implementation and commands for the robot drive base. This serves as a custom replacement for the WPILib RobotDrive VIs.

Framework

VIs used for robot code that is not part of a subsystem that are not used very often.

Begin

Called once when robot code first starts. This is useful for initialization code that doesn’t belong to a particular subsystem.

Disabled

Called once for each disabled packet and can be used to debug sensors when you don’t want the robot to move.

Finish

During development, this may be called when robot code finishes. Not called on abort or when power is turned off.

A good place for ad hoc periodic loops for debugging or monitoring

Robot Global Data

Useful for sharing robot information that doesn’t belong to a subsystem.

Support Code

Debugging and code development aids.

Vision

Subsystem and commands for the camera and image processing.

Robot Main.vi

Top level VI that you will run while developing code.

Autonomous.vi

VI that runs during autonomous period.

Teleop.vi

VI that is called for each TeleOp packet.

Test.vi

VI that runs when driver station is in test mode.

SubSystems.vi

VI that contains and starts all subsystems.

Dependencies

Shows the files used by the robot code.

Build Specifications

Used to build and run the code as a startup application once code works correctly.

## Drive Subsystem Project Explorer

Commands:

This folder contains the command VIs that request the controller carry out an operation. It also contains templates for creating additional drive commands.

Nota

After creating a new command, you may need to edit Drive Setpoints.ctl to add or update fields that controller uses to define the new operation. You also need to go into the Drive Controller.vi and modify the case structure to add a case for every value.

### Implementation

These are the VIs and Controls used to build the subsystem.

Infrastructure VIs
• Drive Check for New Command: It is called each iteration of the controller loop. It checks for new commands, updates timing data, and upon completion notifies a waiting command.

• Drive Command Helper.vi: Commands call this VI to notify the controller that a new command has been issued.

• Drive Controller Initialization.vi: It allocates the notifier and combines the timing, default command, and other information into a single data wire.

• Drive Controller.vi: This VI contains the control/state machine loop. The panel may also contain displays useful for debugging.

• Drive Operation.ctl: This typedef defines the operational modes of the controller. Many commands can share an operation.

• Drive Setpoint.ctl: It contains the data fields used by all operating modes of the Drive subsystem.

• Drive Published Globals.vi: A useful place for publishing global information about the drive subsystem.

## Part 2: Initializing the Drive Subsystem

There are green comments on the controller’s block diagram that point out key areas that you will want to know how to edit.

The area to the left of the control loop will execute once when the subsystem starts up. This is where you will typically allocate and initialize all I/O and state data. You may publish the I/O refnums, or you may register them for Test Mode Only to keep them private so that other code cannot update motors without using a command.

Nota

Initializing the resources for each subsystem in their respective Controller.vi rather than in Begin.vi improves I/O encapsulation, reducing potential resource conflicts and simplifies debugging.

Part of the initialization is to select the default operation and set point values when no other operation is being processed.

Inside the control loop is a case statement where operations are actually implemented. Set point values, iteration delay, iteration count, and sensors can all have influence on how the subsystem operates. This case structure has a value for each operation state of the subsystem.

Each iteration of the controller loop will optionally update the Trace VI. The framework already incorporates the subsystem name, operation, and description, and you may find it helpful to format additional set point values into the trace information. Open the Trace VI and click Enable while the robot code is running to current setpoints and commands sent to each subsystem.

The primary goal of the controller is to update actuators for the subsystem. This can occur within the case structure, but many times, it is beneficial to do it downstream of the structure to ensure that values are always updated with the correct value and in only one location in the code.

## Part 3: Drive Subsystem Shipped Commands

There are 3 shipped example commands for each new subsystem:

### Drive For Time.vi

This VI sets the motors to run for a given number of seconds. It optionally synchronizes with the completion of the command.

The Drive for Time case will operate the motors at the set point until the timer elapses or a new command is issued. If the motors have the safety timeout enabled, it is necessary to update the motors at least once every 100ms. This is why the code waits for the smaller of the remaining time and 50ms.

### Drive Immediate.vi

Gets the desired left and right speeds for the motors and will set the motors immediately to those set points.

The Immediate case updates the motors to the set point defined by the command. The command is not considered finished since you want the motors to maintain this value until a new command comes in or until a timeout value. The timeout is useful anytime a command includes a dead band. Small values will not be requested if smaller than the dead band, and will result in growling or creeping unless the command times out.

### Stop Driving.vi

Zero the drive motors, making the robot stationary.

The Reserve command turns off the motors and waits for a new command. When used with a named command sequence, reserve identifies that the drive subsystem is part of a sequence, even if not currently moving the robot. This helps to arbitrate subsystem resource between simultaneously running commands.

## Part 4: Creating New Commands

The Command and Control framework allows users to easily create new commands for a subsystem. To Create a new command open the subsystem folder/Commands In the project explorer window, choose one of the VI Templates to use as the starting point of your new command, right click, and select New From Template.

• Immediate: This VI notifies the subsystem about the new setpoint.

• Immediate with deadband: This VI compares the input value to the deadband and optionally notifies the subsystem about the new setpoint. This is very useful when joystick continuous values are being used.

• With duration: This VI notifies the subsystem to perform this command for the given duration, and then return to the default state. Synchronization determines whether this VI Starts the operation and returns immediately, or waits for the operation to complete. The first option is commonly used for TeleOp, and the second for Autonomous sequencing.

In this example we will add the new command «Drive for Distance».

First, save the new VI with a descriptive name such as «Drive for Distance». Next, determine whether the new command needs a new value added the Drive Operations enum typedef. The initial project code already has an enum value of Drive for Distance, but the following image shows how you would add one if needed.

If a command needs additional information to execute, add it to the setpoints control. By default, the Drive subsystem has fields for the Left Setpoint, Right Setpoint, and Duration along with the operation to be executed. The Drive for Distance command could reuse Duration as distance, but let’s go ahead and add a numeric control to the Drive Setpoints.ctl called Distance (feet).

Once that we have all of the fields needed to specify our command, we can modify the newly created Drive for Distance.vi. As shown below, select Drive for Distance from the enum’s drop down menu and add a VI parameters to specify distance, speeds, etc. If the units do not match, the command VI is a great place to map between units.

Next, add code to the Drive Controller to define what happens when the Drive for Distance command executes. Right click on the Case Structure and Duplicate or Add Case for Every Value. This will create a new «Drive for Distance» case.

In order to access new setpoint fields, grow the «Access Cmd setpoints» unbundle node. Open your encoder(s) on the outside, to the left of the loop. In the new diagram of the case structure, we added a call to reset the encoder on the first loop iteration and read it otherwise. There is also some simple code that compares encoder values and updates the motor power. If new controls are added to the setpoints cluster, you should also consider adding them to the Trace. The necessary changes are shown in the image below.

## Part 5: Creating a Subsystem

In order to create a new subsystem, right click on the roboRIO target and select New» Subsystem. In the pop up dialog box, enter the name of the subsystem, list the operational modes, and specify the color of the icon.

When you click OK, the subsystem folder will be generated and added to the project disk folder and tree. It will contain a base implementation of the VIs and controls that make up a subsystem. A call to the new controller will be inserted into the Subsystems VI. The controller VI will open, ready for you to add I/O and implement state machine or control code. Generated VI icons will use the color and name provided in the dialog. The generated code will use typedefs for set point fields and operations.

Below is the block diagram of the newly created subsystem. This code will be generated automatically when you create the subsystem.


text:
# What's the most efficient way to send a users keypresses to the server?

So I've been coding a little project in JS recently, using node.js and socket.io to create a server, and HTML5 canvas to draw the client side. The user receives info from the server every 20ms, and the client interprets the data and displays it. If the user presses a key on the keyboard, it stores this information and sends it to the server instatly - so currently, the code is basically 'is keyboard pressed? if yes, send data to server'.

This has all worked great so far, however recently I increased the servers enemies (AI objects) from only 10 to a whopping 100... this lagged the server. Although I will work out enemy spawning efficiency later, the problem that immediately became apparent is that the user's character moved slower when the server was lagging. This meant that chasing enemies were able to easily catch up to the character and kill him, whereas usually the character could run away with relative ease.

This leads me to the question, what is the most efficient way that the server can interpret the keypresses of the user, and ensure that even if it is lagging that enemies will move at the same proportional speed to if the server wasn't lagging.

Sorry if this question is long-winded, any advice or help would be greatly appreciated. I assume that the same methodologies should apply from different coding languages, so if you have a vague idea how it works in a language you've used... please still share! :)

Thanks,

Cameron

In desktop games this is usually resolved by having the client assume it's allowed to do something (and running it's own physics engine etc). You could do the same thing here. The client uses the server to sync for online save or multiplayer and the server can reject events sent from the client; if this is the case the clients environment is set to what the server considers the current valid state.

That said; your problem is almost certainly that your code doesn't have a delta; your player should move X per second not X per key press.

So (no particular language);

Update (float delta){
If (keypressed){
Player.x+=delta*SPEED_PER_SECOND;
}
}

This ensures a lagging server moves in larger jumps if lagging but at the same velocity

• Thanks for your reply. You are correct, I haven't used anything to 'fill in the gaps' of the player pressing the keys (which is what delta seems to do, after a bit of research). I've read a bit more about it here. I'll attempt to add it to my server code and get back to you when I know the results. Thanks! :) – Cameron C Jan 11 '16 at 12:52

format: plain


text:
# least squares partial derivatives

Regression Line Fitting, understanding how the regression formula was developed using the least squares method for fitting a linear line (y-intercept & … Which is the reason why we got the equation above. Since the functions $f _ {i}$ are non-linear, solving the normal equations $\partial S/ \partial X _ {j} = 0$ may present considerable difficulties. Is it illegal to market a product as if it would protect against something, while never making explicit claims? Now we need to present the quadratic minimization problem in linear algebra Ax=b: [111213][cm]=[122] … ã=’˜Lõ"Å1y\¥¢†Œ¿¬ ƒE8á�b÷4½B¯:Ü° 2 O×œ">×§Åq”èƒ>Or€³ ${4.mKå�;º¢èJ‚¸"öpk{ëXÉ´ºnŠQçÖ—~òÿ#’€[ˆê&�Xµ5Ÿ,#4SQŸCF!vqÌU î}‡±w³l‚Õ~ß~PnîvÛØâR€Ô�ùÇ+H–ò±öp¸�P=ğrw h» MµØKgÈ¯vş¡—„ø³qÊ4˜Ê±¬#Ç³6şºøT!ãnÁ"c8A˜¾©jœö�ÉIÖ�9xÎ @éÑÁ‘×tÔ,}_(—ø2op>‘˜Ã¡*=ˆÄ7»Í"„ØÓQJK¸¥¯â´;¡4?Xt€…÷äp [òô3#aó xl*§éø°kÂë€ê9”�Û N¼{ÀŒwW‡ÌWÅºØ¸sŞæõ}ËuµØv Rx«qŒ¬Ë6£f‚?G—BÁ‚È×Åê~f¸ó]Îz ”q¯_†°™œ1?Yû† ßĞ.Ü¼÷¿ôl$Øäy”�Òô*°ªp*´y»FSŞ÷–÷V?X{Q—Ûr�|XâŠó pÕ;ì¶=.½3;¬# �B˜Â™¦XT^ The basic idea is to find extrema of $f(p)$ by setting $f$s derivative (with respect to $p$) to zero. The method can also be generalized for use with nonlinear relationships. For given parameters $p$ the vector $Ap$ is the vector of values $c+mx_i$, and the vector $e=Ap-y^T$ is the vector of errors of you model $(c+mx_i)-y_i$. The errors are 1, 2, 1. site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. Thus the optimality equation is $(Ap-y)^T A=0$, as in the linear algebra approach. Partial least squares is a common technique for multivariate regression. 1.1 The Partial Derivative and Jacobian Operator @ @x The Partial Derivative and Partial Derivative Operator. for some non-negative constant $\lambda$. Because $\lambda\ge 0$, it has a positive square root $\nu^2 = \lambda$. This was done in combination with previous efforts, which implemented data pre-treatments including scatter correction, derivatives, mean centring and variance scaling for spectral analysis. /Filter /FlateDecode Partial QR factorization to solve least squares problem, Constrained underdetermined least-squares over two variables, Proper way to use projection matrix equation, Least Squares using QR for underdetermined system, Linear Least Squares Problem of a Specific Matrix Form, Least squares problem regarding distance between two vectors in $\mathbb{R}^3$, Relationship between projections and least squares, TSLint extension throwing errors in my Angular application running in Visual Studio Code. How does partial differentiation solution exactly work? According to the method of least squares, estimators $X _ {j}$ for the $x _ {j}$ are those for which the sum of squares is smallest. Leaving that aside for a moment, we focus on finding the local extremum. The rules of differentiation are applied to the matrix as follows. ... which gives a recursion for partial derivatives . Partial Derivatives » Part A: Functions of Two Variables, Tangent Approximation and Opt » Session 29: Least Squares Session 29: Least Squares Course Home |uB)±R"ß9³„rë¹WnŠ¼†i™ş½xWMSV÷,Ò|³Äßy³Åáåw9¾Cyç,#Ò ... the ability to compute partial derivatives IS required for Stat 252. Asking for help, clarification, or responding to other answers. 8.5.3 The Method of Least Squares Here, we use a different method to estimate $\beta_0$ and $\beta_1$. Solving least squares with partial derivatives. and . The objective of this work was to implement discriminant analysis using SAS® partial least squares (PLS) regression for analysis of spectral data. Partial derivatives represents the rate of change of the functions as the variable change. These are the key equations of least squares: The partial derivatives of kAx bk2 are zero when ATAbx DATb: The solution is C D5 and D D3. The kernel partial least squares analysis of pK i for nicotine derivatives. That is why it is also termed "Ordinary Least Squares" regression. Method ‘lm’ supports only ‘linear’ loss. Well, Least-squares form … where $c$ is bias and $m$ is slope. Projection equation p=Ax=A(ATA)−1ATbcould be utilized: AT(b−Ax)=0 ATAx=ATb x=(ATA)−1ATb We know the inner product of AT and e=b−p=b−Ax is 0 since they are orthogonal (or since e is in the null space of AT). and the partial derivatives are . The problem of determining the best estimate of the state over time of a spacecraft from observations influenced by random and systematic errors using an approximated mathematical model is referred to as the problem of state estimation. Partial least squares regression (PLS regression) is a statistical method that bears some relation to principal components regression; instead of finding hyperplanes of maximum variance between the response and independent variables, it finds a linear regression model by projecting the predicted variables and the observable variables to a new space. The necessary condition for the minimum is the vanishing of the partial derivative of J with respect to x˜, that is, ∂J ∂x˜ = −2yTH +2x˜THTH = 0. Hello, thanks for the question! and . Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Each particular problem requires particular expressions for the model and its partial derivatives. This gives us the least squares estimator for . Viewed 158 times 0 $\begingroup$ Let's say we want to solve a linear regression problem by choosing the best slope and bias with the least squared errors. Actually I need the analytical derivative of the function and the value of it at each point in the defined range. Making statements based on opinion; back them up with references or personal experience. Which is the reason why we got the equation above. You are looking for vector of parameters $p=[c, m]^T$. To try to answer your question about the connection between the partial derivatives method and the method using linear algebra, note that for the linear algebra solution, we want $$(Ax-b)\cdot Ax = 0$$. Equation (2) is easy to derivatize by following the chain rule (or you can multipy eqn.3 out, or factor it and use the product rule). See Spacecraft OD Setup for more information. Then for $p$ with large $|p|$ we have that $|Ap|$ is large, hence so is $|Ap-y|$. Least-Squares Line Fits and Associated Uncertainty. Projection equation $p = Ax = A(A^TA)^{-1}A^Tb$ could be utilized: We know the inner product of $A^T$ and $e=b-p=b-Ax$ is $0$ since they are orthogonal (or since $e$ is in the null space of $A^T$). Have Texas voters ever selected a Democrat for President? Let $Proj(x)$ be the projection function (where $x$ contains unknown coefficients that we are trying to find, in this case $[c, m]^T$): $Proj(x) = Proj\left(\begin{bmatrix}c \\ m \end{bmatrix}\right) = (A^TA)^{-1}A^Tb = \left(\begin{bmatrix}1 & 1 & 1 \\ 1 & 2 & 3\end{bmatrix}\begin{bmatrix}1 & 1 \\ 1 & 2 \\ 1 & 3\\ \end{bmatrix}\right)^{-1} \begin{bmatrix}1 & 1 & 1 \\ 1 & 2 & 3\end{bmatrix}\begin{bmatrix}1 \\ 2 \\ 2\\ \end{bmatrix} = \left(\begin{bmatrix}3 & 6 \\ 6 & 14 \end{bmatrix}\right)^{-1}\begin{bmatrix}5 \\ 11 \end{bmatrix}=\left(\frac{1}{3(14)-6(6)}\begin{bmatrix}14 & -6 \\ -6 & 3 \end{bmatrix}\right)\begin{bmatrix}5 \\ 11 \end{bmatrix}=\begin{bmatrix}2.33333333 & -1 \\ -1 & 0.5 \end{bmatrix}\begin{bmatrix}5 \\ 11 \end{bmatrix} = \begin{bmatrix}0.66666667 \\ 0.5 \end{bmatrix}$. i.e. ç/$ÄÁyÂq›6%Mã Ğí¤ÉŒ>•¹ù0õDi…éGŠ In a High-Magic Setting, Why Are Wars Still Fought With Mostly Non-Magical Troop? I wanted to detail the derivation of the solution since it can be confusing for anyone not familiar with matrix calculus. J2 Semi-analytic – This method uses analytic partial derivatives based on the force model of the Spacecraft. Therefore b D5 3t is the best line—it comes closest to the three points. Where should I submit my mathematics paper? Derivation of linear regression equations The mathematical problem is straightforward: given a set of n points (Xi,Yi) on a scatterplot, find the best-fit line, Y‹ i =a +bXi such that the sum of squared errors in Y, ∑(−)2 i Yi Y ‹ is minimized At t D0, 1, 2 this line goes through p D5, 2, 1. Let's say we want to solve a linear regression problem by choosing the best slope and bias with the least squared errors. The errors are 1, 2, 1. Least squares method, also called least squares approximation, in statistics, ... That is, the sum over all i of (y i − a − bx i) 2 is minimized by setting the partial derivatives of the sum with respect to a and b equal to 0. By using least squares to fit data to a model, you are assuming that any errors in your data are additive and Gaussian. Therefore the partial derivative of quadratic error function with respect to$x$is equal to the sum of squared error that our matrix can span as well. Then, with$x_1$representing the slope of the least squares, and$x_2$representing the intercept, we have that The rules of differentiation are applied to the matrix as follows. The higher-brow way is to say that for$g(z)= |z|^2$one has$Dg(z)=2z^T$(since$\frac{\partial}{\partial z_i} \sum z_i^2=2 z_i$), and so, since$D (Ap)=A$at every point$p$, by chain rule$D(|Ap-y|^2)=2(Ap-y)^T A$. By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. $$\frac{\partial}{\partial x_1}||Ax-b||^2 = 2\sum_{i=1}^{n}a_i(x_1a_i+x_2-b_i) = 0$$ and $$\frac{\partial}{\partial x_2}||Ax-b||^2 = 2\sum_{i=1}^{n}(x_1a_i+x_2-b_i) = 0$$. Reply. Use the least squares method: the line should be the one that minimizes the sum of the squares of the errors in the y y y-coordinates. The equation decomposes this sum of squares into two parts. 3.4 Least Squares. It could not go through b D6, 0, 0. Under the least squares principle, we will try to ﬁnd the value of x˜ that minimizes the cost function J(x˜) = ǫTǫ = (y −Hx˜)T(y −Hx˜) = yTy −x˜THy −yTHx˜ + ˜xTHTHx˜. So in fact there is precisely one solution, and hence (since the function grows to positive infinity at infinity) it is a global minimum, just as expected. Solving least squares with partial derivatives. If callable, it must take a 1-D ndarray z=f**2 and return an array_like with shape (3, m) where row 0 contains function values, row 1 contains first derivatives and row 2 contains second derivatives. But apologies for my confusion, why are there two partial derivatives? The lower-tech method is to just compute the partials with respect to$c$and$m$. So if I were to take the partial derivative of this expression with respect to m. Well this first term has no m terms in it. Therefore b D5 3t is the best line—it comes closest to the three points. [9] Linear least squares. Linear Regression and Least Squares Consider the linear regression model Y = 0 + ... function. See Spacecraft OD Setup for more information. Recall, is a vector or coefficients or parameters. The sum D of the squares of the vertical distances d1, d2,... may be written as The values of a and b that minimize D are the values that make the partial derivatives of D with respect to a and b simultaneously equal to 0. 1. If$x$is not proportional to the vector of 1s, this leading term is positive definite, and so the function is strictly convex and hence has a unique global minimum. By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy.$\frac{\partial}{\partial c} \sum_i [(c+mx_i)-y_i]^2=\sum_i 2[(c+mx_i)-y_i]=2(Ap-y)\cdot [1, \ldots, 1]^T=0$,$\frac{\partial}{\partial m} \sum_i [(c+mx_i)-y_i]^2=\sum_i 2 [(c+mx_i)-y_i] x_i =2(Ap-y)\cdot x=0$. Congratulation you just derived the least squares estimator . xÚíZİ�ã¶ÏóşB�däÌŠßd‹ A‹ËC‘¤@w�¦hZ@kko…ØÖV²ïnó×wÈ¡diMÙÚ/ç’+öa)jçã7CÑ$ƒ?šh–hiH¦T²X_üùêâßR™ĞŒØÌ&W7�êjù¯ôr›oËf[.šÙœs�2ÉÜ@¤?e2û>¯3fÒ[|Gé›@”eŞÓÙ¿¯ş It is the sum of squares of the residuals plus a multiple of the sum of squares of the coefficients themselves (making it obvious that it has a global minimum). 1. You can solve the least squares minimization problem For projecting on the 0+ dimensional subspaces. Similarly for the uncertainty in the intercept is . Now we need to present the quadratic minimization problem in linear algebra $Ax=b$: $\begin{bmatrix}1 & 1 \\ 1 & 2 \\ 1 & 3 \end{bmatrix}\begin{bmatrix}c \\m\end{bmatrix} = \begin{bmatrix}1 \\ 2 \\ 2 \end{bmatrix}$. For each Spacecraft included in the Batch Least Squares estimation process, there are three options for how the STM is calculated. To use OLS method, we apply the below formula to find the equation. Use MathJax to format equations. Whenever we want to solve an optimization problem, a good place to start is to compute the partial derivatives of the cost function. Active 2 years, 5 months ago. At this point of the lecture Professor Strang presents the minimization problem as $A^TAx=A^Tb$ and shows the normal equations. Ordinary Least Squares (OLS) is a great low computing power way to obtain estimates for coefficients in a linear regression model. But what if the points don’t lie along a polynomial? The y in 2x 3y stays as-is, since it is a coefficient. The equation decomposes this sum of squares into two parts. Why are engine blocks so robust apart from containing high pressure? The procedure is recursive and in each step basis vectors are computed for the explaining variables and the solution vectors. Thank you sir for your answers. Is there any role today that would justify building a large single dish radio telescope to replace Arecibo? The second is the sum of squared model errors. If you search the internet for “linear least squares 3d” you will find some articles that describe how to use linear least squares to fit a line or plane in 3D. The second is the sum of squared model errors. diff (F,X)=4*3^(1/2)*X; is giving me the analytical derivative of the function. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. You have a matrix $A$ with 2 columns -- one column of ones, and one column the vector $x$ (in your case $x=[1, 2, 3]^T$. The surface height is sum of squared residuals for each combination of slope and intercept. We define the partial derivative and derive the method of least squares as a minimization problem. Notice that, when evaluating the partial derivative with respect to A, only the terms in which A appears contribute to the result. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Partial Derivatives » Part A: Functions of Two Variables, Tangent Approximation and Opt » Session 29: Least Squares Session 29: Least Squares Course Home From general theory: The function $f(p)$ is quadratic in $p$ with positive-semidefinite leading term $A^TA$ We will use Ordinary Least Squares method to find the best line intercept (b) slope (m) Ordinary Least Squares (OLS) Method. The procedure is recursive and in each step basis vectors Hence we first calculate the two derivatives: then solve for and the system of equations From this figure, we can find that the most potent compounds like S29, S30 and S37 in the training set, or like S10 and S44 in the test set are correctly modeled. ˜. To answer that question, first we have to agree on what we mean by the “best Thus the optimization approach is equivalent to the linear algebra one. Read More on This Topic. Alternatively: If $x$ is not proportional to the vector of 1s, then rank of $A$ is 2, and $A$ has no null space. stream I will use "d" for partial derivatives. Each particular problem requires particular expressions for the model and its partial derivatives. (11) One last mathematical thing, the second order condition for a minimum requires that the matrix is positive definite. The minimum of the sum of squares is found by setting the gradient to zero. Under the least squares principle, we will try to ﬁnd the value of x˜ that minimizes the cost function J(x˜) = ǫTǫ = (y −Hx˜)T(y −Hx˜) = yTy −x˜THy −yTHx˜ + ˜xTHTHx˜. It can be shown that the solution x is a local minimum. The method of least squares is a standard approach in regression analysis to approximate the solution of overdetermined systems (sets of equations in which there are more equations than unknowns) by minimizing the sum of the squares of the residuals made in the results of every single equation.. This was done in combination with previous efforts, which implemented data pre-treatments including scatter correction, derivatives, mean centring and variance scaling for spectral analysis. This perspective is general, capable of subsum-ing a number of common estimation techniques such as Bundle Adjust-ment and Extended Kalman Filter SLAM. The partial derivative of all data with respect to any model parameter gives a regressor. We learn how to use the chain rule for a function of several variables, and derive the triple product rule used in chemical engineering. each of these partial derivatives to zero to give the minimum sum of squares. Since for example finding full derivative at certain point of a 3 dimensional object may not be possible since it can have infinite tangent lines. This method will result in the same estimates as before; however, it … Partial derivatives are given for efficient least-squares fitting electron temperature, ion temperature, composition, or collision frequency to incoherent scatter spectra and autocorrelation functions without the need for massive off-line storage requirements for function tables. The Linear Least Squares Minimization Problem. Linear least squares fitting and optimization is considered and formula for the parameters defining the line ... (y_i - (a x_i + b))^2 \] The values of a and b that minimize D are the values that make the partial derivatives of D with respect to a and b simultaneously equal to 0. Recall, is a vector or coefficients or parameters. Partial least squares is a common technique for multivariate regression. When we arrange these two partial derivatives in a 2 1 vector, thiscanbewrittenas2X0Xb.SeeAppendixA(especiallyExamplesA.10andA.11 in Section A.7) for further computational details and illustrations. So now we have two expressions, the partial derivatives that we just found, that we will set equal to zero to minimize the square of the … J2 Semi-analytic – This method uses analytic partial derivatives based on the force model of the Spacecraft. On the other hand, the set of solutions of $(Ap-y)^TA=0$ aka of $A^T(Ap-y)=0$ aka $A^TAp=A^Ty$ is an affine subspace on which the value of $f(p)$ is therefore constant. To find the coefficients that give the smallest error, set the partial derivatives equal to zero and solve for the coefficients For linear and polynomial least squares, the partial derivatives happen to have a linear form so you can solve them relatively easily by using Gaussian elimination. This implies that $$x_1\sum_{i=1}^{n}a_i(x_1a_i+x_2-b_i)+x_2\sum_{i=1}^{n}(x_1a_i+x_2-b_i) = 0$$ Suppose we have $n$ data points and $n$ inputs $a_1,a_2,\cdots a_n$. Consider, a real-valued function f( n) : X= R !R: Given a value of the function, f(x) 2R, evaluated at a particular point in the domain x2X, often we are interested in determining how to increase or decrease the value of f(x) via local $$\min_{x} ||Ax-b||$$ by setting the partial derivatives of the cost function (wrt each element of x) The partial derivatives of the matrix is taken in this step and set equal to zero. To find the coefficients that give the smallest error, set the partial derivatives equal to zero and solve for the coefficients For linear and polynomial least squares, the partial derivatives happen to have a linear form so you can solve them relatively easily by using Gaussian elimination. We can do it in at least two ways. The following shows the derivation for x1 (4) LINEAR LEAST SQUARES The left side of (2.7) is called the centered sum of squares of the y i. Instead of stating every single equation, one can state the same using the more compact matrix notation: plugging in for A. Did something happen in 1987 that caused a lot of travel complaints? The last term, 5, is a constant and thus goes away. Similarly the partial derivative with respect to any given coefficient involves only the terms in Because the equation is in matrix form, there are k partial derivatives (one for each parameter in) set equal to zero. Then he proceeds solving minimization problem using partial derivatives, although I couldn't quite understand how could partial differentiation be used to solve this problem. Thanks for contributing an answer to Mathematics Stack Exchange! Because the equation is in matrix form, there are k partial derivatives (one for each parameter in ) set equal to zero. algebra. We could use projections. This is done by finding the partial derivative of L, equating it to 0 and then finding an expression for m and c. After we do the math, we are left with these equations: It only takes a minute to sign up. We could solve this problem by utilizing linear algebraic methods. [9] Linear least squares. lÂEZÕ%/Ú)™["ĞA�t(Tÿ¼$á0šsŸSÕ�|(É, This requirement is fulfilled in case has full rank. It could not go through b D6, 0, 0. So you take each of those three derivatives, partial derivatives, set them equal to zero, and you have a system of three equations with three variables. 3 0 obj << rev 2020.12.8.38145, The best answers are voted up and rise to the top, Mathematics Stack Exchange works best with JavaScript enabled, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site, Learn more about Stack Overflow the company, Learn more about hiring developers or posting ads with us. At t D0, 1, 2 this line goes through p D5, 2, 1. Since the model contains m parameters, there are m gradient equations: Licensing/copyright of an image hosted found on Flickr's static CDN? This quadratic minimization problem can also be represented as: We could solve this problem by utilizing linear algebraic methods. The objective of this work was to implement discriminant analysis using SAS® partial least squares (PLS) regression for analysis of spectral data. We could use projections. Value of soft margin between inlier and outlier residuals, default is 1.0. Then$|Ap|$is never zero, and so attains a minimum on the unit circle. Step 3. f_scale float, optional. This can work only if this space is of dimension 0 - otherwise as we go to infinity inside this subspace the value$f(p)$would have to grow unbounded while staying constant. Ï÷/Õ¦)—…ãLuº½-ÜÀ¤«v9˜¬ûËQ›®«Ù¶²,VÈ�e=îT+¢™ :ùgd}Ø¡6&|cA‰„_ ÁO�‰I4±ÚQ(ššS¢¸öDYdEübOóUl%Ğƒ¦�Y‰F¸¢9ëô1"�!œµ�”äË()Exÿá¶¨‹N ×j"“²Á“ÎñßºÈ78ú¥¨+ÕXÕ�àıLÊ4¯ËüzUÇ:™óŒ£,¨‡)ĞLÿ¶sFÃYú®ÊWhâ~!pƒm…Ïwu±,[|@ƒƒAgpn².À¢½øN±{%E¤a¿‚dh¾o#»Ô„iŞªÌ¢GÆ;b£†€ËïYP0xmâÆ It can be shown that the partial derivatives are . How can it be compared to the linear algebraic orthogonal projection solution? Is MD5 hashing possible by divide and conquer algorithm. Ask Question Asked 2 years, 6 months ago. 1.1 The Partial Derivative and Jacobian Operator @ @x The Partial Derivative and Partial Derivative Operator. As example, let the points be$x=[1, 2, 3]$and$y=[1,2,2]$. So as I understand the goal here is to find local minimum? But what if the points don’t lie along a polynomial? Now it may also be the case that one wants to use the best fit line parameters to use in future measurements. Let’s try to find the line that minimizes the Sum of Squared Residuals by searching over a grid of values for (intercept, slope).. Below is a visual of the sum of squared residuals for a variety of values of the intercept and slope. What are the pros and cons of buying a kit aircraft vs. a factory-built one? ... the partial derivatives ∂∂βu$ $ij. LINEAR LEAST SQUARES The left side of (2.7) is called the centered sum of squares of the y i. The rst is the centered sum of squared errors of the tted values ^y i. After finding this I also need to find its value at each … ¤FŸ2!Š6¤FU*U²§±7zÌRÇÍU�šëœ©öEQÕ! The Derivative of Cost Function: Since the hypothesis function for logistic regression is sigmoid in nature hence, The First important step is finding the gradient of the sigmoid function. For projecting on the$0+$dimensional subspaces. The rst is the centered sum of squared errors of the tted values ^y i. For each Spacecraft included in the Batch Least Squares estimation process, there are three options for how the STM is calculated. The least squared errors problem, a good place to start is to just the... Of least squares estimation process, there are three options for how STM. On finding the partial derivative Operator compared to the three points in 1987 that caused a of. A_1, a_2, \cdots a_n$ sum of squared errors ) =4 * 3^ ( )... The more compact matrix notation: plugging in for a moment, we focus on finding the partial derivatives the... To do is minimize it help, clarification, or responding to answers. And solve for the explaining variables and the solution vectors a vector or or... Function is to find derivatives for the three-variable multiple linear regression problem by utilizing linear algebraic orthogonal projection solution the. The function and the solution since it is n 1 times the usual estimate of the y in 3y. B 's that give us this the tted values ^y i my confusion why., there are three options for how the STM is calculated thanks for an. There are three options for how the STM is calculated rst derivative, set it equal to zero \lambda.. Is bias and $\beta_1$ the usual estimate of the Spacecraft with Mostly Troop! A different method to estimate $least squares partial derivatives$ and $\beta_1$ related fields this is. Aside for a plugging in for a moment, we use a different method estimate... Example, let the points don ’ t lie along a polynomial [ c, m ^T! Tted values ^y i of a function is to compute partial derivatives.! And its partial derivatives ( one for each Spacecraft included in the range... P= [ c, m ] ^T $subsum-ing a number of common estimation techniques as! Is why it is n 1 times the usual estimate of the y in 2x stays. Gives a regressor is a common technique for multivariate regression height is of. What if the points be$ x= [ 1, 2 this goes... Using the more compact matrix notation: plugging in for a and professionals in related fields telescope...... to minimize the SSE, you are assuming that any errors in your are! Point of the common variance of the y i decomposes this sum of squared for! Using least squares analysis of pK i for nicotine derivatives be represented as: we could solve this by... Squares into two parts ‘ linear ’ loss, we use a different method to estimate !, why are engine blocks so robust apart from containing high pressure engine so. The usual estimate of the y i cost function the minimization problem can also be the that. Reason why we got the equation is in matrix form, there are k least squares partial derivatives derivatives we. And thus goes away 3^ ( 1/2 ) * x ; is giving the... Operator @ @ x the partial derivative and derive the method of squares! Change of the sum of squared errors b D5 3t is the of... One-Time recovery codes for 2FA introduce a backdoor 's static CDN responding other. Evaluating the partial derivative and Jacobian Operator @ @ x the partial derivative relative to β we... A product as if it would protect against something, while never explicit... * x ; is giving me the analytical derivative of all data with respect to $c$ never. The unit circle is 2x + 6x 2y a regressor variables and the solution x is a coefficient is! We define the partial derivative of all data with respect to ...


text:
Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Effect of high slice energy spread of an electron beam on the generation of isolated, terawatt, attosecond X-ray free-electron laser pulse

## Abstract

Attosecond (asec) X-ray free-electron laser (XFEL) has attracted considerable interest over the past years. Nowadays typical XFEL application experiments demand 1010–1011 photons per pulse, which corresponds to a peak power of terawatts (TW) in case of asec hard X-ray pulse. To the realization of such TW asec-XFEL pulse, however, the unavoidable increase of slice energy spread (SES) due to laser heater, which is commonly used to mitigate the micro-bunching instability (MBI), would be a major obstacle. To deal with this problem, the effect of such a SES is investigated in this work. The results reveal that (1) SES of a current spike is linearly proportional to the peak current of a current spike in an electron beam, (2) surprisingly, this linearity is independent of the wavelength of an energy modulation driving laser which is used to make a current spike and (3) the gain length of current spike in the undulator is sensitive to the initial SES, so there is an optimal peak current of the current spike for successful FEL lasing process. Utilizing these characteristics, a series of simulations with parameters for Pohang Accelerator Laboratory X-ray Free Electron Laser was carried out to demonstrate that an isolated, TW asec-XFEL pulse can be generated even when the SES is increased due to the usage of laser heater to prevent the MBI in the XFEL. We show that an isolated X-ray pulse with >1 TW and a pulse duration of 73 as (~3 × 1010 photons/pulse at 12.4 keV or 0.1 nm) can be generated by using ten current spikes with optimal peak current. It becomes clear for the first time that the disadvantage from the increased SES can be indeed overcome.

## Introduction

Direct measurement and control of electron dynamics in their time scale in atomic, molecular and nanoscopic systems have been cherished since the dawn of quantum mechanics in the 20th century. The last two decades have observed that such cherished dreams are coming closer to the realization due to the advance of attosecond (asec) metrologies based on medium-scale1,2,3,4,5,6 and large-scale lasers7,8 and the advent of X-ray free electron laser (XFEL) sources9,10,11,12,13. These new novel sources are opening up new frontiers in ultrafast extreme ultraviolet (XUV) and X-ray science. This new paradigm will be even more enriched with the development of isolated asec pulses with higher power.

Advanced ultrashort sources based on optical lasers cover the visible to XUV (a few to ~100 eV) with a pulse duration of a few femtoseconds down to a few tens of asec. High-order harmonic generation (HHG) sources can generate a photon pulse in the XUV region (10~40 nm) with a pulse duration of hundreds of asec or less14,15. Such XUV sources have been used in the study of electron dynamics in atoms and molecules such as imaging and control of a two-electron wave packet, time-resolved dynamics of Fano resonance and Auger process, and continue to be demanded15. However, we note that it is hard to expect high-intensity X-ray pulses from laser-based asec sources due to the cut-off photon energy and the low conversion efficiency of HHG process. The tunability of photon energy in laser-based asec sources is also rather limited; however, the accessibility to these sources is easier and more available than that to XFEL.

XFEL-based sources can generate high-intensity asec X-ray pulse due to the large extraction efficiency from the electron beam. However, such a source has not been achieved until now as shown in Fig. 1. The development of such high-intensity asec X-ray sources will greatly extend the realm of ultrafast processes that can be explored and may enable single-molecule imaging16. The realization of single-molecule imaging is a holy grail of imaging science. Furthermore, intense isolated asec-XFEL pulses can observe real-time changes in the probability distribution of an electron’s position17,18, and could clarify the boundary between quantum mechanical and classical contributions. This technology could also enable four-dimensional imaging with picometer spatial resolution and asec temporal resolution17. Current intense XFEL pulses and peta-watt lasers can routinely produce bizarre states of matter such as inner shell holes in atoms19 or even hollow atoms, and warm dense matter20. Investigation on the dynamics for these new states of matter requires an intense isolated asec-XFEL, and will open up a field of dynamical X-ray nonlinear science21. While the accessibility to XFEL is very limited, XFEL provides continuous tunability of photon energy and sufficient number of photons per pulse, which is more suitable to the investigation of nonlinear phenomena in ultrafast time scale in X-ray region. We can conclude that laser-based asec source and XFELs have complementary nature for investigating the ultrafast phenomena. While laser-based asec sources will be suitable to investigations involving ultrafast XUV spectroscopy, XFEL based asec sources will be better fit to the studies utilizing ultrafast X-ray spectroscopy. These new, noble sources will work together to enhance and deepen our understanding of nature in the areas that have never been explored before.

Experimental and theoretical studies have been devoted to how to generate asec X-ray pulses from XFELs. Experimental approaches include X-ray Laser-Enhanced Attosecond Pulses (XLEAP) by the Linac Coherent Light Source (LCLS)22,23, which has succeeded in producing asec-XFEL in the soft X-ray region24. European X-ray Free Electron Laser and Pohang Accelerator Laboratory (PAL) have also shown interest in asec-XFEL projects25,26. Ref. 27 provides a good review of the proposals28,29,30,31,32,33 for TW asec X-ray pulse: multiple current spikes with equally-spaced distance28, an irregularly spaced slotted foil29, and the tilt of electron beam for shorter X-ray pulses30. If we make irregularly spaced current spikes in the electron beam, the slotted foil and the X-ray delay unit are not necessary for the generation of an isolated TW asec X-ray pulse31. A novel idea of re-using a single current spike by using small X-ray delay units between the undulators was tested out32. It was later demonstrated in simulation that the isolated TW asec X-ray pulse can be obtained by using a single current spike even without the X-ray delay units33. This proposal is the simplest one among the proposed methods up to now for the TW-level asec X-ray pulse generation.

Only recently it was pointed out that large slice energy spread (SES, see ‘Methods’ section for the definition of SES) of an electron beam due to the usage of a laser heater to mitigate the micro-bunching instability (MBI) may be a major obstacle to obtaining an asec X-ray pulse with power >1 TW27. Although there are several other causes for the increase of SES such as nonlinear energy chirp in an electron beam, cathode condition of the electron gun and etc., laser heater is most dominant cause of the increase of SES34 and relevant to the topic of the current spike investigation. The MBI originates from the space charge effect in the electron beam and the coherent radiation at a chicane type bunch compressor35. All of the XFELs suffer from the MBI, and they use laser heaters to mitigate MBI, which inevitably introduces high energy spread to the electron beam36,37,38,39. A laser heater can reduce MBI during operation of XFEL40 at the cost of an increase in the SES of the electron beam (Supplementary Information in more detail); this increase is expected to result in a current spike even with a larger SES in enhanced self-amplified spontaneous emission (E-SASE) method41. This large SES will impose difficulties on the amplification of radiation power to TW-level. Nevertheless, the effect of increased SES has not been seriously considered in the previous studies of the generation of a TW asec-XFEL pulse. The following important questions related to the SES should be addressed: (1) how the SES depends on the wavelength λL of the modulation laser used to make current spike, (2) how seriously the increase of SES limits the peak value of a current spike, (3) how badly the increase limits the amplification of radiation power or affects the gain length of current spike in the undulator and (4) the possibility about TW-power asec X-ray pulse generation in the presence of large SES.

In this paper, we address all the questions and demonstrate by simulation that a method for TW asec-XFEL pulse can be devised even under large SES, showing the generation of a ~73 asec, isolated XFEL pulse at 12.4 keV with >1 TW peak radiation power. This demonstration has been possible after the systematic investigation of the relationship between the SES and the peak current IP of current spike, and by the relationship between the gain length and IP of current spike. This is the first study that includes properly the effect of large SES in the generation of an isolated, TW, asec-XFEL pulse. Though the parameters of Pohang Accelerator Laboratory X-ray Free Electron Laser (PAL-XFEL) are used in this paper, the results are applicable to other XFEL facilities.

## Simulation Results

In this section, we present simulation results that quantify the dependence of SES of a current spike on wavelength of a modulation laser (λL) used in E-SASE method, on the peak value of a current spike (IP), and on the SES of the initial electron beam; we also demonstrate how SES affects the gain length of a current spike for amplification.

To increase the peak current of the current spike while preserving the width of current spike, the electrons must be bunched from a region as wide as possible in the electron beam (see ‘Methods’ section). For this reason, a long wavelength (λL) of a modulation laser is preferred. Hence a series of simulations with different λL has been done and their results are plotted in Fig. 2(a) (red dots for λL = 0.8 μm, green for λL = 1.6 μm, blue for λL = 2.4 μm). The SES of the base electron beam was fixed at 1.53 MeV, which is the nominal value for PAL-XFEL when the laser heater is under operation. We note that the SES (σE) increases linearly with IP: σE = 0.3890Ip + 0.1979, and has no dependency on λL.

The slope of the SES curve with IP (λL = 800 nm) increases as the SES of a base electron beam increases (Fig. 2(b)). The base current of the electron beam is set at 3 kA, which is a nominal value in PAL-XFEL. The fitting result for the red dots is the same as that in Fig. 2(a). Figure 2(b) reveals that if the SES of a base electron beam is high, the SES of the current spike is also high.

Horizontal black dashed lines indicate the limit of SES of the current spike. The limit is defined by using the Pierce parameter ρ which is calculated as42:

$$\rho ={\left[\left(\frac{{I}_{{\rm{p}}}}{{I}_{{\rm{A}}}}\right){\left(\frac{{\lambda }_{{\rm{w}}}{A}_{{\rm{w}}}}{2\pi {\sigma }_{{\rm{x}}}}\right)}^{2}{\left(\frac{1}{2{\gamma }_{0}}\right)}^{3}\right]}^{1/3},$$
(1)

where IA = 17.045 kA the Alfven current, λw is the undulator period, Aw the undulator parameter, σx the beam size and γ0 the Lorentz factor. To obtain a sufficient gain in the undulator, the SES of a current spike should satisfy the criteria43: $$\frac{{\sigma }_{{\rm{E}}}}{{\rm{E}}} < \rho$$, where the FEL parameter ρ ≈ 10−3. The electron beam energy in PAL-XFEL is 10 GeV; therefore, σE must be <10 MeV (horizontal black dashed lines, Fig. 2).

At a glance, FEL lasing efficiency could be increased by increasing IP , however, the increase of IP also increases SES, and this change in turn decreases the gain. As a result, counter-intuitively, the lasing can be degraded44,45. Thus, there must be an optimum value for the peak current (IP) of the current spike. To find an optimal the peak current (IP) of current spike related to the gain length of current spike, Ming Xie’s fitting formula46,47 is utilized.

The one-dimensional gain length44,45 is calculated from ρ as:

$${L}_{1{\rm{d}}}={\lambda }_{{\rm{w}}}/4\pi \sqrt{3}\rho .$$
(2)

Then the three-dimensional (3D) gain length (Lg) normalized by the one-dimensional gain length can be expressed by a scaling function as46,47,48,49:

$$\frac{{L}_{{\rm{g}}}}{{L}_{1{\rm{d}}}}=1+\eta ({\eta }_{{\rm{d}}},{\eta }_{\epsilon },{\eta }_{{\rm{\gamma }}}),$$
(3)

where η is a scaling function46 that is the function of a diffraction parameter $${\eta }_{{\rm{d}}}=\frac{{L}_{1{\rm{d}}}}{{L}_{{\rm{r}}}}$$, an emittance parameter $${\eta }_{\epsilon }=(\frac{{L}_{1{\rm{d}}}}{\beta })(\frac{4\pi {\epsilon }}{\lambda })$$, and an energy-spread parameter $${\eta }_{{\rm{\gamma }}}=4\pi (\frac{{L}_{1{\rm{d}}}}{{\lambda }_{{\rm{w}}}})(\frac{{\sigma }_{{\rm{E}}}}{{E}_{0}})$$. The Rayleigh length Lr in the diffraction parameter is defined as $${L}_{{\rm{r}}}=4{\rm{\pi }}{\sigma }_{{\rm{x}}}^{2}/\lambda$$, where λ is the wavelength of the X-ray pulse.

By using Eq. (3), the 3-D gain lengths for the cases in Fig. 2(a) were calculated and shown in Fig. 3(a). Lg initially decreases for the increase of IP as intuitively expected. However, for IP > ~ 10 kA, counter-intuitively Lg increases again because the SES becomes so high that the total gain in X-ray output power is less than at IP = 10 kA. As expected, Lg does not depend on λL. Hence the important parameter to decrease the gain length is IP itself, not λL.

The dependence of Lg on IP was calculated (Fig. 3(b)) for the cases in Fig. 2(b). When the base SES is sufficiently low (0.25 MeV), a high IP is preferable to reduce Lg (Fig. 3(b), blue dots). However, as the base SES increases, the smallest Lg occurs at an optimal IP (Fig. 3(b), green and red dots). Hence we decided to use IP = 10 kA for this simulation, because the SES of the base current in PAL-XFEL is ~1.5 MeV when the laser heater is under operation.

This investigation has revealed that SES increases linearly as the peak current (IP)of the current spike increases, but is independent of λL. The slope of the increase of SES with respect to IP is sensitive to the SES of the base current. The gain length has an optimum value when the SES of the base current is high. Hence while SES should be minimized during the generation, acceleration and manipulation stages of the electron beam, the optimal peak current of current spike should be identified for a given SES for the best amplification of asec-XFEL.

### Generation of isolated terawatt attosecond X-ray pulse

#### Single current spike case

In this section, we discuss whether the optimal peak current of current spike has to be used and whether an isolated asec-XFEL with TW peak-power can be generated even under the high SES with a single current spike33. The two representative single current spikes with optimal peak current (10 kA, Fig. 4(a),(b)) and quite high peak current (35 kA, Fig. 4(c),(d)) were generated by using the E-SASE method. For the case of a 1.5-cycle modulation laser at λL = 800 nm and ΔE = 10.2 MeV, the peak current (IP) of the main current spike reaches up to 10 kA with a current spike width of 120 nm FWHM (Fig. 4(a)). The profile of SES (σE) along the electron beam for all the slices are plotted in Fig. 4(b). Note that the SES at the main IP position is lower than 5 MeV as shown in Fig. 2. To increase IP of the current spike while maintaining its spike width, λL should be increased with ΔE being increased simultaneously33, and therefore λL = 2000 nm and ΔE = 51.1 MeV is used. In this case, IP of the current spike is increased up to 35 kA (Fig. 4(c)). As the peak current of current spike is increased, the SES is also increased to about 15 MeV (Fig. 4(d)) which is also recognized in Fig. 2.

With the two representative cases in Fig. 4, the simulations for radiation were performed by using GENESIS 1.3 code50. Layout of undulator line for the case of single current spike is shown in Fig. 5(a). From the single current spike of 10 kA, the radiation power of up to 28 GW at 12.4 keV with a pulse duration of 170 asec FWHM (Fig. 5(b)) is generated for PAL-XFEL undulator parameters (Table S1 in Supplementary Information). Although the generated XFEL pulse had side peaks (Fig. 5(b), inset), their intensities are rather smaller than main radiation pulse. From the single current spike of 35 kA, on the other hand, a power of only 0.4 GW is generated at the position of the current spike (Fig. 5(c)) and the background electrons radiate more than those in the current spike (Fig. 5(c), inset).

At the optimal value for the peak current of the current spike, the gain length of the current spike is minimized and the power growth of the radiation from the current spike is faster than that from the other portion of the electron beam. Therefore, the XFEL pulse radiated from the current spike with optimal peak current can be an isolated pulse as shown in Fig. 5(b). However, when the high peak current is used for current spike neglecting the negative effect of SES, a spiky long XFEL pulse is typically generated as shown in Fig. 5(c). The radiation power radiated from other parts of the electron beam is even higher than that from the current spike because the gain length of other parts can be shorter than that of current spike due to large SES of current spike as shown in Fig. 3. The simulation results reveal that in spite of the increased SES, a single current spike with optimal peak current can generate 170 asec isolated XFEL pulse to a level of 30 GW power but not to a level of >1 TW radiation power.

#### Multi current spikes case

To overcome the significant increase of SES and generate TW-level asec-XFEL pulse, the multi current spike method31 is examined in this subsection. To generate multi current spikes in the electron beam from the E-SASE method, we use a multi-cycle laser pulse with an energy chirp31. Because of the chirp in the modulation laser, the multi current spikes are separated by increasing distances (Fig. 6(a)) which is suitable for generating isolated intense pulse31. The total charge of the electron beam including the base level current is 270 pC. The total length of the electron beam is 27 μm and the number of current spikes is ten. Peak current of each spikes is about 10 kA and the current spikes have SES <5 MeV (Fig. 6(b)).

The simulation considered ten current spikes as shown in Fig. 6(a), with a total of 23 undulators: five in the first stage and two for each of the nine stages. To obtain a sufficient initial radiation power, five undulators are assigned in the beginning of the undulator line as one unit before the first electron beam delay unit (Fig. 7(a), red blocks). In the later sections, two undulators as one unit are sufficient to maintain the fast amplification of radiation power between the electron beam delay units. For different XFEL machines, the number of undulators between the delay units can be adjusted. The delay units can match a target X-ray pulse (generated from one current spike) to the new current spike just ahead of the X-ray pulse. This is repeated in each delay unit. Then the target X-ray pulse can always see a new fresh current spike in each undulator31.

With this configuration, an isolated TW asec-XFEL pulse can be produced (Fig. 7(b)). The pulse width is ~73 asec (FWHM) and the peak power is >1 TW (Fig. 7(b), inset). We used only 23 undulators in this study due to the space limitation of PAL-XFEL undulator hall; for other XFEL facilities, the number of undulators can be changed. We conclude that the multi current spikes method31 can produce an isolated, TW-level asec-XFEL pulse even under the malignant effect by the increased SES.

## Summary and Discussion

Large SES is fatal to the realization of a TW asec-XFEL pulse. Due to MBI, a laser heater at an injector part must be used during normal XFEL operation, but the laser heater increases the initial SES of the electron beam, and this SES impedes the generation of a TW asec-XFEL pulse. To devise a way to produce an isolated, TW asec-XFEL, the characteristics of the current spike has been explored. The key observations are: (1) SES increases linearly as the peak current (IP) of a current spike increases but not on λL, and (2) the rate of increase is sensitively dependent on the initial amount of SES. (3) The gain length (Lg) of amplification process in the undulator is also affected by SES, so there exists an optimal IP for a current spike in the FEL lasing process; this optimal IP is ~10 kA for PAL-XFEL. Note that 10 kA is specific value for PAL-XFEL; however, there would be another optimum value for each XFEL facility.

Two series of simulations were performed: one for a single current spike case, and the other for a multi current spikes case. In the case of a single current spike (10 kA), XFEL pulse with only 28GW radiation power and 170 asec pulse duration (~2.5 ×109 photons/shot at 12.4 keV or 0.1 nm) is generated by using 8 undulator units. To produce the XFEL pulse of up to 1 TW with a pulse duration of 73 asec (~3 ×1010 photons/shot at 12.4 keV or 0.1 nm), ten current spikes in the electron beam with optimal peak current is necessary for PAL-XFEL. We demonstrate and devise a way by simulation that an isolated TW asec-XFEL pulse can be generated even when the SES is large due to a laser heater.

## Methods

This section outlines the enhanced self-amplified spontaneous emission (E-SASE) method (Fig. 8(a))41 to make current spike in an electron beam. A few-cycle laser is sent to the wiggler synchronously with an electron beam, and the interaction between the laser and the electron beam under the magnetic field of a wiggler yields a particle distribution with energy modulation (ΔE, Fig. 8(b)). This energy modulation gets steeper and is converted to a density modulation by a subsequent chicane (Fig. 8(c)). This density modulation represents, in general, current spikes. The particle distribution is divided by equally spaced slices along the propagation direction of the electron beam. The current profile along the electron beam can be obtained by integrating the particle distribution in each slice (i.e., by integrating Fig. 8(c) over the energy axis). The energy distribution of a sliced section (white dashed line in Fig. 8(c)) is plotted in Fig. 8(d) and the rms SES (σE) of the slice is defined as the rms value of the distribution function (red dashed line in Fig. 8(d)). By controlling the parameters related to the modulation laser and the electron beam, appropriate current shape can be obtained for specific purpose; a single current spike or multi current spikes, which is essential for the generation of an isolated TW asec-XFEL pulse.

## References

1. 1.

Kim, D. E. Extreme Metrology for Ultrafast Electron Dynamics at the Atomic Scale. J. Korean Phys. Soc. 73, 227–234 (2018).

2. 2.

Drescher, M. et al. Time-resolved atomic inner-shell spectroscopy. Nature 419, 803–807 (2002).

3. 3.

Anand, M., Pabst, S., Kwon, O. & Kim, D. E. Attosecond counter-rotating-wave effect in xenon driven by strong fields. Phys. Rev. A 95, 053420 (2017).

4. 4.

Zhao, K. et al. Tailoring a 67 attosecond pulse through advantageous phase-mismatch. Opt. Lett. 37, 3891–3893 (2012).

5. 5.

Schultze, M. et al. Attosecond band-gap dynamics in silicon. Science 346, 1348–1352 (2014).

6. 6.

Fabris, D. et al. Synchronized pulses generated at 20 eV and 90 eV for attosecond pump–probe experiments. Nat. Photonics 9, 383–387 (2015).

7. 7.

Charalambidis, D. et al. The Extreme Light Infrastructure – Attosecond Light Pulse Source (ELI-ALPS) Project. Springer Series in Chemical Physics. 181–218 (2017).

8. 8.

Mondal, S. et al. Surface plasma attosource beamlines at ELI-ALPS. J. Opt. Soc. Am. B 35, A93–A102 (2018).

9. 9.

Emma, P. et al. First lasing and operation of an ångstrom-wavelength free-electron laser. Nat. Photonics 4, 641–647 (2010).

10. 10.

Ishikawa, T. et al. A compact X-ray free-electron laser emitting in the sub-ångström region. Nat. Photonics 6, 540–544 (2012).

11. 11.

Kang, H.-S. et al. Hard X-ray free-electron laser with femtosecond-scale timing jitter. Nat. Photonics 11, 708–713 (2017).

12. 12.

Altarelli, M. The European X-ray free-electron laser facility in Hamburg. Nucl. Instrum. Methods Phys. Res. B 269, 2845–2849 (2011).

13. 13.

Milne, C. J. et al. SwissFEL: The Swiss X-ray Free Electron Laser. Appl. Sci. 7, 720 (2017).

14. 14.

Chatziathanasiou, S. et al. Generation of Attosecond Light Pulses from Gas and Solid State Media. Photonics 4, 26 (2017).

15. 15.

Reduzzi, M. et al. Advances in high-order harmonic generation sources for time-resolved investigations. J. Electron Spectros. Relat. Phenomena 204, 257–268 (2015).

16. 16.

Fratalocchi, A. & Ruocco, G. Single-Molecule Imaging with X-Ray Free-Electron Lasers: Dream or Reality? Phys. Rev. Lett. 106, 105504 (2011).

17. 17.

Krausz, F. & Ivanov, M. Attosecond physics. Rev. Mod. Phys. 81, 163–234 (2009).

18. 18.

Dixit, G., Vendrell, O. & Santra, R. Imaging electronic quantum motion with light. Proc. Natl. Acad. Sci. USA 109, 11636–11640 (2012).

19. 19.

Fukuzawa, H. et al. Deep Inner-Shell Multiphoton Ionization by Intense X-Ray Free-Electron Laser Pulses. Phys. Rev. Lett. 110, 173005 (2013).

20. 20.

Bostedt, C. et al. Linac Coherent Light Source: The first five years. Rev. Mod. Phys. 88, 015007 (2016).

21. 21.

Fuchs, M. et al. Anomalous nonlinear X-ray Compton scattering. Nat. Phys. 11, 964–970 (2015).

22. 22.

Huang, S. et al. Generating Single-Spike Hard X-Ray Pulses with Nonlinear Bunch Compression in Free-Electron Lasers. Phys. Rev. Lett. 119, 154801 (2017).

23. 23.

Marinelli, A. et al. Experimental demonstration of a single-spike hard-X-ray free-electron laser starting from noise. Appl. Phys. Lett. 111, 151101 (2017).

24. 24.

Duris, J. et al. Tunable isolated attosecond X-ray pulses with gigawatt peak power from a free-electron laser. Nat. Photonics 14, 30–36 (2020).

25. 25.

Serkez, S. et al. Overview of options for generating high-brightness attosecond x-ray pulses at free-electron lasers and applications at the European XFEL. J. Opt. 20, 024005 (2018).

26. 26.

Shim, C. H., Parc, Y. W., & Kim, D. E. Generation of isolated, TW-level, attosecond hard X-ray FEL pulse. Pohang Accelerator Laboratory Internal Report PAL-INT/AB 2018-002 (2018).

27. 27.

Parc, Y. W., Shim, C. H. & Kim, D. E. Toward the Generation of an Isolated TW-Attosecond X-ray Pulse in XFEL. Appl. Sci. 8, 1588 (2018).

28. 28.

Tanaka, T. Proposal for a Pulse-Compression Scheme in X-Ray Free-Electron Lasers to Generate a Multiterawatt, Attosecond X-Ray Pulse. Phys. Rev. Lett. 110, 084801 (2013).

29. 29.

Prat, E. & Reiche, S. Simple Method to Generate Terawatt-Attosecond X-Ray Free-Electron-Laser Pulses. Phys. Rev. Lett. 114, 244801 (2015).

30. 30.

Prat, E., Löhl, F. & Reiche, S. Efficient generation of short and high-power x-ray free-electron-laser pulses based on superradiance with a transversely tilted beam. Phys. Rev. ST Accel. Beams 18, 100701 (2015).

31. 31.

Tanaka, T. et al. Using irregularly spaced current peaks to generate an isolated attosecond X-ray pulse in free-electron lasers. J. Synchrotron Rad. 23, 1273–1281 (2016).

32. 32.

Kumar, S., Parc, Y. W., Landsman, A. S. & Kim, D. E. Temporally-coherent terawatt attosecond XFEL synchronized with a few cycle laser. Sci. Rep. 6, 37700 (2016).

33. 33.

Shim, C. H., Parc, Y. W., Kumar, S., Ko, I. S. & Kim, D. E. Isolated terawatt attosecond hard X-ray pulse generated from single current spike. Sci. Rep. 8, 7463 (2018).

34. 34.

Huang, Z. et al. Measurements of the linac coherent light source laser heater and its impact on the x-ray free-electron laser performance. Phys. Rev. ST Accel. Beams 13, 020703 (2010).

35. 35.

Saldin, E. L., Schneidmiller, E. A. & Yurkov, M. V. An analytical description of longitudinal phase space distortions in magnetic bunch compressors. Nucl. Instrum. Methods Phys. Res. A 483, 516–520 (2002).

36. 36.

Pedrozzi, M. et al. The Laser Heater System of SwissFEL. In Proc. FEL 2014, pp. 871–877 (2014).

37. 37.

Lee, J. et al. PAL-XFEL laser heater commissioning. Nucl. Instrum. Methods Phys. Res. A 843, 39–45 (2017).

38. 38.

Spampinati, S. et al. Laser heater commissioning at an externally seeded free-electron laser. Phys. Rev. ST Accel. Beams 17, 120705 (2014).

39. 39.

Hamberg, M. et al. Electron Beam Heating with the European XFEL Laser Heater. in Proc. FEL 2017, pp. 450–451 (2017).

40. 40.

Huang, Z. et al. Suppression of microbunching instability in the linac coherent light source. Phys. Rev. ST Accel. Beams 7, 074401 (2004).

41. 41.

Zholents, A. A. Method of an enhanced self-amplified spontaneous emission for x-ray free electron lasers. Phys. Rev. ST Accel. Beams 8, 040701 (2005).

42. 42.

Bonifacio, R., Pellegrini, C. & Narducci, L. M. Collective instabilities and high-gain regime in a free electron laser. Opt. Commun. 50, 373–378 (1984).

43. 43.

Kim, K. J., Huang, Z. & Lindberg, R. Synchrotron radiation and free electron lasers. Cambridge university press (2017).

44. 44.

Kim, K.-J. An analysis of self-amplified spontaneous emission. Nucl. Instrum. Methods Phys. Res. A 250, 396–403 (1986).

45. 45.

Kim, K.-J. Three-Dimensional Analysis of Coherent Amplification and Self-Amplified Spontaneous Emission in Free-Electron Lasers. Phys. Rev. Lett. 57, 1871–1874 (1986).

46. 46.

Xie, M. Design optimization for an X-ray free electron laser driven by SLAC linac. In Proc. 1995 PAC, pp. 183–185 (1996).

47. 47.

Xie, M. Exact and variational solutions of 3D eigenmodes in high gain FELs. Nucl. Instrum. Methods Phys. Res. A 445, 59–66 (2000).

48. 48.

Yu, L. H., Krinsky, S. & Gluckstern, R. L. Calculation of universal scaling function for free-electron-laser gain. Phys. Rev. Lett. 64, 3011–3014 (1990).

49. 49.

Chin, Y. H., Kim, K.-J. & Xie, M. Three-dimensional theory of the small-signal high-gain free-electron laser including betatron oscillations. Phys. Rev. A 46, 6662–6683 (1992).

50. 50.

Reiche, S. GENESIS 1.3: a fully 3D time-dependent FEL simulation code. Nucl. Instrum. Methods Phys. Res. A 429, 243–248 (1999).

## Acknowledgements

This research was supported partly by Max Planck POSTECH/KOREA Research Initiative Program [2016K1A4A4A01922028] through the National Research Foundation of Korea (NRF) funded by the Ministry of Science, ICT Future Planning, partly by Korea Institute for Advancement of Technology (KIAT) grant funded by the Korea Government (MOTIE) (P0008763, The Competency Development Program for Industry Specialist), partly by the Basic Science Research Program through the National Research Foundation of Korea (NRF-2016R1D1A1B03930349).

## Author information

Authors

### Contributions

C.H. Shim performed the simulations and plotted all figures. Y.W. Parc proposed the idea of the scheme. D.E. Kim supervised the work. All authors contributed equally to the writing of the paper.

### Corresponding authors

Correspondence to Yong Woon Parc or Dong Eon Kim.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Shim, C.H., Parc, Y.W. & Kim, D.E. Effect of high slice energy spread of an electron beam on the generation of isolated, terawatt, attosecond X-ray free-electron laser pulse. Sci Rep 10, 1312 (2020). https://doi.org/10.1038/s41598-020-57905-y


text:
# Gas Laws -- why calculate the mean square speed at 273K?

Tags:
1. Mar 21, 2017

### Faiq

1. The problem statement, all variables and given/known data
Why is the formula $p = \frac{1}{3}\rho<c^2>$ used to calculate the mean square speed at 273K?
Why 273K?

2. Mar 21, 2017

### BvU

It works at any temperature. Could you give a bit more context ? Is this a section in your textbook you have a question about or is it in an exercise ?

3. Mar 21, 2017

### Faiq

The density of a gas at a temperature of $273~K$ and a pressure of $1.02*10^5~ Pa$ is $0.9kgm^{-3}$. It may be asssumed to be an ideal gas.
Calculate rms speed at 273K and 546K.

For 273, we were supposed to use the given equation and for second we were supposed to used the ratio of mean square speed and temperature.
My thinking is the equation only applies for those temperature for which we are using the pressure values.

4. Mar 21, 2017

### Staff: Mentor

You are given pressure and density at 273 K and asked to calculate rms at exactly this temperature, I don't see where is the problem?

5. Mar 21, 2017

### Faiq

The confusion I had was why is that formula only applicable for the 273K. That's to say why I can't just put that value down for 546K? Later I realized, the pressure inserted in those equations are the indicator of what temperature should the RMS value be for.

6. Mar 22, 2017

### BvU

We're still missing context. Please be a bit more complete in formulating problem statements. This way we spend way too much time dragging out what is troubling you.
Missing:
2. Relevant equations

3. The attempt at a solution
Accidentally ? Or did you erase them ? That's a no-no in PF !

And anyway, 1. should probably have been
Any word or sentence missing from this full problem statement ? If no, then a list of all variables is good to have at hand. For you too.
What given equation ?

Did you do anything at all with the information that the gas can be considered an ideal gas ?

Where did the
come from ? From the text book or from the problem statement ? (or perhaps from the solution manual ?)

7. Mar 22, 2017

### Faiq

1. No words or sentences are missing.
2. The given equation is $p = \frac{1}{3}\rho<c^2>$
3. By telling us that it could be considered an ideal gas, permission was given to use the ideal gas law and the provided equation.
4. The formula was supposed to be derived by using the equation $pV = \frac{1}{3}Nm<c^2>$ and $\rho = \frac{Nm}{V}$

Btw my confusion has been sorted out. Thanks for the help though


text:
Organisations, environmental management and innovation

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Free course

# 2.11 Ecosystem services

You may already be familiar with the term ‘ecosystem services’. This very old notion maintains that humans derive certain ‘services’ from natural environments, such as drinking water, materials, food, air and so on. The history of ideas relating to ecosystem services is beyond the scope of this course, but it's important to be aware of it, as it does have some bearing on the way environmental issues are being understood by contemporary environmental managers within organisations. In many respects, the notion of ecosystem services is being claimed as an innovation in the way organisations try to make sense of their connections to the natural environment. Its increasing prevalence in policy means ecosystem services are an important aspect of environmental management.

In brief, ecosystem services are divided into four main categories, each resulting in some kind of service:

• Provisioning services: products obtained from ecosystems
• Regulating services: benefits obtained from the regulation of ecosystem processes
• Cultural services: non-material benefits, e.g. aesthetic and well-being, cognitive development, reflection, recreation
• Supporting services: necessary for the production of all other ecosystem services.

## Activity 23 Ecosystem services

Match the following examples of ecosystem services to the relevant category.

Using the following two lists, match each numbered item with the correct letter.

1. Water

2. Waste processing

3. Scientific discovery

4. Seed dispersal

• a.Regulating services

• b.Cultural services

• c.Supporting services

• d.Provisioning services

• 1 = d
• 2 = a
• 3 = b
• 4 = c

### Discussion

A few more examples are provided in the following table:

#### Table 3 Ecosystem services

 Category Examples of service Provisioning services (products obtained from ecosystems) foods of all typeswatermineralschemicals energy sources Regulating services(benefits obtained from the regulation of ecosystem processes) climate regulationwaste processingpurification of water and aircrop pollinationpest and disease control Cultural services(non-material benefits, e.g. aesthetic and well-being, cognitive development, reflection, recreation) cultural, intellectual, religious and spiritual inspirationrecreational experiences (including eco-tourism)scientific discovery Supporting services(necessary for the production of all other ecosystem services) nutrient dispersalseed dispersalprimary production
(Adapted from DEFRA, 2007, p. 11)

Attempts to assess impacts on ecosystem services have been gaining ground in recent years. One of the most ambitious is The Economics of Ecosystems and Biodiversity (TEEB) report (2013), which attempted to draw attention to the global extent of biodiversity loss.

## Reading 7 TEEB, 2013, pp. 7–13

Read the ‘Executive Summary’ (pp. 7–13) section of the TEEB report on biodiversity titled ‘Natural Capital at Risk [Tip: hold Ctrl and click a link to open it in a new tab. (Hide tip)] ’ (TEEB, 2013).

## Activity 24 The TEEB report

Focusing on the general aspects (rather than the detail), what are the main concerns about the use and pricing of ecosystem services by the organisations considered in the document? Summarise the recommendations for companies and governments.

To use this interactive functionality a free OU account is required. Sign in or register.
Interactive feature not available in single page view (see it in standard view).

### Discussion

The main concerns are that the depletion of and damage to ecosystem services are not being included in the pricing systems of organisations and products. Environmental costs are therefore ‘externalised’, particularly where regulation – a way of ensuring organisations take account or internalise environmental costs – is weak. Even where environmental costs are normally externalised, droughts or floods can cause rapid internalisation of costs through increased commodity prices. This can mean many organisations are exposed to environmental risks within their supply chain.

Although there are some modelling issues to consider, the study suggests that the currently unpriced cost of natural capital used (i.e. land use, water consumption, greenhouse gas emissions, air, land and water pollution, and waste) is approximately $7 trillion (at 2009 prices) and could be higher if all parts of the supply sector were included. Globally, greenhouse gas emissions from coal-fired power stations in East Asia, and cattle ranching and farming in South America, have the greatest environmental impacts accounting for natural capital costs of over$673 billion.

The report suggests that the consumer sector, in particular food and timber processing, as well as leather and hide tanning, are the sectors with supply chains most at risk from volatile environmental costs. This can affect consumers and suppliers in different countries and is prompting some organisations to develop close links with suppliers. The highest impacts are soybean and oil seed processing and animal production.

The report suggests risks to agricultural commodity prices are particularly notable because, overall, costs to natural capital exceeds revenue. However, organisations that seek to align business models with more sustainable use of natural capital in their supply chains should be able to be more competitive because of greater resilience to environmental impacts, reduced costs and improved security of supply.

The main recommendations for companies centre on developing better data on supply chain risks, internalising natural capital costs, improving resource efficiency in supply chains and exploring alternative suppliers. The recommendations for governments centre on understanding how risks to natural capital are distributed in the economy, understanding how natural capital costs could affect global competitiveness and developing policies for internalising costs to the economy.

The reading was quite challenging to summarise, but hopefully you have at least gained a sense of how the notion of ecosystem services can be used to convey economic costs – a language familiar to policy-makers and businesses.

However, you may also have noticed that ecosystem services place the emphasis on the services that arise from the item or thing itself and have less emphasis on the item itself. This suggests a rather anthropocentric view of the environment where something is not valued intrinsically, but rather by the service it provides. Critics have suggested the concept of ecosystem services remains within an economic language and economic framework, which had created the problems in the first place and led to understanding the environment as an ‘immense collection of service commodities’ (Robertson, 2012, p. 386). In other words, ecosystem services are a way of placing an economic valuation on environmental goods and services within a framework of economic growth as an indicator of well-being – a framework that increases pressure on the natural environment as part of trade-offs between development and the environment.

Thus, the extent to which ecosystem services represent an innovation in conceptualising and managing human–environment relations and the extent to which it can be used to foster innovations in development is subject to some debate, as is the extent to which ecosystem services are likely to be a helpful addition to the EIA. If we return to Ackoff, is the concept and practice of ecosystem services an example of doing the wrong thing righter? There are no immediate answers to the question, but this debate is discussed in Reading 8, part of a special issue on ecosystem services in the journal Environmental Impact Assessment Review.

## Reading 8 Baker et al., 2013, pp. 5–9

Read Sections 4 and 5 (pp. 5–9) of ‘Ecosystem services in environmental assessment – Help or hindrance?’ (Baker et al., 2013).

## Activity 25 Ecosystem services – help or hindrance?

Based on the research explored in the paper, what do the authors consider to be the main strengths and weaknesses of using ecosystem services in environmental assessment? Does the paper make any suggestions as to whether ecosystem services represent an innovation in environmental assessment approaches?

To use this interactive functionality a free OU account is required. Sign in or register.
Interactive feature not available in single page view (see it in standard view).

### Discussion

According to the authors, the main strengths of using ecosystem services in environmental assessment are:

• It allows for integration of bundles of services rather than ‘discrete’ environmental topics.
• The environment is described in terms of benefits rather than things that can help in communication and policy-making.
• Ecosystem services may resonate more easily with stakeholders and members of the public.
• The concept can avoid ‘either/or’-type arguments by emphasising environmental and economic benefits.
• Possible impacts of the environment on the plan or project subject to an EIA can also be considered using ecosystem services.
• The value of the environment is made explicit through ecosystem services.

Some weaknesses include:

• The language of ecosystem services may not connect with all stakeholders.
• Ecosystem services is conceptually complex.
• The legal framework of environmental assessment may be undermined by the contested nature of ecosystem services valuation.
• An ecosystem services assessment can be very resource intensive.
• The different plans, programmes or projects and institutional contexts may mean ecosystem services is irrelevant in some cases.

The extent to which ecosystem services represents an innovation is therefore debatable.

On one hand, it does bring the discussion of environment and economics into a single arena and allows new ways of thinking about the environment as a service provider. This leads to a monetary valuation, thereby allowing an environmental assessment to determine environmental costs.

On the other hand, it may just be another conceptual framing that continues the economic model of the environment as a resource and assumes the environment can be valued and costed. In any case, ecosystem services may not be appropriate to the particular context and situation.

Experience of ecosystem services in environmental assessment is still growing and commentaries are beginning to adopt more critical perspectives on ecosystem services (see Schröter et al., 2014).

However, some organisations are claiming they are using other innovative ways to make connections with the natural environment more explicit and more embedded in the life of organisations.

T319_1


text:
Graphs and Graph Terminologies

Background

We use graphs to represent many real-life entities. Consider a social network (as shown in Figure 1) where people can follow other people. This can be represented by a graph. Each people represents a vertex (or node) and the edge between two people tells the relationship between them in terms of following.

As we see in Figure 1, each person acts as a node in the graph. If a person A has an outgoing edge to person B, that means A has followed B. In Figure 1, Rita has followed Alice, Alice has followed Benjamin, John has followed Maria, Maria has followed John and so on.

Similarly, a graph can represent cities linked by roads. Figure 2 depicts this.

The nodes of the graph represent cities and an edge between two cities represent the road between them. If there is an edge between cities A and B that means they are connected by a road. Notice one extra information (length of the road) in the edge that was not present in the social network graph. This kind of graphs are called weighted graph and we will cover them later in the post.

Introduction

Formally, a graph $G = (V, E)$ is defined on a set of vertices $V$, and contains a set of edges $E$. An edge is a pair of vertices which can be ordered or unordered depending upon whether the edge is directed or undirected. Usually, a vertex is represented by a lower case $u$ or $v$ and an edge is represented by the pair of $u$ and $v$. A directed edge is written as an ordered pair $(u, v)$ while the undirected edge is written as an unordered pair $\{u, v\}$. Figure 3 depicts an example of a graph.

Types of graph

There are many flavors of graphs we use in computer science. We discuss some of them here.

Undirected and directed

A graph $G = (V, E)$ is undirected if edge $(u, v) \in E$ implies that edge $(v, u)$ is also in $E$. In simple English sentence, a graph is called undirected if the edge can be traversed from both of its endpoints. In the similar way, the graph $G$ is directed if edge $(u, v) \in E$ and edge $(v, u) \not \in E$. This is illustrated in Figure 4.

In a visual representation, undirected edges are drawn as a line segment and directed edges are drawn as a line segment with an arrow on one of the endpoints.

Weighted and unweighted

A weighted graph $G$ has a numeric value attached to its edges. We call this numeric value a weight of the edge. In Figure 2, the weight is the length of the road joining cities. The weight can represent varieties of things depending upon the application. In an electric circuit, weight can be the amount of current flowing through the wire. In a road network, weight can be the length of the road, speed limit or the difficulty level. Figure 5 illustrates this.

In computer science, a weighted graph is used heavily in the shorted path problems.

Simple and non-simple

A simple graph has no self-loops and no multi-edges. Self-loop is an edge going from a node to itself i.e. $(u, u)$. Multi-edge is the edge occurring more than one time between the same endpoints. A graph containing one or more self-loops or multi-edges is a non-simple graph. Figure 6 shows examples of these graphs.

Sparse and Dense

A graph can have a quadratic number of edges. If $V$ is the number of vertices in a graph, it can have up to $O(V^2)$ edges. A graph having edges in this order is called a dense graph (Usually). On the other hand, a graph having a fewer number of edges is called a sparse graph. If a graph has an edge between every pair of nodes, we call this graph a complete graph. Figure 7 illustrates a sparse and dense graph.

Cyclic and acyclic

A graph having no cycles is an acyclic graph. A tree is a connected acyclic graph. A directed graph with no cycles is called a Direct Acyclic Graph (DAG) and has many use cases in computer science including the scheduling problems. Scheduling algorithm like topological sorting requires the graph to be a DAG. A graph with one or more cycles is called a cyclic graph. Figure 8 depicts examples of Cyclic and Acyclic graph.

Terminologies

In this section, we discuss graph terminologies that you are most likely to encounter when studying about graphs.

1. The two vertices of an undirected graphs are called endpoints. In directed graph, we distinguish endpoints by calling them tail and head. For edge $(u, v)$, we call $u$ the tail and $v$ the head.
2. If $\{u, v\}$ is an edge in an undirected edge, we call $u$ the neighbor of $v$ and vice versa. The number of neighbors of a node is called the degree of the node.
3. If $(u, v)$ is an edge in a directed graph, we call $u$ a predecessor or in-neighbor of $v$ and $v$ a successor or out-neighbor of $u$. The in-degree of a node is the number of predecessors; the out-degree is the number of successors.
4. A graph $G’ = (V’, E’)$ is a subgraph of $G = (V, E)$ if $V’ \subseteq V$ and $E’ \subseteq E$.
5. In an undirected graph, a walk is a sequence of vertices, where each successive pair of vertices are adjacent. A walk is a path if it visits each vertex at most once.
6. For any two vertices $u$ and $v$ in a graph $G$, we say that $v$ is reachable from $u$ if $G$ contains a walk (and therefore a path) between $u$ and $V$.
7. An undirected graph is connected if every vertex is reachable from every other vertex.
8. A component is a maximal connected subgraph. Two vertices are in the same component if and only if there is a path between them.
9. A directed walk is a sequence of directed edges, where the head of each edge is the tell of the next.
10. A directed path is a directed walk without repeated vertices. Vertex $v$ is reachable from vertex $u$ in a directed graph G if and only if G contains a directed walk from $u$ to $v$.
11. A directed graph is strongly connected if every vertex is reachable from every other vertex.

References

1. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (n.d.). Introduction to algorithms (3rd ed.). The MIT Press.
2. Jeff Erickson. Algorithms (Prepublication draft). http://algorithms.wtf
3. Steven S. Skiena. 2008. The Algorithm Design Manual (2nd ed.). Springer Publishing Company, Incorporated.