text:
Heart

The heart is a muscular organ found in most animals. This organ pumps blood through the blood vessels of the circulatory system. The pumped blood carries oxygen and nutrients to the body, while carrying metabolic waste such as carbon dioxide to the lungs. In humans, the heart is approximately the size of a closed fist and is located between the lungs, in the middle compartment of the chest, called the mediastinum.

In humans, other mammals, and birds, the heart is divided into four chambers: upper left and right atria and lower left and right ventricles. Commonly, the right atrium and ventricle are referred together as the right heart and their left counterparts as the left heart. Fish, in contrast, have two chambers, an atrium and a ventricle, while most reptiles have three chambers. In a healthy heart, blood flows one way through the heart due to heart valves, which prevent backflow. The heart is enclosed in a protective sac, the pericardium, which also contains a small amount of fluid. The wall of the heart is made up of three layers: epicardium, myocardium, and endocardium. In all vertebrates, the heart has an asymmetric orientation, almost always on the left side. According to one theory, this is caused by a developmental axial twist in the early embryo.

The heart pumps blood with a rhythm determined by a group of pacemaker cells in the sinoatrial node. These generate an electric current that causes the heart to contract, traveling through the atrioventricular node and along the conduction system of the heart. In humans, deoxygenated blood enters the heart through the right atrium from the superior and inferior venae cavae and passes to the right ventricle. From here, it is pumped into pulmonary circulation to the lungs, where it receives oxygen and gives off carbon dioxide. Oxygenated blood then returns to the left atrium, passes through the left ventricle and is pumped out through the aorta into systemic circulation, traveling through arteries, arterioles, and capillaries—where nutrients and other substances are exchanged between blood vessels and cells, losing oxygen and gaining carbon dioxide—before being returned to the heart through venules and veins. The heart beats at a resting rate close to 72 beats per minute. Exercise temporarily increases the rate, but lowers it in the long term, and is good for heart health.

Cardiovascular diseases are the most common cause of death globally as of 2008, accounting for 30% of all human deaths. Of these more than three-quarters are a result of coronary artery disease and stroke. Risk factors include: smoking, being overweight, little exercise, high cholesterol, high blood pressure, and poorly controlled diabetes, among others. Cardiovascular diseases do not frequently have symptoms but may cause chest pain or shortness of breath. Diagnosis of heart disease is often done by the taking of a medical history, listening to the heart-sounds with a stethoscope, as well as with ECG, and echocardiogram which uses ultrasound. Specialists who focus on diseases of the heart are called cardiologists, although many specialties of medicine may be involved in treatment.

Location and shape

The human heart is situated in the mediastinum, at the level of thoracic vertebrae T5-T8. A double-membraned sac called the pericardium surrounds the heart and attaches to the mediastinum. The back surface of the heart lies near the vertebral column, and the front surface known as the sternocostal surface sits behind the sternum and rib cartilages. The upper part of the heart is the attachment point for several large blood vessels—the venae cavae, aorta and pulmonary trunk. The upper part of the heart is located at the level of the third costal cartilage. The lower tip of the heart, the apex, lies to the left of the sternum (8 to 9 cm from the midsternal line) between the junction of the fourth and fifth ribs near their articulation with the costal cartilages.

The largest part of the heart is usually slightly offset to the left side of the chest (though occasionally it may be offset to the right) and is felt to be on the left because the left heart is stronger and larger, since it pumps to all body parts. Because the heart is between the lungs, the left lung is smaller than the right lung and has a cardiac notch in its border to accommodate the heart. The heart is cone-shaped, with its base positioned upwards and tapering down to the apex. An adult heart has a mass of 250–350 grams (9–12 oz). The heart is often described as the size of a fist: 12 cm (5 in) in length, 8 cm (3.5 in) wide, and 6 cm (2.5 in) in thickness, although this description is disputed, as the heart is likely to be slightly larger. Well-trained athletes can have much larger hearts due to the effects of exercise on the heart muscle, similar to the response of skeletal muscle.

Chambers
The heart has four chambers, two upper atria, the receiving chambers, and two lower ventricles, the discharging chambers. The atria open into the ventricles via the atrioventricular valves, present in the atrioventricular septum. This distinction is visible also on the surface of the heart as the coronary sulcus. There is an ear-shaped structure in the upper right atrium called the right atrial appendage, or auricle, and another in the upper left atrium, the left atrial appendage. The right atrium and the right ventricle together are sometimes referred to as the right heart. Similarly, the left atrium and the left ventricle together are sometimes referred to as the left heart. The ventricles are separated from each other by the interventricular septum, visible on the surface of the heart as the anterior longitudinal sulcus and the posterior interventricular sulcus.

The fibrous cardiac skeleton gives structure to the heart. It forms the atrioventricular septum, which separates the atria from the ventricles, and the fibrous rings, which serve as bases for the four heart valves. The cardiac skeleton also provides an important boundary in the heart's electrical conduction system since collagen cannot conduct electricity. The interatrial septum separates the atria, and the interventricular septum separates the ventricles. The interventricular septum is much thicker than the interatrial septum since the ventricles need to generate greater pressure when they contract.

Valves
The heart has four valves, which separate its chambers. One valve lies between each atrium and ventricle, and one valve rests at the exit of each ventricle.

The valves between the atria and ventricles are called the atrioventricular valves. Between the right atrium and the right ventricle is the tricuspid valve. The tricuspid valve has three cusps, which connect to chordae tendinae and three papillary muscles named the anterior, posterior, and septal muscles, after their relative positions. The mitral valve lies between the left atrium and left ventricle. It is also known as the bicuspid valve due to its having two cusps, an anterior and a posterior cusp. These cusps are also attached via chordae tendinae to two papillary muscles projecting from the ventricular wall.

The papillary muscles extend from the walls of the heart to valves by cartilaginous connections called chordae tendinae. These muscles prevent the valves from falling too far back when they close. During the relaxation phase of the cardiac cycle, the papillary muscles are also relaxed and the tension on the chordae tendineae is slight. As the heart chambers contract, so do the papillary muscles. This creates tension on the chordae tendineae, helping to hold the cusps of the atrioventricular valves in place and preventing them from being blown back into the atria.

Two additional semilunar valves sit at the exit of each of the ventricles. The pulmonary valve is located at the base of the pulmonary artery. This has three cusps which are not attached to any papillary muscles. When the ventricle relaxes blood flows back into the ventricle from the artery and this flow of blood fills the pocket-like valve, pressing against the cusps which close to seal the valve. The semilunar aortic valve is at the base of the aorta and also is not attached to papillary muscles. This too has three cusps which close with the pressure of the blood flowing back from the aorta.

Right heart
The right heart consists of two chambers, the right atrium and the right ventricle, separated by a valve, the tricuspid valve.

The right atrium receives blood almost continuously from the body's two major veins, the superior and inferior venae cavae. A small amount of blood from the coronary circulation also drains into the right atrium via the coronary sinus, which is immediately above and to the middle of the opening of the inferior vena cava. In the wall of the right atrium is an oval-shaped depression known as the fossa ovalis, which is a remnant of an opening in the fetal heart known as the foramen ovale. Most of the internal surface of the right atrium is smooth, the depression of the fossa ovalis is medial, and the anterior surface has prominent ridges of pectinate muscles, which are also present in the right atrial appendage.

The right atrium is connected to the right ventricle by the tricuspid valve. The walls of the right ventricle are lined with trabeculae carneae, ridges of cardiac muscle covered by endocardium. In addition to these muscular ridges, a band of cardiac muscle, also covered by endocardium, known as the moderator band reinforces the thin walls of the right ventricle and plays a crucial role in cardiac conduction. It arises from the lower part of the interventricular septum and crosses the interior space of the right ventricle to connect with the inferior papillary muscle. The right ventricle tapers into the pulmonary trunk, into which it ejects blood when contracting. The pulmonary trunk branches into the left and right pulmonary arteries that carry the blood to each lung. The pulmonary valve lies between the right heart and the pulmonary trunk.

Left heart
The left heart has two chambers: the left atrium and the left ventricle, separated by the mitral valve.

The left atrium receives oxygenated blood back from the lungs via one of the four pulmonary veins. The left atrium has an outpouching called the left atrial appendage. Like the right atrium, the left atrium is lined by pectinate muscles. The left atrium is connected to the left ventricle by the mitral valve.

The left ventricle is much thicker as compared with the right, due to the greater force needed to pump blood to the entire body. Like the right ventricle, the left also has trabeculae carneae, but there is no moderator band. The left ventricle pumps blood to the body through the aortic valve and into the aorta. Two small openings above the aortic valve carry blood to the heart muscle; the left coronary artery is above the left cusp of the valve, and the right coronary artery is above the right cusp.

Wall

The heart wall is made up of three layers: the inner endocardium, middle myocardium and outer epicardium. These are surrounded by a double-membraned sac called the pericardium.

The innermost layer of the heart is called the endocardium. It is made up of a lining of simple squamous epithelium and covers heart chambers and valves. It is continuous with the endothelium of the veins and arteries of the heart, and is joined to the myocardium with a thin layer of connective tissue. The endocardium, by secreting endothelins, may also play a role in regulating the contraction of the myocardium.

The middle layer of the heart wall is the myocardium, which is the cardiac muscle—a layer of involuntary striated muscle tissue surrounded by a framework of collagen. The cardiac muscle pattern is elegant and complex, as the muscle cells swirl and spiral around the chambers of the heart, with the outer muscles forming a figure 8 pattern around the atria and around the bases of the great vessels and the inner muscles, forming a figure 8 around the two ventricles and proceeding toward the apex. This complex swirling pattern allows the heart to pump blood more effectively.

There are two types of cells in cardiac muscle: muscle cells which have the ability to contract easily, and pacemaker cells of the conducting system. The muscle cells make up the bulk (99%) of cells in the atria and ventricles. These contractile cells are connected by intercalated discs which allow a rapid response to impulses of action potential from the pacemaker cells. The intercalated discs allow the cells to act as a syncytium and enable the contractions that pump blood through the heart and into the major arteries. The pacemaker cells make up 1% of cells and form the conduction system of the heart. They are generally much smaller than the contractile cells and have few myofibrils which gives them limited contractibility. Their function is similar in many respects to neurons. Cardiac muscle tissue has autorhythmicity, the unique ability to initiate a cardiac action potential at a fixed rate—spreading the impulse rapidly from cell to cell to trigger the contraction of the entire heart.

