text:
# Recovering private key from Secp256k1 signatures

I've seen many answers here and many articles that says we can recover the private key from reused R signatures. But, what if the r,s signatures are different in transaction of bitcoin then is there a way we could find the ephemeral Key k used in both the cases and find the private key?

• The r values of two signatures are equal iff the same k is used. If the same k is used, it's easy to recover the private key, otherwise not so much. – SEJPM Mar 26 '18 at 14:38
• @SEJPM I think if we could get 2 different k values then probably we should be able to get the private key from it... – Harvy Sam Mar 26 '18 at 15:06
• @HarvySam If you get even one k value, then you can recover the private key... But the point is that the value of k is concealed in the signature and can be deduced only if there is a misuse, like reusing twice the same k value. – Lery Mar 26 '18 at 15:17

## 2 Answers

In ECDSA, each signature has its own ephemeral key $k$. If $k$ is generated properly, then no amount of signatures will help you recover the private key. "Proper" generation here means either random uniform selection in the proper range, or an appropriate derandomization process such as the one described in RFC 6979.

If the very same $k$ value is used in two signatures, on two distinct messages, but with the same private key $x$, then the private key is revealed. This is the deadly mistake of Sony back in early 2011 (and the initial motivation for RFC 6979, btw). Indeed, if the two messages are $m_1$ and $m_2$, and both values use the same $k$ values, then the two signatures are $(r,s_1)$ and $(r,s_2)$: \begin{eqnarray} s_1 &=& (h(m_1) + xr) / k \\ s_2 &=& (h(m_2) + xr) / k \\ \end{eqnarray} The ephemeral key $k$, and the private key $x$, can then be computed as: \begin{eqnarray} k &=& \frac{h(m_1) - h(m_2)}{s_1 - s_2} \\ x &=& \frac{ks_1 - h(m_1)}{r} \\ \end{eqnarray}

If the values of $k$ are not reused, but are generated with some bias (i.e. not all values in the $[1,q-1]$ range are selected with the same probability), then the private key $x$ can still be recovered from a set of signatures. If for instance $q$ has size 256 bits, but values of $k$ are always lower than $2^{253}$ (i.e. the top three bits are always zero), then a few hundreds of signatures suffice.

If the values of $k$ are generated with a strong, cryptographically secure source, and with no bias, then there is no known attack against ECDSA that would recover the private key $x$, even if many signatures are known. The first reuse of $k$ out of pure back luck is expected to happen after an average of $2^{n/2}$ signatures for an $n$-bit curve, i.e. never in practice if you use a decent curve.

Also, in Bitcoin, people tend not to sign a lot with any given key. For privacy reason, address reuse is discouraged.

• You're too fast for a bear! Welp, I still posted my answer since I've worked on it for too long now ;) – Lery Mar 26 '18 at 15:42
• Bears actually run faster than humans. This is true on all terrain conditions, save maybe partially cooled lava, if the human wears protective boots but the bear does not. – Thomas Pornin Mar 26 '18 at 15:53

So, let me recall a few details about ECDSA:

An ECDSA signature is a pair of integers $(r,s)$.

In order to generate a signature for a given message $m$, a given hash function $H$, curve parameters $(\mathcal{C}, G, n)$ for $\mathcal{C}$ a curve, $G$ a base point of prime order $n$ of $\mathcal{C}$, a private key integer $d$ and a public key point $Q = d\times G$, one can:

1. Compute $e = H(m)$, where $H$ is a cryptographic hash function and let $z$ be the integer representing the leftmost bits of $e$, when $e$ is truncated to the bit length of the group order.
2. Pick uniformly at random a value $k$ where $0 < k < n-1$ ;
3. Compute the point $(x, y) = k G$ ;
4. Compute $r = x\,\bmod\,n$. If $r = 0$, go back to 2 ;
5. Compute $s = k^{-1}(z + r d_A)\,\bmod\,n$. If $s = 0$, go back to step 2.

Then, when one has signed the message $m$, one can transmit the tuple $(m, r,s)$ and anybody can verify the signature $(r, s)$ by performing the following steps:

1. Compute $e = H(m)$ and let $z$ be like in the signature process ;
2. Compute $w = s^{-1}\,\bmod\,n$ ;
3. Compute $u_1 = zw\,\bmod\,n$ and $u_2 = rw\,\bmod\,n$ ;
4. Compute the point $(x, y) = u_1 G + u_2 Q$.

If $r \equiv x \mod n$, then the signature is valid, otherwise it is invalid.

Note that ECDSA crucially relies on the uniqueness (just like in the PS3 fail), but also on the entropy used in the choice of $k$, since a bias there can also lead to private key recovery by an attacker having only public signatures at her disposal, see for example this paper [1].

Now, what happens actually when you have re-used twice the same $k$ value?

Let's assume you obtained two signatures for two distinct messages $m_1$ and $m_2$, then you have the two signatures $(r_1,s_1)$ and $(r_2,s_2)$ and the $s$-values are computed as in step 5 above. This means that you can easily recover the value of $k$ by computing:

$$k = (z_1 - z_2)(s_1-s_2)^{-1} \bmod{n}$$ where we are working with the inverse modulo the order of our curve. From $k$, it is easy also to compute the value of the secret integer $d$, with the help of any of the two signatures: $$d= (ks-z)r^{-1} \bmod{n}$$ Once this has been done, you can easily check you have recovered the private key by comparing the public key with the value of $d\times G$, since if you have the correct $d$, both will be the same.

Finally, notice that this is true for any instance of ECDSA, not only using Seco256k1.

## References

[1] De Mulder, Elke, et al. "Using bleichenbacher's solution to the hidden number problem to attack nonce leaks in 384-bit ECDSA." International Workshop on Cryptographic Hardware and Embedded Systems. Springer, Berlin, Heidelberg, 2013.


text:
# Dealing with Diabetes: The Road to Developing an Artificial Pancreas

 Difficulty Time Required Average (6-10 days) Prerequisites Some familiarity with electronic circuits and using breadboards would be helpful, though it is not required for this project. Completion of a basic chemistry class is also recommended before trying this project. Material Availability A pump and other electronics parts must be specially ordered to do this project. See the Materials and Equipment list for details. Estimated project time includes shipping of specialty components. Cost Average ($40 -$80) Safety Some parts of the circuit can get warm during normal operation. Do not leave the circuit operating when unattended. Be very careful with your wiring to prevent short circuits from happening; short circuits can get very hot and cause plastic parts of the circuit to melt.

## Abstract

Do you hate shots? Do you complain about paper cuts? Imagine if you had to give yourself shots a couple of times a day, as well as prick your finger, on purpose, even more frequently. Of course, if you have diabetes you do not have to imagine this; it is your reality. People who have diabetes usually need to keep close track of how much sugar is in their blood (called their blood glucose levels)by testing a drop of blood from a finger prick. If there is too much sugar in their blood, some diabetics take insulin shots to decrease it. However, it can also be dangerous to have too little sugar in a person's blood. Because of this, one area of intense research right now is on making an artificial pancreas, or basically a device that automatically adjusts a person's blood sugar levels. In this science project, you will build a circuit that has to face some of the same issues that an artificial pancreas does. How hard will it be to get the sugar levels in the blood just right? Get ready to build your own artificial pancreas to find out!

## Objective

Build a model of an artificial pancreas to investigate the challenges of getting such a device to work.

## Credits

Teisha Rowland, PhD, and Ben Finio, PhD, Science Buddies
Andrew J. Bonham, PhD, Metropolitan State University of Denver

### MLA Style

Science Buddies Staff. "Dealing with Diabetes: The Road to Developing an Artificial Pancreas" Science Buddies. Science Buddies, 10 Dec. 2014. Web. 29 Jan. 2015 <http://www.sciencebuddies.org/science-fair-projects/project_ideas/HumBio_p040.shtml>

### APA Style

Science Buddies Staff. (2014, December 10). Dealing with Diabetes: The Road to Developing an Artificial Pancreas. Retrieved January 29, 2015 from http://www.sciencebuddies.org/science-fair-projects/project_ideas/HumBio_p040.shtml

## Share your story with Science Buddies!

Last edit date: 2014-12-10

## Introduction

Scientists and engineers are often motivated to do their work in order to help people out. One area in which that motivation is readily apparent is in the field of biomedical engineering, where an intense focus of research right now is on creating better insulin pumps and an artificial pancreas. What is the purpose of these devices? Such devices would help eliminate the procedures that a person living with diabetes has to do, as well as remove the nearly constant health decisions they have to make. Specifically, the devices would help people with diabetes control how much sugar is in their blood. It is a daunting goal; the pancreas has a very complex biological role that has to be mimicked by a combination of electronics, chemistry, and biology. This project will allow you to explore some of the complexities engineers and scientists face as they strive to create an artificial pancreas.

First, let us step back for a moment and have a quick crash course (or a refresher if you are already familiar) on diabetes. The body uses a simple sugar, called glucose, as its primary fuel. We get glucose from the food we eat. Both table sugar (sucrose) and other types of carbohydrates, such as starch (found in large quantities in pasta and other grain-rich foods), are broken down by our bodies to make glucose.

Because food can be broken down to make glucose, the level of glucose in a person's blood—which is commonly referred to as the blood glucose level—usually goes up after he or she eats. See Figure 1, below, for typical blood glucose level fluctuations for a person over the course of a day. Note that blood glucose is typically measured in milligrams per deciliter (mg/dL).

Figure 1. This graph shows how a person's blood glucose levels may change over the course of a day, and how eating a meal with lots of sugar (sucrose) can affect blood glucose levels. The y-axis shows blood glucose levels (in mg/dL). (Image credits: adapted from a figure by Jakob Suckale, Michele Solimena, Wikimedia Commons, 2011)

Like most of the chemicals in your blood, glucose must be tightly controlled. The level of glucose in your blood is regulated by insulin, a hormone made by the pancreas. When blood glucose levels rise after eating a meal, the pancreas releases insulin, which causes cells in the body (such as liver, muscle, and fat cells) to take up glucose, removing it from the blood and storing it (as glycogen) to use for energy later. When the blood glucose levels start falling, the pancreas stops releasing insulin, and the stored glucose is used for energy. If blood glucose levels get too low, the pancreas may produce glucagon, a hormone that increases the levels. This process is how the pancreas and the hormones it produces are in charge of regulating blood glucose levels. Watch this video to see how blood glucose levels can change over time for different people.

