Alice Williams is 16, and her eyes are gleaming. As she speaks, her face grows pink with excitement and her hands wave around expressively. You might expect her to be talking about the latest Twilight film or a teenage boy band. But no: Alice is talking about heat resistance. More specifically, a heat-resistance experiment in her A-level physics class.

"The most exciting experiments are when a normal one goes horribly wrong," says Alice, a sixth-former at Lampton School in Hounslow, west London. "One time we were testing the resistance in wire, and if it's too hot it starts to glow. We thought the power was off, but it was on, and it was glowing to the point of fire. It burnt a hole through the ruler. We tried to hide it from the teacher because we were a group of three girls, and it was the beginning of the year, and people were still giving us a bit of stick."

Alice was being given "a bit of stick" from the boys in her class, because the sight of three girls studying physics at school is an increasingly rare one. For the past two decades, female students have accounted for only one-fifth of those taking the subject at A-level. It is the fourth most popular subject for boys, yet slips to 19th in the rankings for girls. According to a recent study by the Institute of Physics, using information provided by the National Pupil Database, 49% of state co-educational schools in England did not send any girls to study physics at A-level in 2011. By contrast, girls were almost two and a half times more likely to take the subject at A-level if they were at a single-sex school – a finding that suggests there might be an ingrained cultural perception in co-educational establishments that physics is somehow "not for girls".

The numbers continue to slip at university. Around 17% of girls apply to do physics at undergraduate level, followed by a more substantial decline in the numbers moving into permanent academic jobs – only 7.9% of these undergraduates stay on to become senior lecturers and 4% professors. Why is this happening? Is there some endemic sexism within the world of physics? Or do women simply not find it appealing?

Professor Athene Donald in the Cavendish Laboratories at Cambridge University. Photograph: Sophia Evans for the Observer

Athene Donald, a professor of experimental physics and gender equality champion at the University of Cambridge, says there is a risk that the subject is not seen as "cool" by girls of school age. "It might be that the problem is embedded in the ethos of the school and that teachers are tending to interact more with boys who are more outgoing," Donald says. "There are all sorts of subtle messages that 'Girls don't do physics'."

A number of pupils I talk to at Lampton agree. They say that biology is perceived as more girl-friendly, because it is the gateway to medicine and involves more human interaction. By contrast, physics is seen to be an academically challenging subject, with students carrying out dull, repetitive experiments on a lab bench and struggling with equations. The anecdotal evidence is borne out by the statistics – whereas girls account for 20% of all students who opt for physics at A-level, they account for 55% of pupils who opt for biology.

"I suppose the way we portray physicists and engineers is as if it is not normal for girls to do these things," says Donald. "They are often seen as quite nerdy men in programmes like The Big Bang Theory. They are posed as inarticulate and that's not the kind of thing a girl is going to aspire to when she is 12, 13, 14."

Or, as Sir Peter Knight, president of the Institute of Physics, put it: "The English teacher who looks askance at the girl who takes an interest in physics … can play a part in forming girls' perception of the subject."

Lampton is bucking the national trend, with a quarter of girls studying physics at A-level. Jessica Hamer, a science teacher at the school, attributes this to a concerted effort on their part to counteract any negative stereotypes about what physicists might do, or be like, in the real world: "We realised there was a dearth of girls, so we tried to get more speakers and role models to come into the school and talk to the pupils."

The impact has been noticeable, and the girls I meet are extremely bright and enthusiastic about their chosen subject. "It's very encouraging to know there are women out there who have actually succeeded," says Sadaf Rezay, 16, who is taking physics A-level. "But there aren't that many on TV or in the media," counters Alice Williams. "Physics is not all just theory. A lot of people think it's theory, theory, theory, and that puts them off. You need to see how it's applied practically as well. It's involved in everything we do: you pick up a book – that's mechanics. You throw a ball – that's mechanics … Nuclear fusion could be used potentially as alternative energy."

Sushmanjit Kaur, 17, says: "And physics isn't just limited to the earth. It goes beyond that, into exploring space."

"It answers more of the fundamental questions," Alice concludes.

The three of them chat on, at one point insisting that they're looking forward to a school trip to the Large Hadron Collider at Cern in Geneva. When their conversation about particle physics becomes too baffling for me (single science GCSE, 1994), Alice breaks off to explain. "Particle physics is looking into what makes up protons and electrons," she explains, kindly.

Did these forthright, clever girls feel peer pressure not to study physics, I wonder? Rezay nods. "I think in year 10 and 11, girls are put off because of peer pressure and none of their friends are doing it."

"It's not cool to be clever at the moment, especially as a girl," adds Williams. "Boys don't mind being thought of as geeks, but girls do. I do English lit as well, and I'm the only one in the class who also takes physics. Everyone in the class was kind of like, 'You do physics?'" She curls her lip in disgust. "But we're good because we've got a whole group of friends [doing physics as well]."