There are specific proteins expressed in cardiac muscle cells. These are mostly associated with muscle contraction, and bind with actin, myosin, tropomyosin, and troponin. They include MYH6, ACTC1, TNNI3, CDH2 and PKP2. Other proteins expressed are MYH7 and LDB3 that are also expressed in skeletal muscle.

Pericardium
The pericardium is the sac that surrounds the heart. The tough outer surface of the pericardium is called the fibrous membrane. This is lined by a double inner membrane called the serous membrane that produces pericardial fluid to lubricate the surface of the heart. The part of the serous membrane attached to the fibrous membrane is called the parietal pericardium, while the part of the serous membrane attached to the heart is known as the visceral pericardium. The pericardium is present in order to lubricate its movement against other structures within the chest, to keep the heart's position stabilised within the chest, and to protect the heart from infection.

Coronary circulation

Heart tissue, like all cells in the body, needs to be supplied with oxygen, nutrients and a way of removing metabolic wastes. This is achieved by the coronary circulation, which includes arteries, veins, and lymphatic vessels. Blood flow through the coronary vessels occurs in peaks and troughs relating to the heart muscle's relaxation or contraction.

Heart tissue receives blood from two arteries which arise just above the aortic valve. These are the left main coronary artery and the right coronary artery. The left main coronary artery splits shortly after leaving the aorta into two vessels, the left anterior descending and the left circumflex artery. The left anterior descending artery supplies heart tissue and the front, outer side, and septum of the left ventricle. It does this by branching into smaller arteries—diagonal and septal branches. The left circumflex supplies the back and underneath of the left ventricle. The right coronary artery supplies the right atrium, right ventricle, and lower posterior sections of the left ventricle. The right coronary artery also supplies blood to the atrioventricular node (in about 90% of people) and the sinoatrial node (in about 60% of people). The right coronary artery runs in a groove at the back of the heart and the left anterior descending artery runs in a groove at the front. There is significant variation between people in the anatomy of the arteries that supply the heart The arteries divide at their furthest reaches into smaller branches that join at the edges of each arterial distribution.

The coronary sinus is a large vein that drains into the right atrium, and receives most of the venous drainage of the heart. It receives blood from the great cardiac vein (receiving the left atrium and both ventricles), the posterior cardiac vein (draining the back of the left ventricle), the middle cardiac vein (draining the bottom of the left and right ventricles), and small cardiac veins. The anterior cardiac veins drain the front of the right ventricle and drain directly into the right atrium.

Small lymphatic networks called plexuses exist beneath each of the three layers of the heart. These networks collect into a main left and a main right trunk, which travel up the groove between the ventricles that exists on the heart's surface, receiving smaller vessels as they travel up. These vessels then travel into the atrioventricular groove, and receive a third vessel which drains the section of the left ventricle sitting on the diaphragm. The left vessel joins with this third vessel, and travels along the pulmonary artery and left atrium, ending in the inferior tracheobronchial node. The right vessel travels along the right atrium and the part of the right ventricle sitting on the diaphragm. It usually then travels in front of the ascending aorta and then ends in a brachiocephalic node.

Nerve supply
The heart receives nerve signals from the vagus nerve and from nerves arising from the sympathetic trunk. These nerves act to influence, but not control, the heart rate. Sympathetic nerves also influence the force of heart contraction. Signals that travel along these nerves arise from two paired cardiovascular centres in the medulla oblongata. The vagus nerve of the parasympathetic nervous system acts to decrease the heart rate, and nerves from the sympathetic trunk act to increase the heart rate. These nerves form a network of nerves that lies over the heart called the cardiac plexus.

The vagus nerve is a long, wandering nerve that emerges from the brainstem and provides parasympathetic stimulation to a large number of organs in the thorax and abdomen, including the heart. The nerves from the sympathetic trunk emerge through the T1-T4 thoracic ganglia and travel to both the sinoatrial and atrioventricular nodes, as well as to the atria and ventricles. The ventricles are more richly innervated by sympathetic fibers than parasympathetic fibers. Sympathetic stimulation causes the release of the neurotransmitter norepinephrine (also known as noradrenaline) at the neuromuscular junction of the cardiac nerves. This shortens the repolarisation period, thus speeding the rate of depolarisation and contraction, which results in an increased heart rate. It opens chemical or ligand-gated sodium and calcium ion channels, allowing an influx of positively charged ions. Norepinephrine binds to the beta–1 receptor.

Development

The heart is the first functional organ to develop and starts to beat and pump blood at about three weeks into embryogenesis. This early start is crucial for subsequent embryonic and prenatal development.

The heart derives from splanchnopleuric mesenchyme in the neural plate which forms the cardiogenic region. Two endocardial tubes form here that fuse to form a primitive heart tube known as the tubular heart. Between the third and fourth week, the heart tube lengthens, and begins to fold to form an S-shape within the pericardium. This places the chambers and major vessels into the correct alignment for the developed heart. Further development will include the formation of the septa and the valves and the remodeling of the heart chambers. By the end of the fifth week, the septa are complete, and by the ninth week, the heart valves are complete.

Before the fifth week, there is an opening in the fetal heart known as the foramen ovale. The foramen ovale allowed blood in the fetal heart to pass directly from the right atrium to the left atrium, allowing some blood to bypass the lungs. Within seconds after birth, a flap of tissue known as the septum primum that previously acted as a valve closes the foramen ovale and establishes the typical cardiac circulation pattern. A depression in the surface of the right atrium remains where the foramen ovale was, called the fossa ovalis.

The embryonic heart begins beating at around 22 days after conception (5 weeks after the last normal menstrual period, LMP). It starts to beat at a rate near to the mother's which is about 75–80 beats per minute (bpm). The embryonic heart rate then accelerates and reaches a peak rate of 165–185 bpm early in the early 7th week (early 9th week after the LMP). After 9 weeks (start of the fetal stage) it starts to decelerate, slowing to around 145 (±25) bpm at birth. There is no difference in female and male heart rates before birth.

Blood flow
The heart functions as a pump in the circulatory system to provide a continuous flow of blood throughout the body. This circulation consists of the systemic circulation to and from the body and the pulmonary circulation to and from the lungs. Blood in the pulmonary circulation exchanges carbon dioxide for oxygen in the lungs through the process of respiration. The systemic circulation then transports oxygen to the body and returns carbon dioxide and relatively deoxygenated blood to the heart for transfer to the lungs.

The right heart collects deoxygenated blood from two large veins, the superior and inferior venae cavae. Blood collects in the right and left atrium continuously. The superior vena cava drains blood from above the diaphragm and empties into the upper back part of the right atrium. The inferior vena cava drains the blood from below the diaphragm and empties into the back part of the atrium below the opening for the superior vena cava. Immediately above and to the middle of the opening of the inferior vena cava is the opening of the thin-walled coronary sinus. Additionally, the coronary sinus returns deoxygenated blood from the myocardium to the right atrium. The blood collects in the right atrium. When the right atrium contracts, the blood is pumped through the tricuspid valve into the right ventricle. As the right ventricle contracts, the tricuspid valve closes and the blood is pumped into the pulmonary trunk through the pulmonary valve. The pulmonary trunk divides into pulmonary arteries and progressively smaller arteries throughout the lungs, until it reaches capillaries. As these pass by alveoli carbon dioxide is exchanged for oxygen. This happens through the passive process of diffusion.

In the left heart, oxygenated blood is returned to the left atrium via the pulmonary veins. It is then pumped into the left ventricle through the mitral valve and into the aorta through the aortic valve for systemic circulation. The aorta is a large artery that branches into many smaller arteries, arterioles, and ultimately capillaries. In the capillaries, oxygen and nutrients from blood are supplied to body cells for metabolism, and exchanged for carbon dioxide and waste products. Capillary blood, now deoxygenated, travels into venules and veins that ultimately collect in the superior and inferior vena cavae, and into the right heart.

Cardiac cycle

The cardiac cycle is the sequence of events in which the heart contracts and relaxes with every heartbeat. The period of time during which the ventricles contract, forcing blood out into the aorta and main pulmonary artery, is known as systole, while the period during which the ventricles relax and refill with blood is known as diastole. The atria and ventricles work in concert, so in systole when the ventricles are contracting, the atria are relaxed and collecting blood. When the ventricles are relaxed in diastole, the atria contract to pump blood to the ventricles. This coordination ensures blood is pumped efficiently to the body.

At the beginning of the cardiac cycle, the ventricles are relaxing. As they do so, they are filled by blood passing through the open mitral and tricuspid valves. After the ventricles have completed most of their filling, the atria contract, forcing further blood into the ventricles and priming the pump. Next, the ventricles start to contract. As the pressure rises within the cavities of the ventricles, the mitral and tricuspid valves are forced shut. As the pressure within the ventricles rises further, exceeding the pressure with the aorta and pulmonary arteries, the aortic and pulmonary valves open. Blood is ejected from the heart, causing the pressure within the ventricles to fall. Simultaneously, the atria refill as blood flows into the right atrium through the superior and inferior vena cavae, and into the left atrium through the pulmonary veins. Finally, when the pressure within the ventricles falls below the pressure within the aorta and pulmonary arteries, the aortic and pulmonary valves close. The ventricles start to relax, the mitral and tricuspid valves open, and the cycle begins again.

Cardiac output
Cardiac output (CO) is a measurement of the amount of blood pumped by each ventricle (stroke volume) in one minute. This is calculated by multiplying the stroke volume (SV) by the beats per minute of the heart rate (HR). So that: CO = SV x HR. The cardiac output is normalized to body size through body surface area and is called the cardiac index.

The average cardiac output, using an average stroke volume of about 70mL, is 5.25 L/min, with a normal range of 4.0–8.0 L/min. The stroke volume is normally measured using an echocardiogram and can be influenced by the size of the heart, physical and mental condition of the individual, sex, contractility, duration of contraction, preload and afterload.