This video shows how blood glucose levels change over time for people with and without diabetes (Khan Academy, 2011).
This video shows how blood glucose levels change over time for people with and without diabetes (Khan Academy, 2011). http://www.youtube.com/watch?v=JSFiOF7xGfE

However, in people with type 1 diabetes (which is caused by an autoimmune response, and was formerly known as juvenile diabetes), the pancreas no longer makes insulin. If left untreated, the blood glucose levels of a person with type 1 diabetes could be dangerously high, which is a condition called hyperglycemia. In type 2 diabetes—which is thought to be primarily caused by obesity, and makes up the vast majority of diabetes cases—a person has insulin resistance, which means their body does not respond to insulin, or their pancreas does not make enough insulin. Currently, a person with type 1 diabetes (and some with type 2 diabetes) must take insulin supplements to treat the condition.

While the solution for many diabetics is to take insulin, it is not that simple; many things have an effect on insulin levels in a person's body, including exercise, stress, what and how much they eat, just to name a few. And having blood glucose levels that are too high (hyperglycemia), or too low (hypoglycemia), can cause serious health problems. This leaves many type 1 diabetes patients constantly checking their blood glucose levels, calculating how their actions will change their levels, and adjusting their insulin doses to avoid a critical high or low. To get a sense of the effort involved, watch this video.

This video shows how Molly lives with Type 1 Diabetes.
This video shows how Molly lives with Type 1 Diabetes. http://www.youtube.com/watch?v=_t6-2CVwDCU

As previously discussed, to take away the difficulties of managing type 1 diabetes, scientists and engineers have set out to create improved insulin pumps and an artificial pancreas. Diabetics who take insulin supplements take them in the form of insulin injections (using a needle) or infusions using an insulin pump, like the one shown in Figure 2, below. However it is a done, currently a person who takes insulin must closely monitor his or her blood glucose levels to determine when, and how much, insulin to take. Insulin pumps are typically small, about the size of a cell phone, and the system usually includes a continuous glucose sensor that detects the amount of glucose in the person's blood and an electronic interface that is told how much insulin to give to the person. To see what it is like to use an insulin pump and continuous glucose sensor to manage type 1 diabetes, you can check out the video in the article by D. Grau in the Bibliography, below.

Figure 2. This picture shows an insulin pump attached to a person's body to infuse specific amounts of insulin.

Currently, auto-correcting (i.e., automatic) insulin pumps—which are also called artificial pancreases—automatically administer the right amount of insulin; however, they are unavailable to diabetics. But the idea of such a device is very promising and is an area of much active research. The video below will give you a basic understanding of the goals of an artificial pancreas and the path to making one, but because this is a rapidly progressing field, you should do your own internet search to see what the current status of the research is.

This video shows what research is being done to create an artificial pancreas.
This video shows what research is being done to create an artificial pancreas. http://www.youtube.com/watch?v=bOMtXCp_MCU

Now that you have a better understanding of type 1 diabetes and what an artificial pancreas is, you may be wondering how you can work on something like that for a science fair project. In this project, you will get to find out by building a simplified model of an artificial pancreas system and investigating the challenges of getting such a device to work. Clearly, blood, insulin, and glucose are not readily available for a science project, but you can use other components to mimic some of the interactions and start designing and fine-tuning a model of an artificial pancreas. To do this, you will use some chemistry and create an electrical circuit. Specifically, you will use acid/base chemistry, where an acidic solution represents high blood glucose levels, and a more neutral solution represents normal blood glucose levels in your model. A conductivity sensor will represent the glucose sensor, and control whether a pump in the electrical circuit turns on or not. When the solution is very acidic, the conductivity sensor will make the electrical circuit run a pump. The pump will move a basic solution, which represents insulin, into the acidic solution to neutralize it. When the acidic solution becomes more neutralized, the conductivity sensor will make the circuit stop powering the pump. This represents high blood glucose levels being lowered by the addition of insulin, until the glucose levels are normal and no more insulin needs to be added to the bloodstream. Figure 3, below, helps summarize the important information, and shows how the artificial pancreas model you will make in this project is similar to, and different from, a real artificial pancreas.

Figure 3. This flowchart shows how an artificial pancreas would work (on the left) and how those steps are similar to what is done in the model used in this project (on the right).

How acidic or basic a solution is, is measured by a scale called pH. For example, an acidic pH is below 7, such as lemon juice or vinegar. A basic pH is above 7, such as baking soda or bleach. A neutral pH is about 7, which is what water typically has. For a refresher on these topics, see the Science Buddies page on Acids, Bases, & the pH Scale.

In your artificial pancreas model, the acid/base chemical reaction that will be taking place is shown in Equation 1, below. A solution of vinegar (acetic acid, or CH3COOH), which is an acid, will represent high blood glucose levels, and a solution of baking soda (sodium bicarbonate, or NaHCO3), which is a base, will represent insulin. When acids and bases (like vinegar and baking soda, respectively) are mixed, a chemical reaction occurs (shown in Equation 1) that produces water (H2O) and bubbles of carbon dioxide gas (CO2). When equal amounts of base and acid are mixed together, the solution is neutralized. Keep in mind that this is not the reaction that occurs when insulin is added to change the blood glucose levels in a person! You are using these chemicals as substitutes in your model since baking soda and vinegar are easy-to-obtain household materials.

Equation 1:

So how does the acidity of a solution control whether an electrical circuit runs a pump? It has to do with the fact that acidic solutions are fairly conductive, which means that they can conduct electricity, or allow electrical current to flow through them. (Conductive materials also have lower electrical resistance.) Neutral solutions, on the other hand, are much less conductive (i.e., they have a higher resistance), so it is much harder for electrical current to flow through them. Because of this conductive difference, an electrical sensor can be made that can detect if a solution is acidic or neutral. Specifically, in the artificial pancreas model you build in this project, a conductivity sensor is made from two metal wires (or electrodes) that are a certain distance apart in the solution. The more conductive the solution is, the more electrical current can flow through it from one electrode to the other. If the solution is not conductive at all, no current will flow.

When enough electrical current travels through the conductivity sensor, it causes a transistor in the circuit to activate a pump. A transistor is an electrical component that acts like a switch; if the transistor receives a high enough voltage, it can allow electrical current to travel through a different path of the circuit. In the circuit you will build for this project, the transistor will be connected to a pump so that when enough current flows through the conductivity sensor, it outputs a high voltage to the transistor, which allows current to flow through the pump and make it run. If there is not enough current going through the sensor, the pump will not run. Figure 4, below, gives an overview of how this works.

Lastly, the conductivity sensor is combined with another electrical component called a potentiometer, which is a type of adjustable resistor. You will be adjusting the potentiometer in your model to control when the pump turns on. The conductivity sensor and the potentiometer together make up what is called a voltage divider, and this is technically what lets the conductivity sensor send the high voltage to the transistor to make the pump turn on. For a detailed explanation of how the circuit works, including a circuit diagram, see the FAQ section.

Figure 4. This diagram shows how the circuit works. When the solution has a neutral pH, the sensor outputs a low voltage, so the transistor does not let any current flow through the pump. When the solution has a high pH, the sensor outputs a high voltage, which activates the transistor, causing current to flow through the pump, which then pumps liquid.

For more information on electronics and related terms (such as voltage, current, and resistance), see the Science Buddies Electronics Primer: Introduction.

Do you think it will be difficult to get the artificial pancreas to stop when it is supposed to, when the right amount of baking soda solution has been added to the vinegar solution? How accurate can the model be made to be? How are the challenges encountered when making this model similar to the challenges that engineers who are trying to make a real artificial pancreas system would face? Try this project to find out!

## Terms and Concepts

• Sugar
• Glucose
• Blood glucose levels
• Insulin
• Type 1 diabetes
• Hyperglycemia
• Type 2 diabetes
• Insulin pump
• Continuous glucose sensor
• Artificial pancreas
• Electrical circuit
• Acid/base chemistry
• pH
• Acid
• Base
• Neutral
• Vinegar
• Baking soda
• Conductive
• Current
• Resistance
• Conductivity sensor
• Electrode
• Transistor
• Voltage
• Potentiometer
• Bus strips

### Questions

• How do blood glucose levels typically change after a person eats a meal?
• What causes hypoglycemia and hyperglycemia?
• In what situations might a person with diabetes take an insulin shot?
• What do the different parts of the artificial pancreas model in this project represent in a real artificial pancreas system? How is the model different from the real thing? How is it similar?
• In this project, how do the electrodes control whether the pump is running?

## Bibliography

Here are some useful resources on diabetes, blood glucose levels, insulin pumps, and artificial pancreases:

These resources will give you some background information on acids, bases, pH, and conductivity:

You can check out these resources if you are just starting out with electronics:

## News Feed on This Topic

, ,
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

## Materials and Equipment

Note: The electrical specifications of certain components—especially the MOSFET (a type of transistor)—are important for the circuit to work properly. We recommend purchasing the exact parts from Jameco, listed below, unless you are confident that you can find appropriate parts with equivalent specifications.

• Solderless breadboard; available from Jameco, manufacturer #WBU-301-R
• 330 kΩ resistor; available from Jameco, manufacturer #CR1/4W334JRC
• 100 kΩ resistor; available from Jameco, manufacturer #CR1/4W104JRC
• Jumper wire kit; available from Jameco, manufacturer #WJW-70B-5
• N-channel MOSFET; available from Jameco, manufacturer #STP16NF06L
• 1 MΩ potentiometer; available from Jameco, manufacturer #18STS105
• Alligator clip test leads (4); available in 2-packs from Jameco, manufacturer #GAL02
• Battery holder for 8 AA batteries with wires; available from Jameco, manufacturer #BH-383-A
• AA batteries (8); available from Jameco or many other suppliers
• 24 AWG bare copper wire; available from Jameco, manufacturer #24BC

These items may be special ordered from Amazon or other suppliers:

• 12 V peristaltic liquid pump. The pump needs metal leads to connect alligator clips to it. A suitable pump is available from Amazon.com.
• Tubing that works with the pump is also needed. The pump from Amazon.com includes tubing, but other pumps may not. You will need at least 40 cm of tubing.
• Digital scale with 0.1 g increments. A digital scale that would be suitable is the Fast Weigh MS-500-BLK Digital Pocket Scale; available from Amazon.com.
• Graduated cylinder, 100 mL or 250 mL; available from Amazon.com.
• Alternatively, a metric measuring cup could be used.
• If you are using a graduated cylinder, you will also want to have a funnel that fits with the top of the graduated cylinder.
• Optional: pH test strips; available from Amazon.com and aquarium pet stores.

These items may be found around your home or purchased locally:

• Piece of Styrofoam® (at least 4 cm × 7 cm); this could be part of a Styrofoam take-out container, or a small Styrofoam block.
• Bendable plastic drinking straw
• Scissors; in addition to cutting Styrofoam and a plastic straw, you will also need to cut some copper wire. Because of this, you will need a pair of scissors that you do not mind denting, or you could use a pair of wire cutters.
• Ruler, metric
• Baking soda (at least 90 g)
• Measuring cup or other small container to use for weighing baking soda on the scale
• Distilled white vinegar (at least 1 L)
• Distilled water (at least 1.2 L); available at your local grocery store.
• Mixing bowls (at least 3). Two will need to be able to hold at least 400 mL, or 0.5 quarts, each.
• Masking tape and a permanent marker for labeling bowls. Alternatively, small sticky notes and a pen or pencil could be used.
• Permanent marker
• Optional: Tape
• Lab notebook

Disclaimer: Science Buddies occasionally provides information (such as part numbers, supplier names, and supplier weblinks) to assist our users in locating specialty items for individual projects. The information is provided solely as a convenience to our users. We do our best to make sure that part numbers and descriptions are accurate when first listed. However, since part numbers do change as items are obsoleted or improved, please send us an email if you run across any parts that are no longer available. We also do our best to make sure that any listed supplier provides prompt, courteous service. Science Buddies does participate in affiliate programs with Amazon.com, Carolina Biological, and AquaPhoenix Education. Proceeds from the affiliate programs help support Science Buddies, a 501( c ) 3 public charity. If you have any comments (positive or negative) related to purchases you've made for science fair projects from recommendations on our site, please let us know. Write to us at scibuddy@sciencebuddies.org.

## Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.
Note Before Beginning: This science fair project requires you to hook up one or more devices in an electrical circuit. Basic help can be found in the Electronics Primer. However, if you do not have experience in putting together electrical circuits you may find it helpful to have someone who can answer questions and help you troubleshoot if your project is not working. A science teacher or parent may be a good resource. If you need to find another mentor, try asking a local electrician, electrical engineer, or person whose hobbies involve building things like model airplanes, trains, or cars. You may also need to work your way up to this project by starting with an electronics project that has a lower level of difficulty.

### Assembling the Circuit on the Breadboard

In this part of the procedure, you will be assembling the electronic components to make a circuit using a breadboard. A breadboard allows you to quickly and easily connect wires and electronic components in order to build a circuit. The connections are not permanent, so you can easily move things around if you make a mistake.

1. Take a look at the breadboard before you begin. Become familiar with its layout.
1. The breadboard you have should look like Figure 5, below.
1. Note: Other types of breadboards can be used, but directions are provided here only for the type shown in Figure 5. If you use a different type, you may need a person with electronics experience to show you how to use it for this project.
2. Note that the breadboard has 30 rows (labeled 1–30), 10 columns (labeled A–J), and 4 bus strip columns (two red and two blue).
1. The bus strips (also called power buses) supply power to the electronic components connected to the breadboard. The red columns supply the power, while the blue columns are the ground. You do not need to understand the details of this to do this science project, but you can explore the resources in the Bibliography in the Background tab if you want to learn more.

Figure 5. Picture of the breadboard used in this project (left) and a diagram of an empty breadboard (right).
1. Insert one of the leads (metal wire ends) of the 330k Ω resistor into hole B1 (under the column labeled "B" in the row labeled "1") and the other wire into the left-side red bus strip, as shown in Figure 6, below.
1. Note: You will be using two resistors in this project. Each resistor has four bands of color on its main body. The 330 kΩ resistor has the bands orange, orange, yellow, and gold. The 100 kΩ resistor has the bands brown, black, yellow, and gold. (The orientation of the resistor in the breadboard does not matter.)

Figure 6. Insert the 330k Ω resistor into holes B1 and the left-side red bus strip.
1. Insert the leads of the 100k Ω resistor into hole C1 and the left-side blue bus strip, as shown in Figure 7, below.
1. Safety note: Be sure the leads of the resistors are not touching. When you connect the batteries to the circuit later, this could short the circuit.

Figure 7. Insert the 100k Ω resistor into hole C1 and the left-side blue bus strip.
1. Take a small piece of jumper wire (the black pieces from the jumper kit from Jameco are a good length) and insert the ends of the wire into hole A5 and the left-side blue bus strip, as shown in Figure 8, below.
1. Note: Any color jumper wire from the kit will work the same. The different colors just help distinguish different lengths.

Figure 8. Insert a short piece of jumper wire (black here) into hole A5 and the left-side blue bus strip.
1. Insert the MOSFET so that its three leads go into holes B5, B6, and B7, as shown in Figure 9, below. Orient it so that the smaller black-coated side is facing towards the right, and the large metal tab is facing to the left.

Figure 9. Put the MOSFET into holes B5, B6, and B7, with the black side facing to the right (where the higher-lettered columns are).
1. Take a piece of jumper wire that is about half the length of the breadboard (the red pieces from the jumper kit are a good length) and insert the ends of the wire into holes A7 and A25, as shown in Figure 10, below.

Figure 10. Insert a piece of jumper wire (red here) into holes A7 and A25.
1. Insert the three pins of the potentiometer (which is blue with a white knob) into holes B24, B25, and B26, as shown in Figure 11, below.
1. Note: It does not matter in which direction the potentiometer is facing.

Figure 11. Insert a potentiometer (blue and white) into holes B24, B25, and B26. Note that the potentiometer only has three pins, even though its blue plastic casing takes up more than three rows on the breadboard.
1. Take a small piece of jumper wire (the black pieces from the jumper kit are a good length) and insert the ends of the wire into hole A26 and the left-side blue bus strip, as shown in Figure 12, below.

Figure 12. Insert a piece of jumper wire (the black bottom wire here) into holes A26 and the left-side blue bus strip.
1. Next, connect the peristaltic metal pump to the breadboard.
1. First, connect alligator clips to the metal leads of the peristaltic pump, as shown in Figure 13, below. Connect one alligator clip to each metal lead.
2. Connect the other end of each alligator clip test lead to the breadboard. One lead should go into hole E6, and the other should go into the left-side red bus strip.
1. Depending on the type of alligator clip test leads you have, you may connect the test leads to the breadboard in different ways. If the other end of the test lead is a wire (as shown with the top pump wire in Figure 13), then you can put it directly in the breadboard hole. If the other end of the test lead has an alligator clip (as shown with the bottom pump wire in Figure 13), then you will need to attach it to a short jumper wire piece, and insert that wire into the breadboard hole.
2. It does not matter which test lead goes into which holes. The orientation will only affect which direction the pump pumps liquid in.

Figure 13. Attach the peristaltic pump to the breadboard by using the alligator clip test leads to connect the pump to hole E6 and the left-side red bus strip. (Note that the pump is not drawn to scale in the diagram on the bottom right.)
1. Now connect two more alligator clip test leads to the breadboard. Connect the end of one to hole E1, and the end of the other lead to hole C7, as shown in Figure 14, below.
1. The other ends of both leads should remain unconnected for now; these will connect to the electrodes that you will use for the conductivity sensor.

Figure 14. Connect two more alligator clip test leads to the breadboard, putting the end of one in hole E1 and the end of the other in hole C7. Note that only the ends of the leads are shown in the picture on the left.
1. Lastly, connect the battery holder to the breadboard by putting the end of the holder's red wire in the left-side red bus strip and the black wire's end in the left-side blue bus strip, both in the bottom row, as shown in Figure 15, below.

Figure 15. Connect the battery holder to the breadboard (in the bottom row) by putting the holder's red wire in the left-side red bus strip and the black wire in the left-side blue bus strip. (Note that the pump and battery pack are not drawn to scale in the diagram on the right.)
1. Put 8 AA batteries into the battery holder. Make sure each battery is oriented correctly, with the "+" and "-" ends of each battery going the correct direction (i.e., line up the "+" symbols on the batteries with the "+" symbols on the battery holder).
2. The circuit has now been assembled on the breadboard! Your assembled breadboard circuit should look similar to the one in Figure 16, below.

Figure 16. Your assembled circuit on the breadboard should look similar to this one. Note that the ends of the wires going off of the top left part of the picture should not be connected to anything yet; they will be connected to a conductivity sensor in the next part of the procedure. (Note that the pump and battery pack are not drawn to scale in the diagram on the right.)

### Making the Conductivity Sensor

In this part of the procedure, you will make a conductivity sensor and connect it to your breadboard circuit. The sensor will be made using bare copper wire, a straw, scissors, and a small piece of flat Styrofoam.

1. Cut out a small segment of plastic straw, about 6 centimeters (cm) long.
1. If possible, one end of the segment should have the ridged, bendable part of the straw on it; this will help keep the wire on the sensor.
2. Take a spool of bare copper wire and cut two pieces that are about 15–16 cm long each. Note: Cutting the wire with scissors may dent the scissors, so use a pair of scissors that may be alright to dent, or use a pair of wire cutters.
3. Wrap the end of each copper wire tightly around the straw, looping it about four times with each wire, as shown in Figure 17, below. Wrap the wires about 4 cm apart from each other on the straw, and leave the wires with tails that are about 6 cm long (or longer) each.
1. The wire should be wound tightly around the straw so that the wire does not easily slide around on the straw. If the wires move much, they could change the amount of conductivity detected by the sensor.
2. However, even if the wires do move some, this should be fixed when you add the Styrofoam piece next.