The importance of a supportive network of friends taking the same subject is key. But it is also, as Alice points out, a question of seeing more positive role models on television and in schools. Although there are prominent male presenters in popular science – Brian Cox, David Attenborough – there are hardly any female counterparts. And when female scientists do make it on to the pages of newspapers, or into television studios, the way they are presented can be extremely patronising. A 2010 paper by academics at the University of Cardiff examined 51 interviews with scientists, eight of whom were women, pulled from a sample of 12 UK national papers in 2006. Half of the profiles of the women referred to their clothing, physique or hairstyle, compared with 21% of the profiles of men. The male scientists interviewed were often used to signal gravitas, while women were more likely to be said to make science "accessible" or "sexy".

Alice Bell, a science journalist and research fellow at the University of Sussex, sees this as part of the problem: "We should celebrate it when we see a female scientist on TV. We should say, 'Yes, she was wonderful', and not necessarily just look at their bottom."

However, it is a trend with a dispiritingly long history. In the 1960s, when female scientists were few and far between, they were routinely portrayed in the media as wives and mothers, and praised for their bakery skills or ability to sew their own clothes. The eminent astrophysicist Jocelyn Bell Burnell made one of the most important discoveries of the 20th century when she uncovered the existence of pulsars. And she recalled in a recent radio interview that the subsequent press interest was focused on "how tall I was, and, you know, chest, waist and hip measurements, please, and all that kind of thing. They did not know what to do with a young female scientist … you were a young female, you were page three, you weren't a scientist."

Bell Burnell felt ill-equipped to complain about such treatment. "I hadn't finished my PhD, I was dependent on senior colleagues for references, and maybe even for the PhD, and I wasn't in a position to offend the press because the lab needed the publicity," she said. "If there had been a sort of senior woman around she might have been in a strong enough position to weigh in and say to the press 'Look, these are irrelevant questions'… but there wasn't."

The sexism had serious consequences: Bell Burnell's discovery resulted in a 1974 Nobel prize – not for her, but for her male supervisor and colleague. Fortunately, there are a handful of more senior female physicists around these days, but some of the issues remain. When the European commission launched an initiative earlier this year to encourage more girls to pursue careers in the sciences, they released a kitschy video featuring young women sashaying around a neon-lit laboratory wearing high heels, miniskirts and blowing kisses at test tubes. The video was roundly derided on social networking sites and students at Bristol University swiftly put together this YouTube spoof, featuring a suggestive use of latex gloves and female scientists applying lipstick while wearing lab glasses.

But do such cultural stereotypes have a real impact on the day-to-day experience of working scientists? Athene Donald, one of only eight women out of 100 students in their final year as undergraduate physicists at Cambridge, thinks it does. "You had to be able to say 'So be it', and if you feel uncomfortable in that situation it can still be a deterrent," she says. "I have seen situations where you get a very confident young man putting down a lab partner who is female. Now that can happen if you're male or female, but that may be enough to put off a girl if she's already feeling vulnerable because she's in a minority.

"That can come into play at a later stage too," Donald adds. "There are some very well-established women in science now who will still say they are in the minority at conferences, and they feel uncomfortable going to the pub, as the men do, to network after a talk."

Aki Matsushima in a lab at Imperial College, London. Photograph: Sophia Evans for the Observer

And yet there are signs that the culture is changing. It's not just the clever young women I meet at Lampton who signal the dissolution of previously entrenched ideas, but also those physicists currently working in postgraduate fields. Aki Matsushima, a 26-year-old studying for a PhD in quantum physics at Imperial College, London, insists that the lifestyle of a research scientist "is very flexible and actually accommodating, and in that respect it can be really good for women who have other responsibilities, like childcare. There's been a lot of encouragement and funding to get more women in, and once you're in there's no discrimination. In fact, there's lots of encouragement."

However, Matsushima acknowledges that the lack of female professors is a problem. She, like Donald, attended an all-girl school and then chose to attend a single-sex college at Cambridge. "I knew the course was going to be all men," she explains, "so I applied to a women's college so I could hang out with girls as well." But once Matsushima had made it into the male-dominated world of physics, she found it was – and continues to be – an extremely fair environment, with no gender discrimination.

"Maybe at lunchtime you're hanging out with a load of guys talking about computer games, but that's about it," she says. This year, Matsushima was a finalist in the BBC's Masterchef and came into contact with some professional chefs who told her she would have to work "twice as hard" to make it as a woman. "In cooking, there is a kind of discrimination internally," she says. "That hasn't happened to me in physics."

All of which sounds relatively hopeful for the A-level pupils at Lampton. What can they see themselves doing in the future?

"Chemical engineering," says Alice Williams.

"Psychiatry," says Sadaf Rezay.

"Astrophysics," says Sushmanjit Kaur.

Perhaps the future of physics has started to look a little bit more female.