Preload refers to the filling pressure of the atria at the end of diastole, when the ventricles are at their fullest. A main factor is how long it takes the ventricles to fill: if the ventricles contract more frequently, then there is less time to fill and the preload will be less. Preload can also be affected by a person's blood volume. The force of each contraction of the heart muscle is proportional to the preload, described as the Frank-Starling mechanism. This states that the force of contraction is directly proportional to the initial length of muscle fiber, meaning a ventricle will contract more forcefully, the more it is stretched.

Afterload, or how much pressure the heart must generate to eject blood at systole, is influenced by vascular resistance. It can be influenced by narrowing of the heart valves (stenosis) or contraction or relaxation of the peripheral blood vessels.

The strength of heart muscle contractions controls the stroke volume. This can be influenced positively or negatively by agents termed inotropes. These agents can be a result of changes within the body, or be given as drugs as part of treatment for a medical disorder, or as a form of life support, particularly in intensive care units. Inotropes that increase the force of contraction are "positive" inotropes, and include sympathetic agents such as adrenaline, noradrenaline and dopamine. "Negative" inotropes decrease the force of contraction and include calcium channel blockers.

Electrical conduction

The normal rhythmical heart beat, called sinus rhythm, is established by the heart's own pacemaker, the sinoatrial node (also known as the sinus node or the SA node). Here an electrical signal is created that travels through the heart, causing the heart muscle to contract. The sinoatrial node is found in the upper part of the right atrium near to the junction with the superior vena cava. The electrical signal generated by the sinoatrial node travels through the right atrium in a radial way that is not completely understood. It travels to the left atrium via Bachmann's bundle, such that the muscles of the left and right atria contract together. The signal then travels to the atrioventricular node. This is found at the bottom of the right atrium in the atrioventricular septum, the boundary between the right atrium and the left ventricle. The septum is part of the cardiac skeleton, tissue within the heart that the electrical signal cannot pass through, which forces the signal to pass through the atrioventricular node only. The signal then travels along the bundle of His to left and right bundle branches through to the ventricles of the heart. In the ventricles the signal is carried by specialized tissue called the Purkinje fibers which then transmit the electric charge to the heart muscle.

Heart rate

The normal resting heart rate is called the sinus rhythm, created and sustained by the sinoatrial node, a group of pacemaking cells found in the wall of the right atrium. Cells in the sinoatrial node do this by creating an action potential. The cardiac action potential is created by the movement of specific electrolytes into and out of the pacemaker cells. The action potential then spreads to nearby cells.

When the sinoatrial cells are resting, they have a negative charge on their membranes. A rapid influx of sodium ions causes the membrane's charge to become positive; this is called depolarisation and occurs spontaneously. Once the cell has a sufficiently high charge, the sodium channels close and calcium ions then begin to enter the cell, shortly after which potassium begins to leave it. All the ions travel through ion channels in the membrane of the sinoatrial cells. The potassium and calcium start to move out of and into the cell only once it has a sufficiently high charge, and so are called voltage-gated. Shortly after this, the calcium channels close and potassium channels open, allowing potassium to leave the cell. This causes the cell to have a negative resting charge and is called repolarisation. When the membrane potential reaches approximately −60 mV, the potassium channels close and the process may begin again.

The ions move from areas where they are concentrated to where they are not. For this reason sodium moves into the cell from outside, and potassium moves from within the cell to outside the cell. Calcium also plays a critical role. Their influx through slow channels means that the sinoatrial cells have a prolonged "plateau" phase when they have a positive charge. A part of this is called the absolute refractory period. Calcium ions also combine with the regulatory protein troponin C in the troponin complex to enable contraction of the cardiac muscle, and separate from the protein to allow relaxation.

The adult resting heart rate ranges from 60 to 100 bpm. The resting heart rate of a newborn can be 129 beats per minute (bpm) and this gradually decreases until maturity. An athlete's heart rate can be lower than 60 bpm. During exercise the rate can be 150 bpm with maximum rates reaching from 200 to 220 bpm.

Influences
The normal sinus rhythm of the heart, giving the resting heart rate, is influenced by a number of factors. The cardiovascular centres in the brainstem control the sympathetic and parasympathetic influences to the heart through the vagus nerve and sympathetic trunk. These cardiovascular centres receive input from a series of receptors including baroreceptors, sensing the stretching of blood vessels and chemoreceptors, sensing the amount of oxygen and carbon dioxide in the blood and its pH. Through a series of reflexes these help regulate and sustain blood flow.

Baroreceptors are stretch receptors located in the aortic sinus, carotid bodies, the venae cavae, and other locations, including pulmonary vessels and the right side of the heart itself. Baroreceptors fire at a rate determined by how much they are stretched, which is influenced by blood pressure, level of physical activity, and the relative distribution of blood. With increased pressure and stretch, the rate of baroreceptor firing increases, and the cardiac centers decrease sympathetic stimulation and increase parasympathetic stimulation. As pressure and stretch decrease, the rate of baroreceptor firing decreases, and the cardiac centers increase sympathetic stimulation and decrease parasympathetic stimulation. There is a similar reflex, called the atrial reflex or Bainbridge reflex, associated with varying rates of blood flow to the atria. Increased venous return stretches the walls of the atria where specialized baroreceptors are located. However, as the atrial baroreceptors increase their rate of firing and as they stretch due to the increased blood pressure, the cardiac center responds by increasing sympathetic stimulation and inhibiting parasympathetic stimulation to increase heart rate. The opposite is also true. Chemoreceptors present in the carotid body or adjacent to the aorta in an aortic body respond to the blood's oxygen, carbon dioxide levels. Low oxygen or high carbon dioxide will stimulate firing of the receptors.

Exercise and fitness levels, age, body temperature, basal metabolic rate, and even a person's emotional state can all affect the heart rate. High levels of the hormones epinephrine, norepinephrine, and thyroid hormones can increase the heart rate. The levels of electrolytes including calcium, potassium, and sodium can also influence the speed and regularity of the heart rate; low blood oxygen, low blood pressure and dehydration may increase it.

Diseases
Cardiovascular diseases, which include diseases of the heart, are the leading cause of death worldwide. The majority of cardiovascular disease is noncommunicable and related to lifestyle and other factors, becoming more prevalent with ageing. Heart disease is a major cause of death, accounting for an average of 30% of all deaths in 2008, globally. This rate varies from a lower 28% to a high 40% in high-income countries. Doctors that specialise in the heart are called cardiologists. Many other medical professionals are involved in treating diseases of the heart, including doctors, cardiothoracic surgeons, intensivists, and allied health practitioners including physiotherapists and dieticians.

Ischemic heart disease
Coronary artery disease, also known as ischemic heart disease, is caused by atherosclerosis—a build-up of fatty material along the inner walls of the arteries. These fatty deposits known as atherosclerotic plaques narrow the coronary arteries, and if severe may reduce blood flow to the heart. If a narrowing (or stenosis) is relatively minor then the patient may not experience any symptoms. Severe narrowings may cause chest pain (angina) or breathlessness during exercise or even at rest. The thin covering of an atherosclerotic plaque can rupture, exposing the fatty centre to the circulating blood. In this case a clot or thrombus can form, blocking the artery, and restricting blood flow to an area of heart muscle causing a myocardial infarction (a heart attack) or unstable angina. In the worst case this may cause cardiac arrest, a sudden and utter loss of output from the heart. Obesity, high blood pressure, uncontrolled diabetes, smoking and high cholesterol can all increase the risk of developing atherosclerosis and coronary artery disease.

Heart failure
Heart failure is defined as a condition in which the heart is unable to pump enough blood to meet the demands of the body. Patients with heart failure may experience breathlessness especially when lying flat, as well as ankle swelling, known as peripheral oedema. Heart failure is the result of many diseases affecting the heart, but is most commonly associated with ischemic heart disease, valvular heart disease, or high blood pressure. Less common causes include various cardiomyopathies. Heart failure is frequently associated with weakness of the heart muscle in the ventricles (systolic heart failure), but can also be seen in patients with heart muscle that is strong but stiff (diastolic heart failure). The condition may affect the left ventricle (causing predominantly breathlessness), the right ventricle (causing predominantly swelling of the legs and an elevated jugular venous pressure), or both ventricles. Patients with heart failure are at higher risk of developing dangerous heart rhythm disturbances or arrhythmias.

Cardiomyopathies
Cardiomyopathies are diseases affecting the muscle of the heart. Some cause abnormal thickening of the heart muscle (hypertrophic cardiomyopathy), some cause the heart to abnormally expand and weaken (dilated cardiomyopathy), some cause the heart muscle to become stiff and unable to fully relax between contractions (restrictive cardiomyopathy) and some make the heart prone to abnormal heart rhythms (arrhythmogenic cardiomyopathy). These conditions are often genetic and can be inherited, but some such as dilated cardiomyopathy may be caused by damage from toxins such as alcohol. Some cardiomyopathies such as hypertrophic cardiomopathy are linked to a higher risk of sudden cardiac death, particularly in athletes. Many cardiomyopathies can lead to heart failure in the later stages of the disease.

Valvular heart disease
Healthy heart valves allow blood to flow easily in one direction, and prevent it from flowing in the other direction. A diseased heart valve may have a narrow opening (stenosis), that restricts the flow of blood in the forward direction. A valve may otherwise be leaky, allowing blood to leak in the reverse direction ( regurgitation). Valvular heart disease may cause breathlessness, blackouts, or chest pain, but may be asymptomatic and only detected on a routine examination by hearing abnormal heart sounds or a heart murmur. In the developed world, valvular heart disease is most commonly caused by degeneration secondary to old age, but may also be caused by infection of the heart valves (endocarditis). In some parts of the world rheumatic heart disease is a major cause of valvular heart disease, typically leading to mitral or aortic stenosis and caused by the body's immune system reacting to a streptococcal throat infection.