Figure 17. Wrap the ends of two copper wires around a segment of straw, making about four loops with each wire.
1. Next, cut out a piece of flat Styrofoam that is about 4 cm × 7 cm.
2. Carefully poke the copper wire tails from the straw through the Styrofoam piece, keeping the wires the same distance apart that they are on the straw piece, as shown in Figure 18, below. Place the Styrofoam about 1–2 cm above the straw.

Figure 18. Push the copper pieces through a small rectangle of Styrofoam.
1. On the top side of the Styrofoam (opposite the side where the straw is), make a sharp bend in each wire, right above the Styrofoam, as shown in Figure 19, below. Make sure the bend is sharp enough to keep the wires from sliding down through the Styrofoam.
1. The sensor will be going into a bowl of liquid, and the amount of copper wire submerged in the liquid can change how much conductivity the sensor detects. Because of this, it is important that the amount of wire submerged in the liquid is always the same. Since Styrofoam floats, the Styrofoam piece will help keep the wires submerged at the same depth in the liquid for your tests.

Figure 19. Make sharp bends in each wire, just above the Styrofoam on the side without the straw.
1. Lastly, attach the unconnected alligator clip leads from your circuit to the copper wires on the sensor, as shown in Figure 20, below. It does not matter which clip is connected to which wire.

Figure 20. After attaching the alligator clips to the copper wires, the conductivity sensor should look like the one here.
1. Your artificial pancreas model circuit is now complete and ready for testing! It should look similar to the one shown in Figure 21, below.

Figure 21. The complete insulin pump circuit should look similar to this one. (Note that the pump and battery pack are not drawn to scale in the diagram on the right.)

### Testing the Artificial Pancreas Model

In this part of the procedure, you will test your artificial pancreas model. You will do this by first normalizing it to a neutralized solution to make sure the pump will turn off once your solution is neutralized. You will then put the conductivity sensor in an acidic solution (i.e., pure vinegar), which will make the pump move a basic solution (i.e., a solution of baking soda) into the bowl of acidic solution until the solution is neutralized and turns off the pump.

1. Take three mixing bowls and label them "Neutralized," "Vinegar," and "Baking Soda."
1. For labeling, you can use masking tape and a permanent marker or small sticky notes and a pen or pencil.
2. On a scale, place a measuring cup or other small container to weigh baking soda on the scale. Zero out the scale and then weigh out 28.6 grams (g) of baking soda.
3. Put the 28.6 g of baking soda into the mixing bowl labeled "Baking Soda."
4. Use the graduated cylinder, or a metric measuring cup, to measure out 400 milliliters (mL) of distilled water. Add the 400 mL of distilled water to the baking soda in the mixing bowl.
5. Mix the water and baking soda until the baking soda is completely dissolved.
1. Optional: If you want to see what the pH of the baking soda solution is, you can measure it now using pH test strips and record it in your lab notebook.
6. Measure out 100 mL of the baking soda solution and add this to the mixing bowl labeled "Neutralized."
1. Tip: You may want to use a small cup with a spout to transfer the baking soda solution.
7. Measure out 100 mL of distilled white vinegar and very slowly add it to the "Neutralized" bowl.
1. Caution: Mixing an acidic solution with a basic solution can cause a powerful chemical reaction. You must pour the vinegar into the bowl very slowly to give the two solutions time to slowly react, otherwise you may end up with a big mess and will need to make up fresh solutions!
2. What happens as you pour the vinegar into the baking soda solution? Can you explain why this is?
3. Once the reaction has slowed, slowly mix the solution to make sure the vinegar and baking soda have completely reacted.
4. Note: The amounts of vinegar and baking soda you are using are the same. Because of this, the acid and base should react and neutralize the solution. If you want to see the math behind this, check out the FAQ section in the Help tab.
1. Optional: If you want to see what the pH of the neutralized solution is, you can measure it now using pH test strips and record it in your lab notebook. Note that the pH will not be 7, but may be closer to 6, because of buffering effects of the solutions.
8. Measure out 200 mL of distilled white vinegar and carefully pour it into the "Vinegar" bowl. Take the tubing from the pump and place both ends in the "Vinegar" bowl.
1. Optional: If you want to see what the pH of the vinegar is, you can measure it now using pH test strips.
9. Once the vinegar-baking soda solution stops reacting, the solution should be neutralized. Carefully place your conductivity sensor in the "Neutralized" bowl, letting the straw part be submerged and the Styrofoam piece float on the surface, as shown in Figure 22, below. Your overall setup should now look similar to the one in Figure 23, below.
1. If the Styrofoam piece is not floating evenly, you can try taping the test leads onto the rim of the mixing bowl to keep things in place.

Figure 22. Place the conductivity sensor in the neutralized solution so that the Styrofoam piece floats and the straw part with wrapped wire is submerged.