Cardiac arrhythmias
While in the healthy heart, waves of electrical impulses originate in the sinus node before spreading to the rest of the atria, the atrioventricular node, and finally the ventricles (referred to as a normal sinus rhythm), this normal rhythm can be disrupted. Abnormal heart rhythms or arrhythmias may be asymptomatic or may cause palpitations, blackouts, or breathlessness. Some types of arrhythmia such as atrial fibrillation increase the long term risk of stroke.

Some arrhythmias cause the heart to beat abnormally slowly, referred to as a bradycardia or bradyarrhythmia. This may be caused by an abnormally slow sinus node or damage within the cardiac conduction system (heart block). In other arrhythmias the heart may beat abnormally rapidly, referred to as a tachycardia or tachyarrhythmia. These arrhythmias can take many forms and can originate from different structures within the heart—some arise from the atria (e.g. atrial flutter), some from the atrioventricular node (e.g. AV nodal re-entrant tachycardia) whilst others arise from the ventricles (e.g. ventricular tachycardia). Some tachyarrhythmias are caused by scarring within the heart (e.g. some forms of ventricular tachycardia), others by an irritable focus (e.g. focal atrial tachycardia), while others are caused by additional abnormal conduction tissue that has been present since birth (e.g. Wolff-Parkinson-White syndrome). The most dangerous form of heart racing is ventricular fibrillation, in which the ventricles quiver rather than contract, and which if untreated is rapidly fatal.

Pericardial disease
The sac which surrounds the heart, called the pericardium, can become inflamed in a condition known as pericarditis. This condition typically causes chest pain that may spread to the back, and is often caused by a viral infection (glandular fever, cytomegalovirus, or coxsackievirus). Fluid can build up within the pericardial sac, referred to as a pericardial effusion. Pericardial effusions often occur secondary to pericarditis, kidney failure, or tumours, and frequently do not cause any symptoms. However, large effusions or effusions which accumulate rapidly can compress the heart in a condition known as cardiac tamponade, causing breathlessness and potentially fatal low blood pressure. Fluid can be removed from the pericardial space for diagnosis or to relieve tamponade using a syringe in a procedure called pericardiocentesis.

Congenital heart disease
Some people are born with hearts that are abnormal and these abnormalities are known as congenital heart defects. They may range from the relatively minor (e.g. patent foramen ovale, arguably a variant of normal) to serious life-threatening abnormalities (e.g. hypoplastic left heart syndrome). Common abnormalities include those that affect the heart muscle that separates the two side of the heart (a "hole in the heart", e.g. ventricular septal defect). Other defects include those affecting the heart valves (e.g. congenital aortic stenosis), or the main blood vessels that lead from the heart (e.g. coarctation of the aorta). More complex syndromes are seen that affect more than one part of the heart (e.g. Tetralogy of Fallot).

Some congenital heart defects allow blood that is low in oxygen that would normally be returned to the lungs to instead be pumped back to the rest of the body. These are known as cyanotic congenital heart defects and are often more serious. Major congenital heart defects are often picked up in childhood, shortly after birth, or even before a child is born (e.g. transposition of the great arteries), causing breathlessness and a lower rate of growth. More minor forms of congenital heart disease may remain undetected for many years and only reveal themselves in adult life (e.g., atrial septal defect).

Channelopathies
Channelopathies can be categorized based on the organ system they affect. In the cardiovascular system, the electrical impulse required for each heart beat is provided by the electrochemical gradient of each heart cell. Because the beating of the heart depends on the proper movement of ions across the surface membrane, cardiac ion channelopathies form a major group of heart diseases. Cardiac ion channelopathies may explain some of the cases of sudden death syndrome and sudden arrhythmic death syndrome. Long QT syndrome is the most common form of cardiac channelopathy.

 * Long QT Syndrome (LQTS) - Mostly hereditary. On EKG can be observed as longer corrected QT interval (QTc). Characterized by fainting, sudden, life-threatening heart rhythm disturbances - Torsades de pointes type ventricular tachycardia, ventricular fibrillation and risk of sudden cardiac death.
 * Short QT syndrome.
 * Catecholaminergic polymorphic ventricular tachycardia (CPVT).
 * Progressive cardiac conduction defect (PCCD).
 * Early repolarisation syndrome (BER) - common in younger and active people, especially men, because it is affected by higher testosterone levels, which cause increased potassium currents, which further causes an elevation of the J-point on the EKG. In very rare cases, it can lead to ventricular fibrillation and death.
 * Brugada syndrome - a genetic disorder characterized by an abnormal EKG and is one of the most common causes of sudden cardiac death in young men.

Diagnosis
Heart disease is diagnosed by the taking of a medical history, a cardiac examination, and further investigations, including blood tests, echocardiograms, electrocardiograms, and imaging. Other invasive procedures such as cardiac catheterisation can also play a role.

Examination
The cardiac examination includes inspection, feeling the chest with the hands (palpation) and listening with a stethoscope (auscultation). It involves assessment of signs that may be visible on a person's hands (such as splinter haemorrhages), joints and other areas. A person's pulse is taken, usually at the radial artery near the wrist, in order to assess for the rhythm and strength of the pulse. The blood pressure is taken, using either a manual or automatic sphygmomanometer or using a more invasive measurement from within the artery. Any elevation of the jugular venous pulse is noted. A person's chest is felt for any transmitted vibrations from the heart, and then listened to with a stethoscope.

Heart sounds

Typically, healthy hearts have only two audible heart sounds, called S1 and S2. The first heart sound S1, is the sound created by the closing of the atrioventricular valves during ventricular contraction and is normally described as "lub". The second heart sound, S2, is the sound of the semilunar valves closing during ventricular diastole and is described as "dub". Each sound consists of two components, reflecting the slight difference in time as the two valves close. S2 may split into two distinct sounds, either as a result of inspiration or different valvular or cardiac problems. Additional heart sounds may also be present and these give rise to gallop rhythms. A third heart sound, S3 usually indicates an increase in ventricular blood volume. A fourth heart sound S4 is referred to as an atrial gallop and is produced by the sound of blood being forced into a stiff ventricle. The combined presence of S3 and S4 give a quadruple gallop. Heart murmurs are abnormal heart sounds which can be either related to disease or benign, and there are several kinds. There are normally two heart sounds, and abnormal heart sounds can either be extra sounds, or "murmurs" related to the flow of blood between the sounds. Murmurs are graded by volume, from 1 (the quietest), to 6 (the loudest), and evaluated by their relationship to the heart sounds, position in the cardiac cycle, and additional features such as their radiation to other sites, changes with a person's position, the frequency of the sound as determined by the side of the stethoscope by which they are heard, and site at which they are heard loudest. Murmurs may be caused by damaged heart valves or congenital heart disease such as ventricular septal defects, or may be heard in normal hearts. A different type of sound, a pericardial friction rub can be heard in cases of pericarditis where the inflamed membranes can rub together.

Blood tests
Blood tests play an important role in the diagnosis and treatment of many cardiovascular conditions.

Troponin is a sensitive biomarker for a heart with insufficient blood supply. It is released 4–6 hours after injury and usually peaks at about 12–24 hours. Two tests of troponin are often taken—one at the time of initial presentation and another within 3–6 hours, with either a high level or a significant rise being diagnostic. A test for brain natriuretic peptide (BNP) can be used to evaluate for the presence of heart failure, and rises when there is increased demand on the left ventricle. These tests are considered biomarkers because they are highly specific for cardiac disease. Testing for the MB form of creatine kinase provides information about the heart's blood supply, but is used less frequently because it is less specific and sensitive.

Other blood tests are often taken to help understand a person's general health and risk factors that may contribute to heart disease. These often include a full blood count investigating for anaemia, and basic metabolic panel that may reveal any disturbances in electrolytes. A coagulation screen is often required to ensure that the right level of anticoagulation is given. Fasting lipids and fasting blood glucose (or an HbA1c level) are often ordered to evaluate a person's cholesterol and diabetes status, respectively.

Electrocardiogram
Using surface electrodes on the body, it is possible to record the electrical activity of the heart. This tracing of the electrical signal is the electrocardiogram (ECG) or (EKG). An ECG is a bedside test and involves the placement of ten leads on the body. This produces a "12 lead" ECG (three extra leads are calculated mathematically, and one lead is electrically ground, or earthed).

There are five prominent features on the ECG: the P wave (atrial depolarisation), the QRS complex (ventricular depolarisation) and the T wave (ventricular repolarisation). As the heart cells contract, they create a current that travels through the heart. A downward deflection on the ECG implies cells are becoming more positive in charge ("depolarising") in the direction of that lead, whereas an upward inflection implies cells are becoming more negative ("repolarising") in the direction of the lead. This depends on the position of the lead, so if a wave of depolarising moved from left to right, a lead on the left would show a negative deflection, and a lead on the right would show a positive deflection. The ECG is a useful tool in detecting rhythm disturbances and in detecting insufficient blood supply to the heart. Sometimes abnormalities are suspected, but not immediately visible on the ECG. Testing when exercising can be used to provoke an abnormality or an ECG can be worn for a longer period such as a 24-hour Holter monitor if a suspected rhythm abnormality is not present at the time of assessment.

Imaging
Several imaging methods can be used to assess the anatomy and function of the heart, including ultrasound (echocardiography), angiography, CT, MRI, and PET, scans. An echocardiogram is an ultrasound of the heart used to measure the heart's function, assess for valve disease, and look for any abnormalities. Echocardiography can be conducted by a probe on the chest (transthoracic), or by a probe in the esophagus (transesophageal). A typical echocardiography report will include information about the width of the valves noting any stenosis, whether there is any backflow of blood (regurgitation) and information about the blood volumes at the end of systole and diastole, including an ejection fraction, which describes how much blood is ejected from the left and right ventricles after systole. Ejection fraction can then be obtained by dividing the volume ejected by the heart (stroke volume) by the volume of the filled heart (end-diastolic volume). Echocardiograms can also be conducted under circumstances when the body is more stressed, in order to examine for signs of lack of blood supply. This cardiac stress test involves either direct exercise, or where this is not possible, injection of a drug such as dobutamine.

CT scans, chest X-rays and other forms of imaging can help evaluate the heart's size, evaluate for signs of pulmonary oedema, and indicate whether there is fluid around the heart. They are also useful for evaluating the aorta, the major blood vessel which leaves the heart.

Treatment
Diseases affecting the heart can be treated by a variety of methods including lifestyle modification, drug treatment, and surgery.

Ischemic heart disease
Narrowings of the coronary arteries (ischemic heart disease) are treated to relieve symptoms of chest pain caused by a partially narrowed artery (angina pectoris), to minimise heart muscle damage when an artery is completely occluded (myocardial infarction), or to prevent a myocardial infarction from occurring. Medications to improve angina symptoms include nitroglycerin, beta blockers, and calcium channel blockers, while preventative treatments include antiplatelets such as aspirin and statins, lifestyle measures such as stopping smoking and weight loss, and treatment of risk factors such as high blood pressure and diabetes.

In addition to using medications, narrowed heart arteries can be treated by expanding the narrowings or redirecting the flow of blood to bypass an obstruction. This may be performed using a percutaneous coronary intervention, during which narrowings can be expanded by passing small balloon-tipped wires into the coronary arteries, inflating the balloon to expand the narrowing, and sometimes leaving behind a metal scaffold known as a stent to keep the artery open.

If the narrowings in coronary arteries are unsuitable for treatment with a percutaneous coronary intervention, open surgery may be required. A coronary artery bypass graft can be performed, whereby a blood vessel from another part of the body (the saphenous vein, radial artery, or internal mammary artery) is used to redirect blood from a point before the narrowing (typically the aorta) to a point beyond the obstruction.

Valvular heart disease
Diseased heart valves that have become abnormally narrow or abnormally leaky may require surgery. This is traditionally performed as an open surgical procedure to replace the damaged heart valve with a tissue or metallic prosthetic valve. In some circumstances, the tricuspid or mitral valves can be repaired surgically, avoiding the need for a valve replacement. Heart valves can also be treated percutaneously, using techniques that share many similarities with percutaneous coronary intervention. Transcatheter aortic valve replacement is increasingly used for patients consider very high risk for open valve replacement.

Cardiac arrhythmias
Abnormal heart rhythms (arrhythmias) can be treated using antiarrhythmic drugs. These may work by manipulating the flow of electrolytes across the cell membrane (such as calcium channel blockers, sodium channel blockers, amiodarone, or digoxin), or modify the autonomic nervous system's effect on the heart (beta blockers and atropine). In some arrhythmias such as atrial fibrillation which increase the risk of stroke, this risk can be reduced using anticoagulants such as warfarin or novel oral anticoagulants.

If medications fail to control an arrhythmia, another treatment option may be catheter ablation. In these procedures, wires are passed from a vein or artery in the leg to the heart to find the abnormal area of tissue that is causing the arrhythmia. The abnormal tissue can be intentionally damaged, or ablated, by heating or freezing to prevent further heart rhythm disturbances. Whilst the majority of arrhythmias can be treated using minimally invasive catheter techniques, some arrhythmias (particularly atrial fibrillation) can also be treated using open or thoracoscopic surgery, either at the time of other cardiac surgery or as a standalone procedure. A cardioversion, whereby an electric shock is used to stun the heart out of an abnormal rhythm, may also be used.

Cardiac devices in the form of pacemakers or implantable defibrillators may also be required to treat arrhythmias. Pacemakers, comprising a small battery powered generator implanted under the skin and one or more leads that extend to the heart, are most commonly used to treat abnormally slow heart rhythms. Implantable defibrillators are used to treat serious life-threatening rapid heart rhythms. These devices monitor the heart, and if dangerous heart racing is detected can automatically deliver a shock to restore the heart to a normal rhythm. Implantable defibrillators are most commonly used in patients with heart failure, cardiomyopathies, or inherited arrhythmia syndromes.

Heart failure
As well as addressing the underlying cause for a patient's heart failure (most commonly ischemic heart disease or hypertension), the mainstay of heart failure treatment is with medication. These include drugs to prevent fluid from accumulating in the lungs by increasing the amount of urine a patient produces (diuretics), and drugs that attempt to preserve the pumping function of the heart (beta blockers, ACE inhibitors and mineralocorticoid receptor antagonists).

In some patients with heart failure, a specialised pacemaker known as cardiac resynchronisation therapy can be used to improve the heart's pumping efficiency. These devices are frequently combined with a defibrillator. In very severe cases of heart failure, a small pump called a ventricular assist device may be implanted which supplements the heart's own pumping ability. In the most severe cases, a cardiac transplant may be considered.

Ancient
Humans have known about the heart since ancient times, although its precise function and anatomy were not clearly understood. From the primarily religious views of earlier societies towards the heart, ancient Greeks are considered to have been the primary seat of scientific understanding of the heart in the ancient world. Aristotle considered the heart to be the organ responsible for creating blood; Plato considered the heart as the source of circulating blood and Hippocrates noted blood circulating cyclically from the body through the heart to the lungs. Erasistratos (304–250 BCE) noted the heart as a pump, causing dilation of blood vessels, and noted that arteries and veins both radiate from the heart, becoming progressively smaller with distance, although he believed they were filled with air and not blood. He also discovered the heart valves.

The Greek physician Galen (2nd century CE) knew blood vessels carried blood and identified venous (dark red) and arterial (brighter and thinner) blood, each with distinct and separate functions. Galen, noting the heart as the hottest organ in the body, concluded that it provided heat to the body. The heart did not pump blood around, the heart's motion sucked blood in during diastole and the blood moved by the pulsation of the arteries themselves. Galen believed the arterial blood was created by venous blood passing from the left ventricle to the right through 'pores' between the ventricles. Air from the lungs passed from the lungs via the pulmonary artery to the left side of the heart and created arterial blood.

These ideas went unchallenged for almost a thousand years.

Pre-modern
The earliest descriptions of the coronary and pulmonary circulation systems can be found in the Commentary on Anatomy in Avicenna's Canon, published in 1242 by Ibn al-Nafis. In his manuscript, al-Nafis wrote that blood passes through the pulmonary circulation instead of moving from the right to the left ventricle as previously believed by Galen. His work was later translated into Latin by Andrea Alpago.

In Europe, the teachings of Galen continued to dominate the academic community and his doctrines were adopted as the official canon of the Church. Andreas Vesalius questioned some of Galen's beliefs of the heart in De humani corporis fabrica (1543), but his magnum opus was interpreted as a challenge to the authorities and he was subjected to a number of attacks. Michael Servetus wrote in Christianismi Restitutio (1553) that blood flows from one side of the heart to the other via the lungs.

Modern

A breakthrough in understanding the flow of blood through the heart and body came with the publication of De Motu Cordis (1628) by the English physician William Harvey. Harvey's book completely describes the systemic circulation and the mechanical force of the heart, leading to an overhaul of the Galenic doctrines. Otto Frank (1865–1944) was a German physiologist; among his many published works are detailed studies of this important heart relationship. Ernest Starling (1866–1927) was an important English physiologist who also studied the heart. Although they worked largely independently, their combined efforts and similar conclusions have been recognized in the name "Frank–Starling mechanism".

Although Purkinje fibers and the bundle of His were discovered as early as the 19th century, their specific role in the electrical conduction system of the heart remained unknown until Sunao Tawara published his monograph, titled Das Reizleitungssystem des Säugetierherzens, in 1906. Tawara's discovery of the atrioventricular node prompted Arthur Keith and Martin Flack to look for similar structures in the heart, leading to their discovery of the sinoatrial node several months later. These structures form the anatomical basis of the electrocardiogram, whose inventor, Willem Einthoven, was awarded the Nobel Prize in Medicine or Physiology in 1924.

The first heart transplant in a human ever performed was by James Hardy in 1964, using a chimpanzee heart, but the patient died within 2 hours. The first human to human heart transplantation was performed in 1967 by the South African surgeon Christiaan Barnard at Groote Schuur Hospital in Cape Town. This marked an important milestone in cardiac surgery, capturing the attention of both the medical profession and the world at large. However, long-term survival rates of patients were initially very low. Louis Washkansky, the first recipient of a donated heart, died 18 days after the operation while other patients did not survive for more than a few weeks. The American surgeon Norman Shumway has been credited for his efforts to improve transplantation techniques, along with pioneers Richard Lower, Vladimir Demikhov and Adrian Kantrowitz. As of March 2000, more than 55,000 heart transplantations have been performed worldwide. The first successful transplant of a heart from a genetically modified pig to a human in which the patient lived for a longer time, was performed January 7, 2022 in Baltimore by heart surgeon Bartley P. Griffith, recipient was David Bennett (57) this successfully extended his life until 8 March 2022 (1 month and 30 days).

By the middle of the 20th century, heart disease had surpassed infectious disease as the leading cause of death in the United States, and it is currently the leading cause of deaths worldwide. Since 1948, the ongoing Framingham Heart Study has shed light on the effects of various influences on the heart, including diet, exercise, and common medications such as aspirin. Although the introduction of ACE inhibitors and beta blockers has improved the management of chronic heart failure, the disease continues to be an enormous medical and societal burden, with 30 to 40% of patients dying within a year of receiving the diagnosis.

Symbolism
As one of the vital organs, the heart was long identified as the center of the entire body, the seat of life, or emotion, or reason, will, intellect, purpose or the mind. The heart is an emblematic symbol in many religions, signifying "truth, conscience or moral courage in many religions—the temple or throne of God in Islamic and Judeo-Christian thought; the divine centre, or atman, and the third eye of transcendent wisdom in Hinduism; the diamond of purity and essence of the Buddha; the Taoist centre of understanding."

In the Hebrew Bible, the word for heart, lev, is used in these meanings, as the seat of emotion, the mind, and referring to the anatomical organ. It is also connected in function and symbolism to the stomach.