Figure 23. When you are equilibrating the artificial pancreas circuit in a neutralized solution, your setup should look like this one.
1. The pump may start running as soon as you put the conductivity sensor in the neutralized solution, but do not worry if the pump is not running yet. (When the pump runs, vinegar should simply be pumped out of, and then back into, the "Vinegar" bowl.) In this step, you will normalize your artificial pancreas model so that the pump does not run in a neutralized solution, but still runs in a solution that is slightly more acidic (which will be more conductive). You will do this by adjusting the potentiometer (the blue component with the white knob that you put in holes B24, B25, and B26).
1. Remember that a potentiometer is a variable resistor; you can change its resistance by turning the white knob. When you change the resistance of the potentiometer, this affects how much voltage is sent to the transistor, which controls whether the pump is turned on or not. If you want to find out more about how this works (it involves forming a voltage divider with the conductivity sensor), try re-reading the Introduction in the Background tab and check out the FAQ section in the Help tab.
2. If the pump is not running, slowly and gently turn the white knob on the potentiometer until the pump turns on. Try turning it all the way clockwise and all the way counter-clockwise find out which way turns the pump on (which way you need to turn it will depend on which way you put the potentiometer into the breadboard).
3. Once the pump is running, very slowly turn the potentiometer's knob in the opposite direction to turn the pump off. Stop turning the knob when it is just reaches the point that makes the pump turn off. You can play around with adjusting the knob until you are satisfied that the pump does not run in the neutralized solution (but will still run if turned slightly).
1. While you are adjusting the potentiometer, identify which pump tube has liquid flowing out of it. When the pump is not running, dry the end of this tube and mark it with a small dot using a permanent marker. This will help you in the next step when you need to pump a liquid into a different bowl.
4. Safety note: Do not leave the pump running unattended, and do not let the circuit run for more than about 15 minutes at one time. Note that the transistor may become warm while the pump is running, but it should not become dangerously hot. If it is very hot, or if you notice any smoke or a burning smell, this probably means that you have a short circuit. Immediately disconnect the battery pack from the breadboard, and make sure that everything else is connected correctly by referring to the diagrams above. Just one misplaced wire can prevent the circuit from working, or create a short circuit! Remember to make sure that the exposed metal parts of different components, like the resistors and alligator clips, are not bumping into each other, as this will also create a short circuit.
5. Note: If the pump does not turn on, no matter how you turn the potentiometer's knob, check the following:
1. Make sure all of the jumper wires and components are pushed firmly into the breadboard's holes. A single loose wire can prevent the circuit from not working.
2. Make sure no exposed metal parts (like the leads of the resistors) are touching each other, as this will create a short circuit.
3. Be especially careful to avoid creating a short circuit by having wires from the red and blue bus strips touch each other. This can make the circuit get dangerously hot and can even melt some of the plastic components.
2. Once you have normalized your artificial pancreas model so that the pump does not run when the conductivity sensor is in a neutralized solution, carefully remove the conductivity sensor from the neutralized solution (leaving the pump's tubes in the "Vinegar" bowl), and rinse the sensor briefly with some vinegar (over a sink or a different bowl). This will help remove the neutralized solution from the sensor.
3. Now leave the pump tube that you marked in step 10.c.i. (the outlet tube) in the "Vinegar" bowl. Take the other pump tube (the unmarked, inlet tube), wipe the outside down with a paper towel or clean rag, and then place it in the "Baking Soda" bowl.
4. Next, place the conductivity sensor in the "Vinegar" bowl. Your setup should look like the one in Figure 24, below. The pump should start running, pumping baking soda solution (a drop or a few drops at a time) into the bowl of vinegar, and you should see bubbles being made as the acid-base reaction takes place.
1. Note: Make sure the sensor is floating the same way that it was in the neutralized solution. If needed, tape the alligator clip test leads to the side of the bowl to hold them in place so that the Styrofoam piece is floating evenly. It is very important to make sure that the sensor is submerged in the liquid to the same depth that it was in the neutralized solution or your results may be inaccurate.

Figure 24. When you are neutralizing the vinegar solution with baking soda, this is what the setup should look like.
1. While the pump is running, carefully and continually move the end of the pump tube in the "Vinegar" bowl so that the baking soda mixes well with the vinegar throughout the bowl (including under and around the sensor). It is very important to have all of the baking soda and vinegar mixed together to neutralize the vinegar solution.
2. Eventually, the pump should slow down and then stop running. It might turn on and off as you mix the last bits of baking soda that is pumped in; if it does this, wait until it stops running for at least 10 seconds before moving on to the next step.
1. Optional: If you want to see what the pH of the solution in the "Vinegar" bowl is now (it should be neutralized), you can measure it using pH test strips and record your results in your lab notebook. How does the pH now compare to the pH of the neutralized solution you used in step 7?
3. When the pump stops, measure how much baking soda solution is left in the "Baking Soda" bowl by carefully pouring it into a metric measuring cup or a graduated cylinder using a funnel. In your lab notebook, record how much baking soda solution is remaining.
1. Note: There may be more liquid in the bowl than can fit in the measuring cup or graduated cylinder, so you may need to fill it up (and empty it out) multiple times to measure the total amount of baking soda.
4. Analyze your results and determine how accurate this artificial pancreas model is.
1. Since the baking soda solution you prepared is at the same concentration as the vinegar, they should make a neutralized solution when the same amount of each have been mixed together. This means that 200 mL of vinegar should be neutralized with 200 mL of baking soda solution. (If you want to see the math behind this, check out the FAQ section in the Help tab.)
2. Because the "Vinegar" bowl had 200 mL of vinegar (from step 8) and the "Baking Soda" bowl had 300 mL of baking soda solution (since you prepared 400 mL in step 4, but removed 100 mL in step 6), the pump should have ideally stopped when 100 mL of baking soda was remaining in its bowl. How close were the results (from step 16) to 100 mL baking soda solution? Was there too much or too little baking soda remaining?
3. There are many reasons why it may not have taken exactly 200 mL of baking soda solution to neutralize the 200 mL vinegar solution. Here are some possible sources of error, but you may think of additional ones:
1. The circuit may not have been accurately normalized (in step 10).
2. The potentiometer might have been bumped during testing.
3. Some extra vinegar may have been added to the "Vinegar" bowl from rinsing the conductivity sensor.
4. Liquid from either bowl may have been spilled during testing.
5. The baking soda solution was not stirred enough while it was being added to the "Vinegar" bowl. If this happens, the conductivity sensor may still detect an acidic solution, even though parts of the solution in the bowl have been completely neutralized (or may even be basic).
6. Mistakes in preparing the baking soda solution should not actually be a source of error. Do you know why this is?
7. Note: Because pH reactions occur on a logarithmic scale, the error measurements can be on a logarithmic scale, too. This means that a margin of error that may seem large (such as having 150 mL baking soda leftover instead of 100 mL) is actually not that big. See the Help tab for details.
8. Think about how each possible source of error may have affected your results.
5. Plan how you could change your model and/or your testing procedure to make the model more accurate. Whatever you decide to change, be sure to record your plans in your lab notebook. Specifically, think about:
1. What could you physically change about your circuit, conductivity sensor, or experimental setup? For example, could you improve the stability of your sensor if it was moving around, or build a new sensor with some changes to the design?
2. What could you change about the procedure you used when doing the experiment? For example, could you somehow stir the solution in the "Vinegar" bowl more evenly while the pump is on and pumping in baking soda solution?
3. Tip: You may want to refer to The Engineering Design Process guide for help with this.
6. Clean and dry the mixing bowls and repeat steps 1–17 to test your model again, with the changes you decided on in step 18, and analyze its results. How accurate was it this time?
1. Note that this model may not necessarily be more accurate than the original model. This is part of the challenge of the engineering design process.
7. If you want, you can change your model and/or testing procedure even more by repeating steps 18–19 one or more times. Can you make the model be even more accurate?
8. You can make a bar graph of your results, with a bar for each time you tested the model (labeled on the x-axis) that shows how much vinegar remained when testing each time (labeled on the y-axis in mL). You can draw a horizontal line across the graph at the "100 mL" point to show the ideal amount of baking soda left.
9. Optional: If you took pH measurements, you can analyze those results as well.
1. How much did the pH of the vinegar solution change by the addition of the baking soda?
2. Was the pH of the original neutralized solution the same as the pH of the solution when the pump stopped running?
3. See the FAQ in the Help tab for more information on pH and this project.
10. Overall, how well did the artificial pancreas model work? Were you able to improve on the original one you tested? How are the challenges you faced in designing this model similar, and different, to the challenges faced in designing a real, accurate artificial pancreas?
1. Tip: You may want to refer to the Introduction in the Background tab to help you answer this last question.

### Troubleshooting

For troubleshooting tips, please read our FAQ: Dealing with Diabetes: The Road to Developing an Artificial Pancreas.

## Variations

• In the testing you did for this project, you should have found that the artificial pancreas model could be automated for the part you tested. In other words, when the solution is very acidic (representing high blood glucose levels), the pump turns on and adds a basic solution (representing insulin) to neutralize the solution (representing normal blood glucose levels). However, you did not test how the model works for other parts of an artificial pancreas, such as continuing to add insulin when the blood glucose levels are consistently high over time. Try adding more vinegar to the "Vinegar" bowl after it is neutralized; does it turn the pump back on again? Does pumping in more baking soda solution turn the pump back off? If you repeatedly add vinegar, does it have the same effect? You could measure the amounts of vinegar and baking soda that are added over time and graph your results. How responsive is the model to turning the pump on and off?
• Some people may want an artificial pancreas to turn on and pump insulin when they have a specific, different blood glucose level compared to other people. You could try modeling this by making solutions with different amounts of baking soda solution and vinegar mixed together (instead of equal amounts, as you use in this project) and then normalize the artificial pancreas model to the different solutions, one at a time (each one representing a different person). How does this affect how much baking soda solution is used to neutralize the vinegar? How does this relate to the challenges of making a real artificial pancreas?
• How could you use the artificial pancreas model you made in this project to model the delivery of other types of medicines? Do some research on this topic and then try it out.
• How could you make the artificial pancreas model used in this project more similar to what a real artificial pancreas would be like? Do some research and then try to redesign your model.
• In what other ways could you use the conductivity sensor that is used in this project? Would it make the pump run if it was put in other solutions, such as a sports drink? For some ideas, check out the Science Buddies science project idea Electrolyte Challenge: Orange Juice Vs. Sports Drink.
• For an advanced chemistry challenge, instead of the chemical reaction used in the artificial pancreas model in this project, you could try using a different chemical reaction. Here are some ideas:
• You could look into doing a titration (which is typically a color-changing reaction that depends on the exact chemicals involved). A Science Buddies project idea that uses the titration method is Which Orange Juice Has the Most Vitamin C?
• Alternatively, you could use cabbage juice, which changes color based on the pH of the solution. For information on how to make this pH indicator solution, check out the Science Buddies project idea Cabbage Chemistry.
• For science projects on measuring sugars in foods and relating this to diabetes, see How Sweet It Is! Measuring Glucose in Your Food, Sucrose & Glucose & Fructose, Oh My! Uncovering Hidden Sugar in Your Food, and Lactose, Sucrose, and Glucose: How Many Sugars are in Your Smoothie?

## Share your story with Science Buddies!

Q: The pump will not run. What should I do?
A: If your pump is not running at all, there are several troubleshooting steps you can try:
• Double-check your circuit to make sure that it matches the breadboard pictures and descriptions from the Procedure exactly (in the "Assembling the Circuit on the Breadboard" section).
• Make sure all of your jumper wires and other components are pressed firmly into the holes of the breadboard.
• Make sure your batteries are properly inserted into the battery pack.
• Turn the potentiometer all the way clockwise and then all the way counterclockwise.
• If none of the above steps work, try putting fresh batteries into the battery pack.
Q: How does the circuit work?
A: The circuit relies on two key components: a voltage divider and a MOSFET. We will talk about the voltage divider first. The voltage divider is made from two resistors (R1 and R2) connected in series. Figure 25, below, shows the circuit diagram for a voltage divider. It takes an input voltage (Vin) and outputs a different voltage (Vout). This is done according to Equation 1, below (which can be derived based on Ohm's law).

Figure 25. Circuit diagram for a voltage divider.

Equation 1:

• Vin is the input voltage in volts (V).
• Vout is the output voltage in volts (V).
• R1 is the first resistance in ohms (Ω).
• R2 is the second resistance in ohms (Ω).

In your circuit, the conductivity sensor (two wires wrapped around a straw) is the first resistor (R1), and the potentiometer is the second resistor (R2). As you can see from Equation 1, both resistance values have an effect on the output voltage. To help you understand Equation 1, try plugging in a few examples:

• What happens when R2 is much bigger than R1? In other words, R1 is very small, meaning the solution is highly conductive? (Answer: Vout will be approximately equal to Vin)
• What happens when R1 is much bigger than R2? In other words, R1 is very large, meaning the solution is not very conductive? (Answer: Vout is close to zero)

Now let us talk about the second important component of the circuit, a special type of transistor called a MOSFET. (MOSFET stands for metal-oxide-semiconductor field-effect-transistor.) A MOSFET has three pins: the gate, the source, and the drain, as shown in Figure 26, below. The MOSFET is controlled by a voltage applied to the gate pin. When the voltage between the gate and source pins (VGS) is below the MOSFET's threshold voltage (Vth), no current flows through the MOSFET. When VGS is above the threshold voltage, current can flow from the drain to the source pin. When it is connected to an external load, like a motor or a pump, this means a MOSFET can be used to electronically turn the load on and off, without flipping a mechanical switch.

Figure 26. Left: A picture of a MOSFET with the pins labeled. Center: If the gate voltage (VGS) is below the threshold voltage (Vth), no current flows. Right: If the gate voltage is above the threshold voltage, current flows from the drain to the source.

How are these components combined to form the circuit in this project? Figure 27, below, shows the complete circuit diagram (refer to this How to Read a Schematic resource if you are not familiar with circuit diagrams). The circuit operates like this:

• The battery pack provides 12 V to power the circuit. This is necessary because the pump is rated for 12 V.
• The 330 kΩ and 100 kΩ resistors form a fixed voltage divider. This is a crude way of stepping down the 12 V from the battery pack to a lower voltage—in this case, approximately 3 V (the proper way to do this is with something called a voltage regulator). This approximately 3 V is used to power the next part of the circuit (see the next bullet point).
• Another alternative to using these resistors would be to simply hook up a separate 2xAA battery pack to the circuit to provide 3 V, but the approach used in this project lets the whole circuit run off of one battery pack.
• Note: This lower voltage is required because the threshold voltage of the MOSFET is rather low, around 1–2 V. Powering the entire circuit from 12 V would therefore make it very difficult to turn the pump off.
• The conductivity sensor and potentiometer form another voltage divider. The input to this voltage divider (Vin from Equation 1, above) is roughly 3 V, as described in the previous point. The output (Vout from Equation 1, above) is based on the resistance values of the conductivity sensor (which depends on the pH of the liquid) and the potentiometer (which depends on the position of the knob). This is what allows you to tune the circuit's sensitivity to pH levels using the potentiometer.
• The output of the second voltage divider is connected directly to the gate of the MOSFET. The source pin of the MOSFET is connected to ground. This means that the output from the voltage divider is equal to the gate voltage of the MOSFET (Vout = VGS). Therefore, the output of the voltage divider controls whether or not the MOSFET conducts current between its drain and source pins.
• The pump is connected to the positive voltage supply and the MOSFET's drain pin. As a result, when the MOSFET turns on (because its gate voltage is above the threshold voltage), current flows through the pump and causes it to pump liquid. When the MOSFET is off (because its gate voltage is below the threshold voltage), no current can flow through the pump, so the pump shuts off.
• Ultimately, this configuration means that the pH of the liquid controls whether the pump turns on or off.

Figure 27. A complete circuit diagram for the artificial pancreas model.
Q: Why does 200 mL of vinegar become neutralized when mixed with 200 mL of the baking soda solution used in this project?
A: In this project, you made a baking soda solution with the same concentration, or molarity, as the vinegar so that when equal amounts of vinegar and the baking soda solution are mixed, it makes a neutralized solution. Vinegar generally has a molarity of 0.85 moles/liter (mol/L, or M). To make 400 mL of a solution with a molarity of 0.85 M, there should be 0.34 mol in the solution, since 0.85 mol/L = (0.34 mol)/(0.4 L). Baking soda has a formula mass of 84 grams/mole (g/mol). To get 0.34 mol of baking soda, 28.6 g of it is needed, since 84 g/mol X 0.34 mol = 28.6 g.
Q: Why is my neutral pH not pH 7?
A: In this project, you are mixing a weak acid (vinegar) and a weak base (baking soda) to create a neutralized solution. However, both vinegar and baking soda influence the pH value they will reach when present in equal concentrations and when they are neutralized, called the equivalence point. In distilled water (which itself is slightly acidic), this equivalence point should be between pH 5 and pH 6.
Q: Since pH reactions occur on a logarithmic scale, how does this affect the error in my results?
A: Because pH is the negative logarithm of the concentration of hydrogen ions ([H+]) in a solution (as shown in Equation 2, below), this means that pH reactions change logarithmically. This means that pH error measurements can also be on a logarithmic scale, which can create a margin of error that may seem large (such as having 150 mL of baking soda leftover instead of 100 mL) but that is actually not that large a margin.

Equation 2:

pH = - log [H+]

Additions of acids or bases cause a change in the concentration of hydrogen ions in the solution, which causes an equivalent change in pH. You can calculate the relative change in pH by using Equation 2, but instead of [H+] you can use the moles of baking soda you added. For example, in this project you used 0.340 moles (mol) of baking soda in 400 mL of solution (see the third FAQ question, above, for these calculations), so in 100 mL of baking soda solution there is 0.085 mol (since 0.34 mol ÷ 4 = 0.085 mol) and in 150 mL of baking soda solution there is 0.128 mol. The negative logarithm of 0.085 mol equals 1.071 pH units, while the negative logarithm of 0.128 mol equals 0.893 pH units. This gives a difference of 0.178 pH units (since 1.071 - 0.893 = 0.178), which is a more accurate representation of your error, and is much smaller than a difference of 50 mL (which is from 150 mL - 100 mL).

For more information on logarithms and pH, see the University of Minnesota's webpage on What is a logarithm?, Elmhurst College's webpage on pH Scale, and Science Buddies' resource on Acids, Bases, & the pH Scale.

The Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

## If you like this project, you might enjoy exploring these related careers:

### Certified Diabetes Educator

Who does a diabetic turn to if they have questions or do not understand how to manage their disease? They consult a certified diabetes educator. These diabetes experts work with people who have diabetes (or pre-diabetes) so they know how to manage their condition. This can include educating people about how to measure and control their blood sugar levels, giving specific diet and exercise recommendations, and providing emotional support. Certified diabetes educators present health information in ways that their audience can relate to, and are sensitive to cultural differences. Read more

### Electrical & Electronics Engineer

Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more

### Chemist

Everything in the environment, whether naturally occurring or of human design, is composed of chemicals. Chemists search for and use new knowledge about chemicals to develop new processes or products. Read more

### Dietitian or Nutritionist

Ever wondered who plans the school lunch, food for patients at a hospital, or the meals for athletes at the Olympics? The answer is dietitians and nutritionists! A dietitian or nutritionist's job is to supervise the planning and preparation of meals to ensure that people—like students, patients, and athletes—are getting the right foods to make them as healthy and as strong as possible. Some dietitians and nutritionists also work to educate people about good food choices so they can cook and eat their own healthy meals. Read more

## News Feed on This Topic

, ,
Note: A computerized matching algorithm suggests the above articles. It's not as smart as you are, and it may occasionally give humorous, ridiculous, or even annoying results! Learn more about the News Feed

## Looking for more science fun?

Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.

format: plain


text:
Why does the proof of Myers and Steenrod fail in the Lorentzian case?

This is my first question on this site. I hope it is not inappropriate on MO.

Myers and Steenrod proved 1939 that the isometry group of a Riemannian manifold is a lie group. I add a picture where Kobayashi describes the base idea of this proof.

Now I read in the book "Recent trends about lorentzian geometry" the following: (The reference [6] is Myers and Steenrod).

Sadly the author doesn't give more details. Can anyone tell my why this particular proof of M&S does not work for Pseudo-Riemannian manifolds?

EDIT: Maybe this will clear things up a bit.

(1) My questions is NOT about why theorem 1 (on page 278) fails for Lorentzian manifolds. (Theorem 1 is: If $(M,g)$ is a compact Riemannian manifold, then $Iso(M,g)$ is compact.)

(2) I know that the theorems provided by Kobayashi in his book "Transformation groups in differential geometry" can be applied to Lorentzian manifolds as well (e.g. Thm 5.1). So I wonder why this specific proof of M&S only works for Riemannian manifolds.

• mathoverflow.net/questions/141417/… – Carlo Beenakker Oct 22 '16 at 18:34
• @CarloBeenakker: Thanks for the link. I read that question before I wrote mine and I also read the proof of Kobayashi where he embeds the isometry group in the bundle of orthonormal frames as a closed submanifold. I know that this works for Pseudo-Riemannian manifolds too. So I wondered why the original proof from Myers and Steenrod doesn't. – JS. Oct 22 '16 at 18:42
• I just took a look in this book you mention, "Recent trends about lorentzian geometry" ", I presume you are referring to the article "On the Isometry Group of Lorentz Manifolds". There it says that the theorem that fails in the Lorentzian case is "If (M,g) is a compact Riemannian manifold, then Iso(M,g) is compact." --- which seems an altogether different kettle of fish. If this is not the paper you had in mind, perhaps a more specific pointer will help. – Carlo Beenakker Oct 22 '16 at 19:31
• Yes this is the paper I had in mind, but I refer to the introduction on page 278, where the author says "We point out that Iso(M,g) has a Lie group structure when considered with the compact-open topology. For Riemannian metrics, this has been established (long ago) in [6]. However, the techniques employed there do not generalize to semi-Riemannian metrics." (The reference [6] is Myers and Steenrod). – JS. Oct 22 '16 at 21:00
• What you refer to is theorem 1 on the same page. This is a direct conclusion of the embedding into the bundle of orthonormal frames as closed submanifold. Is $(M,g)$ Riemannian and compact then the orthonormal frame bundle is compact since it has the orthogonal group as fibers which is compact. However this is not true in general for Pseudo-Riemannian manifolds. But my question does not refer to this theorem. – JS. Oct 22 '16 at 21:09


text:
# auto.arima vs corARMA: AR coefficient greater than 1

Using R and the nlme package, I tried to fit a gls model with a corARMA correlation structure, but ran into memory issues. As described in this post, I thought I would first fit an lm model, estimate the correlation structure of the residuals using auto.arima, and use the coefficients estimated by auto.arima in the corARMA function, in the hope that this would require less memory.

Here are the auto.arima results:

Series: res3
ARIMA(4,0,1) with zero mean

Coefficients:
ar1      ar2     ar3      ar4      ma1
1.3134  -0.3002  0.0089  -0.0442  -0.7908
s.e.  0.0274   0.0187  0.0131   0.0114   0.0260

sigma^2 estimated as 0.01523:  log likelihood=10807.6
AIC=-21603.2   AICc=-21603.19   BIC=-21557.09

So, in the gls call, I used:

correlation = corARMA(value = c(1.3134, -0.3002, 0.0089, -0.0442, -0.7908)
,form = ~date, p = 4, q = 1, fixed = TRUE)

But I get the following error:

Error in corARMA(value = c(1.3134, -0.3002, 0.0089, -0.0442, -0.7908),  :
parameters in ARMA structure must be < 1 in absolute value

So why is it that parameters in the corARMA call must be $< 1$ in absolute value whereas auto.arima can return parameters $> 1$?
What would be the best way to estimate the correlation structure before fitting the gls model?

• The ARMA process needs to be stationary. It can't be stationary with an AR term greater than one. My advice: plot, plot, plot. – Jim Apr 30 '18 at 10:11
• Post your data. – Tom Reilly May 4 '18 at 18:00

I used the same strategy and I had exactly the same issue. It seems that parameters > 1 are possible for explosive time series. For the parameter that should be > 1 from your auto.arima results, try to set it to 0.99 in your GLS model without using the argument fixed = TRUE. The model will use the value that you provide as starting value and should finally adjust it to a value similar to your results from auto.arima.


text:
1. ## Trig integral help

Hi
how to integrate this:

integral ((sin(x))^2/ sec(x)) dx)

what i did was:
1/sec(x) = cos(x)
let u = sin(x)
du = cos(x)
u^2 = sin(x)^2
integral of u^2 du
= 1/3u^3

is that right?

2. Yes.

3. Looks good; remember that you've not finished, though! When you substitute, you have to remember to revert back to the form of the question. The original problem is in terms of x, not u, so your answer needs to be in terms of x.

Anyway, here's how I would solve this:

$\displaystyle\int\frac{sin^2(x)}{sec(x)}dx$

$=\displaystyle\int Sin^2(x)Cos(x)dx$

Are you aware that $\displaystyle\int f'(x)f(x)^n = \frac{f(x)^{n+1}}{n+1} + C$? This is derived from using the chain rule in reverse.

If you're not, then stick with substitution for now, but this is a lovely place to apply this rule because:
$f'(x)=Cos(x)$
$f(x)=Sin(x)$
$n=2$

So you literally just have to substitute into the formula with no difficult work required at all.

$\displaystyle\int Sin^2(x)Cos(x)dx = \frac{Sin^3(x)}{3} + C$

4. Thank you very much. I wasn't aware of that chain rule..rule.

5. Hmm for some reason my assignment shows the solution as wrong.

Maybe because it's (sin(x))^2?
I thought that would be the same thing as sin^2(x) however so I'm not sure why its complaining.

Edit: The integral is part of a bigger question as shown above. I'm supposed to solve that differential equation. The left side is already done for me and i had to do the right. I'm pretty sure thats how I had to solve it?

6. Originally Posted by Kuma
Hmm for some reason my assignment shows the solution as wrong.

Maybe because it's (sin(x))^2?
I thought that would be the same thing as sin^2(x) however so I'm not sure why its complaining.

Edit: The integral is part of a bigger question as shown above. I'm supposed to solve that differential equation. The left side is already done for me and i had to do the right. I'm pretty sure thats how I had to solve it?
Separating variables gives

$\displaystyle \int ye^{-y}dy=\int \sin^2(\theta)\cos(\theta)d\theta$

Using parts on the left and what you did before gives

$-ye^{-y}-e^{-y}=\frac{\sin^3(\theta)}{3}+C$ or

$-(y+1)e^{-y}=\frac{\sin^3(\theta)}{3}+C$

7. Originally Posted by TheEmptySet
Separating variables gives

$\displaystyle \int ye^{-y}dy=\int \sin^2(\theta)\cos(\theta)d\theta$

Using parts on the left and what you did before gives

$-ye^{-y}-e^{-y}=\frac{\sin^3(\theta)}{3}+C$ or

$-(y+1)e^{-y}=\frac{\sin^3(\theta)}{3}+C$
thanks! I figured out the mistake. Was supposed to divide out the -1 from the left side to make the right negative.


text:
# How many tangent half-angle formulas are there?

\begin{align} \tan \frac{\alpha+\beta} 2 & = \frac{\sin\alpha+\sin\beta}{\cos\alpha + \cos\beta} \tag 1 \\[10pt] \tan \left( \frac \pi 4 \pm \frac \alpha 2 \right) & = \sec\alpha \pm \tan\alpha \tag 2 \\[10pt] \frac{1 + i\tan\frac\alpha2}{1-i\tan\frac\alpha2} & = e^{i\alpha} \tag 3 \\[10pt] \tan\frac\alpha2\cdot\tan\frac\beta2 = \tan\frac\gamma2 & \text{ if and/or only if } \left|\frac{\cos\alpha+\cos\beta}{1+\cos\alpha\cos\beta}\right| = \left|\cos\gamma\right| \tag 4 \end{align} All of these relate tangents of half angles to trigonometric functions of whole angles.

Are there other tangent half-angle formulas essentially different from these? And how does one decide whether they're essentially different? (I'm not sure I would count the case of $(1)$ in which $\alpha=0$ as essentially different. One could make a case that $(1)$ is not essentially different from $(2)$. We're all accustomed to the mapping $(x,y)\mapsto \dfrac{x+y}{1-xy}$ in connection with tangents, but $(4)$ relates tangents to $(x,y)\mapsto\dfrac{x+y}{1+xy}.$)

For $\alpha+\beta+\gamma=\pi$, \begin{align} \tan\tfrac\alpha2\,\tan\tfrac\beta2\tan\tfrac\gamma2 &= \frac{\cos\alpha+\cos\beta+\cos\gamma-1}{\sin\alpha+\sin\beta+\sin\gamma}. \end{align}

Edit

Some more

\begin{align} \tan\tfrac\alpha2\,\tan\tfrac\beta2\tan\tfrac\gamma2 &= \frac{2\sin\alpha\sin\beta\sin\gamma}{(\sin\alpha+\sin\beta+\sin\gamma)^2} \\ &= \frac{\sin2\alpha+\sin2\beta+\sin2\gamma}{2(\sin\alpha+\sin\beta+\sin\gamma)^2} \end{align}

\begin{align} \cot\tfrac\alpha2+\cot\tfrac\beta2+\cot\tfrac\gamma2-(\tan\tfrac\alpha2+\tan\tfrac\beta2+\tan\tfrac\gamma2) &= 2(\cot\alpha+\cot\beta+\cot\gamma) \end{align}

• Cute. My first guess is that this is closely related to the identity that says $$\text{if } \alpha + \beta + \gamma = \pi \text{ then } \sin(2\alpha) + \sin(2\beta) + \sin(2\gamma) = 4\sin\alpha\sin\beta\sin\gamma$$ and that I'd verify that in seconds if I weren't doing something else right now. But I could be wrong$\,\ldots\qquad$ – Michael Hardy Oct 14 '16 at 22:12
• The other well known "conditional" trigonometric identity seems to be $$\text{if } \alpha+\beta+\gamma = \pi \text{ then } \tan\alpha \tan\beta \tan\gamma = \tan\alpha + \tan\beta + \tan\gamma.$$ – Michael Hardy Oct 14 '16 at 22:15

I don't know if the following are essentially different, but

$$\cot(x/2)=\cot(x)+\csc(x)$$

and hence

\begin{align} \tan(x/2)&=\frac{1}{\cot(x)+\csc(x)}\\\\ &=\frac{\sin(x)}{\cos(x)+1}\\\\ &=\frac{1-\cos(x)}{\sin(x)}\\\\ &=\csc(x)-\cot(x) \end{align}

Here's a fragment of an answer. I found this derivation in G. H. Hardy's Divergent Series. $$1 + e^{i\theta} + e^{2i\theta} + e^{3i\theta} + \cdots = \frac 1 {1-e^{i\theta}},$$ The identity above holds if $|e^{i\theta}|<1$ but the series diverges of $\theta$ is real.

Therefore \begin{align*} & \sin\theta + \sin2\theta+ \sin3\theta + \cdots = \operatorname{Im}\frac 1 {1-e^{i\theta}} = \operatorname{Im} \frac{1- e^{-i\theta}}{2-2\cos\theta} \\[10pt] = {} & \frac{ \sin\theta }{2-2\cos\theta} = \frac 1 2 \cot\frac\theta2. \end{align*} $$\text{If } \operatorname{Re}\theta>0 \text{ then } \sin\theta + \sin2\theta+ \sin3\theta + \cdots = \frac 1 2 \cot\frac\theta2.$$ $$\text{or if you like } \frac 1 {2(\sin\theta + \sin2\theta + \sin3\theta + \cdots)} = \tan\frac\theta2.$$ If $\theta$ is real, this doesn't converge in the usual sense, but perhaps it converges in the sense of some "summation method".


text:
# ESP8266 Flashing Problem-A fatal error occurred: Timed out waiting for packet header

I have been having some issues with flashing the firmware to my ESP8266 wifi module.I am using Linux OS and using the method illustrated Here to flash the the esp8266. The following are the connections between the esp8266 and FTDI board:

  FTDI (Rx)<--ESP(Tx)
FTDI(Tx) -->ESP(Rx)
Common ground between the FTDI, ESP and external 3.3 power supply.
ESP(GPIO0)-->Ground (While Flashing)
ESP(CH_PD)-->VCC (3.3V)

I have researched online and have verified all my connections to be fine. But some observations I have made are as follows:

1. The ESP does not respond to any AT commands or display any garbage data on the serial monitor, when restarted with the GPIO 0 pin connected to ground.

2. The ESP responds to AT command as OK and works fine while displaying some garbage data followed by "ready" on the serial monitor, when powered up with the GPIO 0 pin floating.

3.Shows ERROR for the command AT+CIOBAUD?

1. Have also read that, there are some duplicate FTDI hardwares floating around in the market and online stores, that may be one of the reasons for this flashing problem.

Coming to the problem i.e. whenever I try to flash the esp8266 using the esptool.phy, the flashing begins and at around 8% to 12%, it gets stuck displaying the error

 A fatal error occurred: Timed out waiting for packet header

I have stated my observations above, so that it would be easy for the fellow members to address the issues with the flashing. Looking forward to response from people who have faced, solved, encountered or have any opinions/suggestions regarding this problem.

Try -b 57600

This will take time but flash it fine:

python esptool.py -b 57600 -p /dev/ttyUSB0 write_flash 0x000000 "firm0.bin"

• Welcome to EE.SE! If you're providing instructions for commands to use, please consider using the code formatting using either the  key for fixed-width formatting` or indenting by 4 spaces in a paragraph for multi-line code. – user2943160 Jul 12 '16 at 23:00
• Counterfeit FTDI chips cant be used for flashing firmware. I don't know if you have tried it with that. Between this issue is long solved, like I have mentioned in my answer. – PsychedGuy Jul 14 '16 at 6:05
• My ESP 12F won't query/program at anything other than 115200 (any other baud rate results in connection failure) - any idea why this might be the case? – davidA Aug 7 '17 at 1:21

The problem is fixed. As a last resort, I decided to try flashing the firmware with a different serial to usb converter as suggested by some folks online. So I bought the CP2102 Serial to USB converter from amazon and this worked!!!. So, the problem was with the FTDI hardware, I believe it was a dupe and could not handle transfer at high baud rates. I hope this answer may help someone in the future facing the same issue, trying to flash firmwares using the fake FTDI hardwares.


text:
# Hölder's inequality with three functions

Let $p,q,r \in (1,\infty)$ with $1/p+1/q+1/r=1$. Prove that for every functions $f \in L^p(\mathbb{R})$, $g \in L^q(\mathbb{R})$,and $h \in L^r(\mathbb{R})$ $$\int_{\mathbb{R}} |fgh|\leq \|f\|_p\centerdot \|g\|_q \centerdot\|h\|_r.$$

I was going to use Hölder's inequality by letting $1/p+1/q= 1/(pq/p+q)$ and WLOG let $p<q$ so that $L_q(\mathbb{R})\subseteq L_p(\mathbb{R})$, but I cannot use this inclusion because $\mathbb{R}$ does not have finite measure.

-

The rough idea is to show a series of inequalities: $$\int|fgh|\leq\|fg\|_{p'}\|h\|_r\leq\|f\|_p\|g\|_q\|h\|_r$$ where $p'=\frac{pq}{p+q}$ or $\frac{1}{p'}=\frac{1}{p}+\frac{1}{q}$ or $1=\frac{1}{p/p'}+\frac{1}{q/p'}$.

First we show that $\|fg\|_{p'}\leq \|f\|_p\|g\|_q$. This is easy since $$\|fg\|_{p'}=\left(\int|fg|^{p'}\right)^{\frac{1}{p'}}\leq(\|f^{p'}\|_{p/p'}\|g^{p'}\|_{q/p'})^{\frac{1}{p'}}=\|f\|_p\|g\|_q,$$ where we apply the Holder's inequality (it is permissible since $|f|\in L^p(\mathbb{R})$, thus $|f|^{p'}\in L^{p/p'}(\mathbb{R})$). As a result, $|fg|\in L^{p'}(\mathbb{R})$. Apply Holder's inequality again, we get the first inequality in far above. Hope this will help you.

-

We can use a generalized AM-GM inequality to deduce that if $1/p+1/q+1/r=1$, then

$$abc\le\frac{a^p}{p}+\frac{b^q}{q}+\frac{c^r}{r}$$

for nonnegative $a,b,c$. Let $a=|f(x)|/\|f\|_p,\,b=|g(x)|/\|g\|_q,\,c=|h(x)|/\|h\|_r$, and then integrate both sides of the inequality over $\mathbb{R}$ to obtain

$$\frac{\|fgh\|_1}{\|f\|_p\|g\|_q\|h\|_r}\le\frac{1}{p}+\frac{1}{q}+\frac{1}{r}=1.$$

Multiply out and you have Holder's inequality for three functions.

-


text:
# What exactly is an integral?

1. Dec 6, 2009

### zeromodz

Like could any natural number like 5 have an integral from negative infinity to positive infinity? Also what exactly does the derivative of something means? I am kind a beginner to calculus.

2. Dec 6, 2009

### Integral

Staff Emeritus
Basically an integral computes the area between a function and a coordinate axis.

x=5 is a perfectly good function. Its integral is 5x. If you evaluate this between the origin and say 5, the answer is 25 or the area of a square with side 5. If you attempt to find the area of a rectangle which has an infinite side you will also find it has an infinite area.

The derivative of a function gives the slope at any point.

These are really way to big of questions to be answered on a Internet forum, you need to refer to a calculus text to get the best information.

3. Dec 7, 2009

### kab

Hi:
1) The integral symbol is actually the letter “S” for “SUM” that has been elongated.
2) Q: If it is a “SUM” what is it that I’m adding?
A: What you are adding is an infinite number of dx, dy, dz, etc. where dx, dy, dz are infinitely small. So, if you add dx1+dx2+dx3+dx4+….. to infinity you should get “X” thus integral dx = X ( plus the constant of integration).

3) The integral operates on the differential (dx, dy, dx) and not on numbers. Unless these are in your equations, the problem is undefined.
EX:
Integral 5 is undefined
Integral X is undefined
Integral 5X is undefined

Integral 5dx is defined
Integral Xdx is defined
Integral 5Xdy is defined

4) The integration is defined only on the Real and Imaginary number systems (as far as I know) and is not defined on the Natural, Integer, etc. This is because the Natural, Integer number systems do not have the density property and continuous functions cannot be defined there. Remember every Natural number is also a member of the Real number system.

I hope the helps.
KAB

4. Dec 7, 2009

### mikeph

think of the discrete sum as:

SUM (from i=0 to n) of [f(x)*1].

that's what it is, you re sampling f(x) at integer values of x, and multiplying each value by the distance between samples, 1, to give you the area under a step-approximation to the function f(x).

Now think about SUM(i=0, 0.5, 1, 1.5, ..., n-0.5, n) of [f(x)*0.5]

That is a better approximation to the area under the curve, because you're using twice the number of samples. The integral is the limit of this to infinity.

INT(from 0 to n) of f(x) dx = limit as δx-->0 of SUM(i=0, δx, 2δx, ... n-δx, n) of [f(x)*δx]

Basically you're adding an infinite number of infinitely thin blocks, to get an exact value for the area underneath. And the principles of calculus shows that the integral of f(x)*dx is the antiderivative of f(x), so you use the same rules as differentiation but backwards.

You can write down any function to integrate, but in some cases it won't make sense. In the case you suggest, f(x) = 5, it is simple and the area underneath is infinite for your stated domain.

The derivative is the slope of the tangent line to the curve.


text:
# 19!

It is given that $$19!$$ equals $\overline{121\, 645\, 100\, 408\, abc\, 000}.$
Determine the value of $$\overline{abc}$$.

Details and assumptions:

• $$\overline{abc}$$ means $$100a + 10b + 1c$$, as opposed to $$a \times b \times c$$. As an explicit example, for $$a=2, b=3, c=4$$, $$\overline{abc} = 234$$ and not $$2 \times 3 \times 4 = 24$$.
×


text:
Study guide and 4 practice problems on:

## A plane is specified by a point and a normal vector

To specify a plane, we need a point $\mathbf{x_0}$ and a normal vector $\mathbf{n}$.
A plane with normal vector $\bfn$ is given by $$\bfn\cdot \bfx = b$$ for some $b$.
The plane going through $\bfx_0$ with normal vector $\bfn$ is given by $$\bfn \cdot \bfx = \bfn \cdot \bfx_0.$$


text:
Let's say we're trying to control the speed of a motor to 20 revs/sec, and we know that our controller output for that speed is approximately 5. We currently have a Proportional controller to drive the motor to our 20 revs/sec setpoint, with some steady-state error.

If we included Feedforward but tuned it poorly, such that it outputs 2 instead of 5, will the following error still be less than it would have been with only the Proportional controller?

I would think that for Feedforward to reduce the steady-state error, the output would need to be able to drive the motor closer to the setpoint than the Proportional controller could do by itself (without unacceptable oscillations). Is this the case?

Your intuition is right as a feedforward term always helps the PID do its job, which in this case means that the steady-state error is lower.

We could have practical proof of this.

Imagine that in your example the effort value to get $$20$$ rev/s amounts to $$6$$, for which the steady-state error $$e$$ is thus $$0$$ rev/s.

Therefore the static gain of the process under control is $$G_0=20/6$$.

In the condition where we have a pure proportional controller with gain $$K$$, we can derive the following: $$K \cdot \left( 20 - 5 \cdot G_0\right) = 5.$$ It comes out that the gain is $$K = 3/2$$, which is responsible for a steady-state error $$e=3.33$$ rev/s.

Now, let's plug the feedforward term delivering an effort $$u_{ff}=2$$: $$K \cdot \left(20 - (u_{ff} + u_{fb}) \cdot G_0) \right) = u_{fb}.$$

It turns out that $$u_{fb}=10/3$$ and the error is $$e=2.22$$ rev/s, which is lower.


text:
# Multiple interfaces in a new proxy server, but physical or virtual?

At the moment, user devices have multiple IPs if they need to access multiple services.

All devices are physically connected into to the same switched network. I know it's bonkers and am pleased to say it had nothing to do with me.

I am introducing a pair of servers, to act as router/proxy/firewall/vpn, replacing a lot of existing archaic infrastructure.

I've reached a point where I can either do this:

# using physical ports
eth0 - 10.0.0.0/24     # The main network, dhcp'd user devices live here.
eth1 - 172.16.0.0/24   # a couple of out-of-scope routers in here.
eth2 - 192.168.0.1/24   # in-scope and out-of-scope servers and stuff.
eth3 - 81.x.x.x/x      # internet facing

or:

# using virtual ports
eth0   - 10.0.0.0/24
eth0:0 - 172.16.0.0/24
eth0:1 - 192.168.0.1/24
eth1   - 81.x.x.x/x

Considering the server pair, the first option requires 8 interfaces/8 switch ports while the second option only requires 4 interfaces/4 switch ports.

What should I be considering when making this decision?

-
You realize that the 192.168.0.1/8 is masking away public address space you don't own? Are you sure you got that mask right? –  Zoredache Jun 14 '13 at 20:53
thanks, a brain fart I think –  Mr Not A. Clue Jun 14 '13 at 21:02


text:
# How nontrivial can "central extensions of ribbon fusion categories" be?

In a sense, this is a follow up on this question, but one PhD programme later.

Let $\mathcal{C}$ be ribbon fusion. By $\mathcal{C}'$, we denote the symmetric centre, i.e. the full subcategory of objects that trivially braid with every other object in $\mathcal{C}$. Let us require that $\mathcal{C}$ is modularisable, i.e. $\mathcal{C}' \simeq \operatorname{Rep}G$ for a finite group $G$. We then have the following "exact sequence of ribbon fusion categories": $$\mathcal{C}' \hookrightarrow \mathcal{C} \twoheadrightarrow \widetilde{\mathcal{C}}$$ Here, $\widetilde{\mathcal{C}}$ is the modularisation of $\mathcal{C}$. I'm calling this an exact sequence since $\mathcal{C}'$ is being sent to the copy of vector spaces sitting inside the modularisation as the category spanned by the tensor unit, and in a certain sense, $\mathcal{C}'$ is the biggest such subcategory of $\mathcal{C}$.

This looks a lot like a central extension. So another way of describing a (modularisable) ribbon fusion category would then be as a central extension of a modular category by the representations of a finite group (i.e. a Tannakian symmetric fusion category).

It's known that central extensions of groups are parametrised by second group cohomology. Is there a similar characterisation of ribbon fusion categories in terms of "central extensions"? I.e. can every modularisable ribbon fusion category be described by a modular category, a symmetric fusion category and some extra data?

Deequivariantization (of which modularization is a special case) is inverse to equivariantization. That is, you can recover $\mathcal{C}$ as the category of G-equivariant objects in $\tilde{\mathcal{C}}$ for some action of G on $\tilde{\mathcal{C}}$. So to classify such extensions you want to classify G-actions. (Note that this can be a bit tricky because G can act nontrivially on the category even if it acts trivially on iso classes of objects.)
• Awesome! Is there work on classifying $G$-actions on a given modular category? (A quick search didn't bring up anything, but I might searching for the wrong keywords.) May 5 '16 at 17:09