An important part of the concept of the soul in Ancient Egyptian religion was thought to be the heart, or ib. The ib or metaphysical heart was believed to be formed from one drop of blood from the child's mother's heart, taken at conception. To ancient Egyptians, the heart was the seat of emotion, thought, will, and intention. This is evidenced by Egyptian expressions which incorporate the word ib, such as Awi-ib for "happy" (literally, "long of heart"), Xak-ib for "estranged" (literally, "truncated of heart"). In Egyptian religion, the heart was the key to the afterlife. It was conceived as surviving death in the nether world, where it gave evidence for, or against, its possessor. The heart was therefore not removed from the body during mummification, and was believed to be the center of intelligence and feeling, and needed in the afterlife. It was thought that the heart was examined by Anubis and a variety of deities during the Weighing of the Heart ceremony. If the heart weighed more than the feather of Maat, which symbolized the ideal standard of behavior. If the scales balanced, it meant the heart's possessor had lived a just life and could enter the afterlife; if the heart was heavier, it would be devoured by the monster Ammit.

The Chinese character for "heart", 心, derives from a comparatively realistic depiction of a heart (indicating the heart chambers) in seal script. The Chinese word xīn also takes the metaphorical meanings of "mind", "intention", or "core", and is often translated as "heart-mind" as the ancient Chinese believed the heart was the center of human cognition. In Chinese medicine, the heart is seen as the center of 神 shén "spirit, consciousness". The heart is associated with the small intestine, tongue, governs the six organs and five viscera, and belongs to fire in the five elements.

The Sanskrit word for heart is hṛd or hṛdaya, found in the oldest surviving Sanskrit text, the Rigveda. In Sanskrit, it may mean both the anatomical object and "mind" or "soul", representing the seat of emotion. Hrd may be a cognate of the word for heart in Greek, Latin, and English.

Many classical philosophers and scientists, including Aristotle, considered the heart the seat of thought, reason, or emotion, often disregarding the brain as contributing to those functions. The identification of the heart as the seat of emotions in particular is due to the Roman physician Galen, who also located the seat of the passions in the liver, and the seat of reason in the brain.

The heart also played a role in the Aztec system of belief. The most common form of human sacrifice practiced by the Aztecs was heart-extraction. The Aztec believed that the heart (tona) was both the seat of the individual and a fragment of the Sun's heat (istli). To this day, the Nahua consider the Sun to be a heart-soul (tona-tiuh): "round, hot, pulsating".

Indigenous leaders from Alaska to Australia came together in 2020 to deliver a message to the world that humanity needs to shift from the mind to the heart, and let our heart be in charge of what we do. The message was made into a film, which highlighted that humanity must open their hearts to restore balance to the world. Kumu Sabra Kauka, a Hawaiian studies educator and tradition bearer summed up the message of the film saying "Listen to your heart. Follow your path. May it be clear, and for the good of all." The film was led by Illarion Merculieff from the Aleut (Unangan) tribe. Merculieff has written that Unangan Elders referred to the heart as a "source of wisdom", "a deeper portal of profound interconnectedness and awareness that exists between humans and all living things".

In Catholicism, there has been a long tradition of veneration of the heart, stemming from worship of the wounds of Jesus Christ which gained prominence from the mid sixteenth century. This tradition influenced the development of the medieval Christian devotion to the Sacred Heart of Jesus and the parallel veneration of the Immaculate Heart of Mary, made popular by John Eudes. There are also many references to the heart in the Christian Bible, including "Blessed are the pure in heart, for they will see God", "Above all else, guard your heart, for everything you do flows from it", "For where your treasure is, there your heart will be also", "For as a man thinks in his heart, so shall he be."

The expression of a broken heart is a cross-cultural reference to grief for a lost one or to unfulfilled romantic love.

The notion of "Cupid's arrows" is ancient, due to Ovid, but while Ovid describes Cupid as wounding his victims with his arrows, it is not made explicit that it is the heart that is wounded. The familiar iconography of Cupid shooting little heart symbols is a Renaissance theme that became tied to Valentine's Day.

In certain Trans-New Guinea languages, such as Foi and Momoona, the heart and seat of emotions are colexified, meaning they share the same word.

Food
Animal hearts are widely consumed as food. As they are almost entirely muscle, they are high in protein. They are often included in dishes with other offal, for example in the pan-Ottoman kokoretsi.

Chicken hearts are considered to be giblets, and are often grilled on skewers; examples of this are Japanese hāto yakitori, Brazilian churrasco de coração, and Indonesian chicken heart satay. They can also be pan-fried, as in Jerusalem mixed grill. In Egyptian cuisine, they can be used, finely chopped, as part of stuffing for chicken. Many recipes combined them with other giblets, such as the Mexican pollo en menudencias and the Russian ragu iz kurinyikh potrokhov.

The hearts of beef, pork, and mutton can generally be interchanged in recipes. As heart is a hard-working muscle, it makes for "firm and rather dry" meat, so is generally slow-cooked. Another way of dealing with toughness is to julienne the meat, as in Chinese stir-fried heart.

Beef heart may be grilled or braised. In the Peruvian anticuchos de corazón, barbecued beef hearts are grilled after being tenderized through long marination in a spice and vinegar mixture. An Australian recipe for "mock goose" is actually braised stuffed beef heart.

Pig heart is stewed, poached, braised, or made into sausage. The Balinese oret is a sort of blood sausage made with pig heart and blood. A French recipe for cœur de porc à l'orange is made of braised heart with an orange sauce.

Vertebrates
The size of the heart varies among the different animal groups, with hearts in vertebrates ranging from those of the smallest mice (12 mg) to the blue whale (600 kg). In vertebrates, the heart lies in the middle of the ventral part of the body, surrounded by a pericardium. which in some fish may be connected to the peritoneum.

The sinoatrial node is found in all amniotes but not in more primitive vertebrates. In these animals, the muscles of the heart are relatively continuous, and the sinus venosus coordinates the beat, which passes in a wave through the remaining chambers. Since the sinus venosus is incorporated into the right atrium in amniotes, it is likely homologous with the SA node. In teleosts, with their vestigial sinus venosus, the main centre of coordination is, instead, in the atrium. The rate of heartbeat varies enormously between different species, ranging from around 20 beats per minute in codfish to around 600 in hummingbirds and up to 1200 bpm in the ruby-throated hummingbird.

Double circulatory systems
[[File:Copy of Ap Bio 2.svg|thumb|A cross section of a three-chambered adult amphibian heart. Note the single ventricle. The purple regions represent areas where mixing of oxygenated and de-oxygenated blood occurs. 1. Pulmonary vein

2. Left atrium

3. Right atrium

4. Ventricle

5. Conus arteriosus

6. Sinus venosus]] Adult amphibians and most reptiles have a double circulatory system, meaning a circulatory system divided into arterial and venous parts. However, the heart itself is not completely separated into two sides. Instead, it is separated into three chambers—two atria and one ventricle. Blood returning from both the systemic circulation and the lungs is returned, and blood is pumped simultaneously into the systemic circulation and the lungs. The double system allows blood to circulate to and from the lungs which deliver oxygenated blood directly to the heart.

In reptiles, other than snakes, the heart is usually situated around the middle of the thorax. In terrestrial and arboreal snakes it is usually located nearer to the head; in aquatic species the heart is more centrally located. There is a heart with three chambers: two atria and one ventricle. The form and function of these hearts are different from mammalian hearts due to the fact that snakes have an elongated body, and thus are affected by different environmental factors. In particular, the snake's heart relative to the position in their body has been influenced greatly by gravity. Therefore, snakes that are larger in size tend to have a higher blood pressure due to gravitational change. The ventricle is incompletely separated into two-halves by a wall (septum), with a considerable gap near the pulmonary artery and aortic openings. In most reptilian species, there appears to be little, if any, mixing between the bloodstreams, so the aorta receives, essentially, only oxygenated blood. The exception to this rule is crocodiles, which have a four-chambered heart.

In the heart of lungfish, the septum extends partway into the ventricle. This allows for some degree of separation between the de-oxygenated bloodstream destined for the lungs and the oxygenated stream that is delivered to the rest of the body. The absence of such a division in living amphibian species may be partly due to the amount of respiration that occurs through the skin; thus, the blood returned to the heart through the venae cavae is already partially oxygenated. As a result, there may be less need for a finer division between the two bloodstreams than in lungfish or other tetrapods. Nonetheless, in at least some species of amphibian, the spongy nature of the ventricle does seem to maintain more of a separation between the bloodstreams. Also, the original valves of the conus arteriosus have been replaced by a spiral valve that divides it into two parallel parts, thereby helping to keep the two bloodstreams separate.

Full division
Archosaurs (crocodilians and birds) and mammals show complete separation of the heart into two pumps for a total of four heart chambers; it is thought that the four-chambered heart of archosaurs evolved independently from that of mammals. In crocodilians, there is a small opening, the foramen of Panizza, at the base of the arterial trunks and there is some degree of mixing between the blood in each side of the heart, during a dive underwater; thus, only in birds and mammals are the two streams of blood—those to the pulmonary and systemic circulations—permanently kept entirely separate by a physical barrier.

Fish
The heart evolved no less than 380 million years ago in fish. Fish have what is often described as a two-chambered heart, consisting of one atrium to receive blood and one ventricle to pump it. However, the fish heart has entry and exit compartments that may be called chambers, so it is also sometimes described as three-chambered or four-chambered, depending on what is counted as a chamber. The atrium and ventricle are sometimes considered "true chambers", while the others are considered "accessory chambers".

Primitive fish have a four-chambered heart, but the chambers are arranged sequentially so that this primitive heart is quite unlike the four-chambered hearts of mammals and birds. The first chamber is the sinus venosus, which collects deoxygenated blood from the body through the hepatic and cardinal veins. From here, blood flows into the atrium and then to the powerful muscular ventricle where the main pumping action will take place. The fourth and final chamber is the conus arteriosus, which contains several valves and sends blood to the ventral aorta. The ventral aorta delivers blood to the gills where it is oxygenated and flows, through the dorsal aorta, into the rest of the body. (In tetrapods, the ventral aorta has divided in two; one half forms the ascending aorta, while the other forms the pulmonary artery).

In the adult fish, the four chambers are not arranged in a straight row but instead form an S-shape, with the latter two chambers lying above the former two. This relatively simple pattern is found in cartilaginous fish and in the ray-finned fish. In teleosts, the conus arteriosus is very small and can more accurately be described as part of the aorta rather than of the heart proper. The conus arteriosus is not present in any amniotes, presumably having been absorbed into the ventricles over the course of evolution. Similarly, while the sinus venosus is present as a vestigial structure in some reptiles and birds, it is otherwise absorbed into the right atrium and is no longer distinguishable.

Invertebrates
Arthropods and most mollusks have an open circulatory system. In this system, deoxygenated blood collects around the heart in cavities (sinuses). This blood slowly permeates the heart through many small one-way channels. The heart then pumps the blood into the hemocoel, a cavity between the organs. The heart in arthropods is typically a muscular tube that runs the length of the body, under the back and from the base of the head. Instead of blood the circulatory fluid is haemolymph which carries the most commonly used respiratory pigment, copper-based haemocyanin as the oxygen transporter. Haemoglobin is only used by a few arthropods. In some other invertebrates such as earthworms, the circulatory system is not used to transport oxygen and so is much reduced, having no veins or arteries and consisting of two connected tubes. Oxygen travels by diffusion and there are five small muscular vessels that connect these vessels that contract at the front of the animals that can be thought of as "hearts".

Squids and other cephalopods have two "gill hearts" also known as branchial hearts, and one "systemic heart". The branchial hearts have two atria and one ventricle each, and pump to the gills, whereas the systemic heart pumps to the body.

Only the chordates (including vertebrates) and the hemichordates have a central "heart", which is a vesicle formed from the thickening of the aorta and contracts to pump blood. This suggests a presence of it in the last common ancestor of these groups (may have been lost in the echinoderms).

title: Heart


text:
User talk:TaoPaiPai

Nice nickname.

--User:Tuxisuau

Invitation to join the Fifteen Year Society
Dear ,

I'd like to extend a cordial invitation to you to join the Fifteen Year Society, an informal group for editors who've been participating in the Wikipedia project for fifteen years or more.

Best regards, Urhixidur (talk) 02:32, 9 June 2019 (UTC)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: User talk:TaoPaiPai


text:
User:Tim Chambers

I reject the custom here that encourages anonymity. Own Your Words™! #f62367d See my Now page, and from that page explore the rest of my personal website.

I was in intellectual nirvana after discovering Wikipedia (WP) in 2001. (My first wikipedia-l posting was August 8 of that year.) I was sad to see Larry Sanger leave the project. I followed him to Citizendium. In 2019 I joined the Encyclosphere project. In 2023 I became a Justapedian, but I am earnestly trying not to burn any bridges here.

My contributions here speak for themselves. Compare with my edit count.

A decade ago I described how WP then fit into my blogging process at purl.org/net/tbc/blog/about. (Summary: I believed that WP was the most important blogging tool that existed.) That post is out of date. The important change is my new belief that Justapedia (JP) is the future. I continue to maintain my account here, but it's taken a backseat to JP. I'm jaded because it's hard to feel welcomed here anymore if you don't have hours and hours to spend writing, defending yourself, etc. Now I occasionally pop into JP to refresh a JP article or to drop in a factoid or two. Watch my contributions at JP grow.

Project Comments
12 November 2023 Updated first paragraph to clarify my involvement in other encyclopedic projects. Don't feel like creating Justapedia. I don't want to hear deletionists tell me that it's not notable. Oh, but check out Justapedia's articles that I wrote: Knowledge Standards Foundation and HandWiki.

13 Jul 2023 I can't believe Wikipedia didn't have an article on William Clark for over two years! I created the stub on 24 April 2003. Follow the development from the beginning, the first edits on the history page.

7 July 2023 Anyone interested in developing /ChannelPoint?

29 June 2023 I've been reading All the Knowledge in the World and felt compelled to button up Simon Garfield's work on People of Banana.

22 Jan 2023 Just popping in to say I'm now working on the encyclosphere and to note that I cut my wiki teeth on Ward Cunningham's original Wiki Wiki Web: https://wiki.c2.com/?TimChambers

11 Aug 2022 Milestone. Scooped the news of Connor Fields' retirement.

7 Feb 2021 It seems all I do here anymore is pop in to drop a sentence or two in this section. I red "Injured Merit: How a righteous sense of grievance can lead to a better world" by Paula Marantz Cohen, Thursday, January 28, 2021. Then I Ducksearched and found her page at encyclopedia.com (she also blogs!) and thought about creating Paula Marantz Cohen. She's notable! No, I have found that Wikipedians are no longer tolerant of stubs. It stopped being enjoyable to contribute here years ago. Sigh.

14 Nov 19 TIL I possess the 10th oldest account here!

06 Jul 19 I'm getting too much pushback on the humble Ellipsis button. It is a button placed typically in a top corner of a graphical user interface. It takes the form of an icon that consists of three dots (displayed as ⋮). [Compare to and contrast with the Hamburger button.] It is also known as a Kebab menu. Kudos Graeme Bartlett for recovering the text. Ref. my request. More history on my Talk page. I need to flesh it out before trying to create the article again. Someday it will have as much content as the Hamburger button article.

09 May 19 Popped in because I met Shawn Milne today. Already met Derek Bouchard-Hall, Tim Johnson, Jeff Pierce, Jamie Staff, and Gary Sutton. And speaking of cycling, I like to imagine that Lucien Choury is a distant relative.

29 Jul 14 Popped in to improve the Irvine Dataflow article. Arvind was my Bachelor's thesis advisor at the 'Tute. I never wrote a line of Id, FWIW.

3 Jan 13 I found a couple articles that Wikipedians have not yet squashed with picky standards. I added comments: Talk:In the Beginning... Was the Command Line (Garrett Birkel's rebuttal, On Bug Tracking), and Talk:List of email subject abbreviations.

 1 Aug 12 MCR = Master of Corporate Real Estate. Someone signed their email with the MCR designation and it made me curious. WP blacklisted EzineArticles dot com slash 3044073. I know, I know, WP doesn't cite original research. And I'm betting that domain is blacklisted because it doesn't archive properly at WebCite (something to do with the frame).

20 Feb 12 Raised this issue: Talk:Main Page/Archive 165. Learned that I need to plan ahead and spruce up pages I want to see showcased.

18 Feb 12 Joined the lively discussion following publication of "The 'Undue Weight' of Truth on Wikipedia," by Timothy Messer-Kruse in The Chronicle of Higher Education. See my DISQUS profile and click on Activity.

2 Dec 11 Who is this philosopher Timothy Chambers and how has his page managed to survive the dreaded test of noteworthiness all these years? Not that I'm complaining. I'm simply impressed. Link for public discussion.

15 Aug 11 After notification by User:Inks.LWC, I see that Paparazzi the project was speedily deleted by User:RHaworth. And User:Satori Son eliminated it from Paparazzi (disambiguation). Sigh. This project has changed so much in ten years. On one hand, I understand that googling will turn up the Paparazzi project MediaWiki, but on the other hand, my philosophy of this project when I was most active defined it as a way to vet and catalog search results so that people could more easily find the information they sought. Notability was much more loosely defined. I wish I could have made time to stay engaged and argue on the side of article inclusion when it counted.

I'm in this for the long-term, though. The pendulum can swing the other way again. I hold out hope that I'll have more time for WP in the future.

29 Jan 11 added comments to Talk:Disabled veteran street vendors, Talk:Jamshied Sharifi, and User talk:Accounting4Taste. And updated this page and answered wiki mail. Sigh. That's all I have time for right now.

10 Sep 10 I like Template:fancruft! Just discovered it used at Public_Broadcasting_Service oldid=383299946

1E4AF729D5CEFFD0

title: User:Tim Chambers


text:
Subset sum problem

The subset sum problem (SSP) is a decision problem in computer science. In its most general formulation, there is a multiset $$S$$ of integers and a target-sum $$T$$, and the question is to decide whether any subset of the integers sum to precisely $$T$$. The problem is known to be NP-complete. Moreover, some restricted variants of it are NP-complete too, for example:

 * The variant in which all inputs are positive.
 * The variant in which inputs may be positive or negative, and $$T=0$$. For example, given the set $$\{-7, -3, -2, 9000, 5, 8\}$$, the answer is yes because the subset $$\{-3, -2, 5\}$$ sums to zero.
 * The variant in which all inputs are positive, and the target sum is exactly half the sum of all inputs, i.e., $$ T = \frac{1}{2}(a_1+\dots+a_n)$$ . This special case of SSP is known as the partition problem.

SSP can also be regarded as an optimization problem: find a subset whose sum is at most T, and subject to that, as close as possible to T. It is NP-hard, but there are several algorithms that can solve it reasonably quickly in practice.

SSP is a special case of the knapsack problem and of the multiple subset sum problem.

Computational hardness
The run-time complexity of SSP depends on two parameters:

 * n - the number of input integers. If n is a small fixed number, then an exhaustive search for the solution is practical.
 * L - the precision of the problem, stated as the number of binary place values that it takes to state the problem. If L is a small fixed number, then there are dynamic programming algorithms that can solve it exactly.

As both n and L grow large, SSP is NP-hard. The complexity of the best known algorithms is exponential in the smaller of the two parameters n and L. The problem is NP-hard even when all input integers are positive (and the target-sum T is a part of the input). This can be proved by a direct reduction from 3SAT. It can also be proved by reduction from 3-dimensional matching (3DM):

 * We are given an instance of 3DM, where the vertex sets are W, X, Y. Each set has n vertices. There are m edges, where each edge contains exactly one vertex from each of W, X, Y. Denote L := ceiling(log2(m+1)), so that L is larger than the number of bits required to represent the number of edges.
 * We construct an instance of SSP with m positive integers. The integers are described by their binary representation. Each input integer can be represented by 3nL bits, divided into 3n zones of L bits. Each zone corresponds to a vertex.
 * For each edge (w,x,y) in the 3DM instance, there is an integer in the SSP instance, in which exactly three bits are "1": the least-significant bits in the zones of the vertices w, x, and y. For example, if n=10 and L=3, and W=(0,...,9), X=(10,...,19), Y=(20,...,29), then the edge (0, 10, 20) is represented by the number (20+230+260).
 * The target sum T in the SSP instance is set to an integer with "1" in the least-significant bit of every zone, that is, (20+21+...+23n-1).
 * If the 3DM instance has a perfect matching, then summing the corresponding integers in the SSP instance yields exactly T.
 * Conversely, if the SSP instance has a subset with sum exactly T, then, since the zones are sufficiently large so that there are no "carries" from one zone to the next, the sum must correspond to a perfect matching in the 3DM instance.

The following variants are also known to be NP-hard:

 * The input integers can be both positive and negative, and the target-sum T = 0. This can be proved by reduction from the variant with positive integers. Denote that variant by SubsetSumPositive and the current variant by SubsetSumZero. Given an instance (S, T) of SubsetSumPositive, construct an instance of SubsetSumZero by adding a single element with value −T.  Given a solution to the SubsetSumPositive instance, adding the −T yields a solution to the SubsetSumZero instance. Conversely, given a solution to the SubsetSumZero instance, it must contain the −T (since all integers in S are positive), so to get a sum of zero, it must also contain a subset of S with a sum of +T, which is a solution of the SubsetSumPositive instance.
 * The input integers are positive, and T = sum(S)/2. This can also be proved by reduction from the general variant; see partition problem.

The analogous counting problem #SSP, which asks to enumerate the number of subsets summing to the target, is #P-complete.

Exponential time algorithms
There are several ways to solve SSP in time exponential in n.

Inclusion–exclusion
The most naïve algorithm would be to cycle through all subsets of n numbers and, for every one of them, check if the subset sums to the right number. The running time is of order $$O(2^n \cdot n)$$, since there are $$2^n$$ subsets and, to check each subset, we need to sum at most n elements.

The algorithm can be implemented by depth-first search of a binary tree: each level in the tree corresponds to an input number; the left branch corresponds to excluding the number from the set, and the right branch corresponds to including the number (hence the name Inclusion-Exclusion). The memory required is $$O(n)$$. The run-time can be improved by several heuristics:

 * Process the input numbers in descending order.
 * If the integers included in a given node exceed the sum of the best subset found so far, the node is pruned.
 * If the integers included in a given node, plus all remaining integers, are less than the sum of the best subset found so far, the node is pruned.

Horowitz and Sahni
In 1974, Horowitz and Sahni published a faster exponential-time algorithm, which runs in time $$O( 2^{n/2}\cdot (n/2))$$, but requires much more space - $$O( 2^{n/2})$$. The algorithm splits arbitrarily the n elements into two sets of $$n/2$$ each. For each of these two sets, it stores a list of the sums of all $$2^{n/2}$$ possible subsets of its elements. Each of these two lists is then sorted. Using even the fastest comparison sorting algorithm, Mergesort for this step would take time $$O(2^{n/2}n)$$. However, given a sorted list of sums for $$k$$ elements, the list can be expanded to two sorted lists with the introduction of a ($$k+1$$)th element, and these two sorted lists can be merged in time $$O(2^k)$$. Thus, each list can be generated in sorted form in time $$O(2^{n/2})$$. Given the two sorted lists, the algorithm can check if an element of the first array and an element of the second array sum up to T in time $$O(2^{n/2})$$. To do that, the algorithm passes through the first array in decreasing order (starting at the largest element) and the second array in increasing order (starting at the smallest element). Whenever the sum of the current element in the first array and the current element in the second array is more than T, the algorithm moves to the next element in the first array. If it is less than T, the algorithm moves to the next element in the second array. If two elements that sum to T are found, it stops. (The sub-problem for two elements sum is known as two-sum. )

Schroeppel and Shamir
In 1981, Schroeppel and Shamir presented an algorithm based on Horowitz and Sanhi, that requires similar runtime - $$O( 2^{n/2}\cdot (n/4))$$, much less space - $$O(2^{n/4})$$. Rather than generating and storing all subsets of n/2 elements in advance, they partition the elements into 4 sets of n/4 elements each, and generate subsets of n/2 element pairs dynamically using a min heap, which yields the above time and space complexities since this can be done in $$O(k^{2}\log(k))$$ and space $$O(k)$$ given 4 lists of length k.

Due to space requirements, the HS algorithm is practical for up to about 50 integers, and the SS algorithm is practical for up to 100 integers.

Howgrave-Graham and Joux
In 2010, Howgrave-Graham and Joux presented a probabilistic algorithm that runs faster than all previous ones - in time $$O(2^{0.337n})$$ using space $$O(2^{0.256n})$$. It solves only the decision problem, cannot prove there is no solution for a given sum, and does not return the subset sum closest to T.

The techniques of Howgrave-Graham and Joux were subsequently extended bringing the time complexity to $$O(2^{0.291n})$$. A more recent generalization lowered the time complexity to $$O(2^{0.283n})$$.

Pseudo-polynomial time dynamic programming solutions
SSP can be solved in pseudo-polynomial time using dynamic programming. Suppose we have the following sequence of elements in an instance:

 * $$x_1,\ldots, x_N$$

We define a state as a pair (i, s) of integers. This state represents the fact that

 * "there is a nonempty subset of $$x_1,\ldots, x_i$$ which sums to $s$."

Each state (i, s) has two next states:

 * (i+1, s), implying that $$x_{i+1}$$ is not included in the subset;
 * (i+1, s+$$x_{i+1}$$), implying that $$x_{i+1}$$ is included in the subset.

Starting from the initial state (0, 0), it is possible to use any graph search algorithm (e.g. BFS) to search the state (N, T). If the state is found, then by backtracking we can find a subset with a sum of exactly T.

The run-time of this algorithm is at most linear in the number of states. The number of states is at most N times the number of different possible sums. Let $A$ be the sum of the negative values and $B$ the sum of the positive values; the number of different possible sums is at most B-A, so the total runtime is in $$O(N(B-A))$$. For example, if all input values are positive and bounded by some constant C, then B is at most N C, so the time required is $$O(N^{2}C)$$.

This solution does not count as polynomial time in complexity theory because $$B-A$$ is not polynomial in the size of the problem, which is the number of bits used to represent it. This algorithm is polynomial in the values of $A$ and $B$, which are exponential in their numbers of bits. However, Subset Sum encoded in unary is in P, since then the size of the encoding is linear in B-A. Hence, Subset Sum is only weakly NP-Complete.

For the case that each $$x_i$$ is positive and bounded by a fixed constant $C$, in 1999, Pisinger found a linear time algorithm having time complexity $$O(NC)$$ (note that this is for the version of the problem where the target sum is not necessarily zero, as otherwise the problem would be trivial). In 2015, Koiliaris and Xu found a deterministic $$\tilde{O}(T \sqrt N)$$ algorithm for the subset sum problem where $T$ is the sum we need to find. In 2017, Bringmann found a randomized $$\tilde{O}(T+N)$$ time algorithm.

In 2014, Curtis and Sanches found a simple recursion highly scalable in SIMD machines having $$O(N(m-x_{\min})/p)$$ time and $$O(N+m-x_{\min})$$ space, where $p$ is the number of processing elements, $$m=\min(s, \sum x_i - s)$$ and $$x_{\min}$$ is the lowest integer. This is the best theoretical parallel complexity known so far.

A comparison of practical results and the solution of hard instances of the SSP is discussed by Curtis and Sanches.

Polynomial time approximation algorithms
Suppose all inputs are positive. An approximation algorithm to SSP aims to find a subset of S with a sum of at most T and at least r times the optimal sum, where r is a number in (0,1) called the approximation ratio.

Simple 1/2-approximation
The following very simple algorithm has an approximation ratio of 1/2:

 * Order the inputs by descending value;
 * Put the next-largest input into the subset, as long as it fits there.

When this algorithm terminates, either all inputs are in the subset (which is obviously optimal), or there is an input that does not fit. The first such input is smaller than all previous inputs that are in the subset and the sum of inputs in the subset is more than T/2 otherwise the input also is less than T/2 and it would fit in the set. Such a sum greater than T/2 is obviously more than OPT/2.

Fully-polynomial time approximation scheme
The following algorithm attains, for every $$\epsilon>0$$, an approximation ratio of $$(1-\epsilon)$$. Its run time is polynomial in $n$ and $$1/\epsilon$$. Recall that n is the number of inputs and T is the upper bound to the subset sum. initialize a list L to contain one element 0. for each i from 1 to n do let Ui be a list containing all elements y in L, and all sums xi + y for all y in L. sort Ui in ascending order make L empty let y be the smallest element of Ui add y to L for each element z of Ui in increasing order do // Trim the list by eliminating numbers close to one another // and throw out elements greater than the target sum T. if y + ε T/n < z ≤ T then y = z add z to L return the largest element in L.

Note that without the trimming step (the inner "for each" loop), the list L would contain the sums of all $$2^n$$ subsets of inputs. The trimming step does two things:

 * It ensures that all sums remaining in L are below T, so they are feasible solutions to the subset-sum problem.
 * It ensures that the list L is "sparse", that is, the difference between each two consecutive partial-sums is at least $$\epsilon T/n$$.

These properties together guarantee that the list $L$ contains no more than $$n/\epsilon$$ elements; therefore the run-time is polynomial in $$n/\epsilon$$.

When the algorithm ends, if the optimal sum is in $L$, then it is returned and we are done. Otherwise, it must have been removed in a previous trimming step. Each trimming step introduces an additive error of at most $$\epsilon T/n$$, so $n$ steps together introduce an error of at most $$\epsilon T$$. Therefore, the returned solution is at least $$\text{OPT}-\epsilon T$$ which is at least $$(1-\epsilon)\text{OPT}$$.

The above algorithm provides an exact solution to SSP in the case that the input numbers are small (and non-negative). If any sum of the numbers can be specified with at most $P$ bits, then solving the problem approximately with $$\epsilon = 2^{-P}$$ is equivalent to solving it exactly. Then, the polynomial time algorithm for approximate subset sum becomes an exact algorithm with running time polynomial in $n$ and $$2^P$$ (i.e., exponential in $P$).

Kellerer, Mansini, Pferschy and Speranza and Kellerer, Pferschy and Pisinger present other FPTAS-s for subset sum.

title: Subset sum problem