Latest / Technically Speaking | a science and engineering discussion / How easy is it to learn to code?
Transcript
- 0:00[Music]
- 0:03hello and welcome to technically
- 0:04speaking a podcast where scientists and
- 0:06engineers come together to chat about
- 0:07common interests share knowledge and
- 0:09satisfy some curiosity
- 0:11i'm laura and in this episode i'm joined
- 0:13by guinoa emma and clear to talk about
- 0:15how we just learn to code and what we
- 0:17use it for
- 0:18so to start off with emma can you tell
- 0:21us a little bit about what you're coding
- 0:23and how you got into it yes well how i
- 0:26got into it
- 0:27uh perhaps a bit different to how some
- 0:29people i know got into coding and that
- 0:31was because in my degree we had a
- 0:34non-optional module in python i actually
- 0:36enjoyed that a lot more than i thought i
- 0:38would and then i ended up taking another
- 0:40python module in my second semester
- 0:43and uh like over summer really really
- 0:45got into just like looking into what the
- 0:47code can actually do and in my third
- 0:49year now i actually joined the robot
- 0:52society
- 0:53and i'm a part of a team that's trying
- 0:55to get a robot arm to play chess uh
- 0:58we're working in matlab there and that's
- 1:00like very new to me uh but that's
- 1:02currently what i guess i'm coding on as
- 1:04well as some like lab stuff which i have
- 1:05to do but mainly the robotics trajectory
- 1:08stuff ah cool so you're doing this for
- 1:09fun your degree is physics isn't it yes
- 1:12uh i'm on an emphasis on this so that
- 1:14our fourth year um and so i figured this
- 1:16isn't my final year so maybe i can spend
- 1:19some extra time doing some coding for
- 1:21fun where i don't like it doesn't
- 1:22contribute towards my grade essentially
- 1:24so that's quite nice
- 1:27and that's quite a nice story about
- 1:29doing it for fun but having learned it
- 1:31from your undergrad degree my undergrad
- 1:33was physics as well but it was a long
- 1:34time ago and we learned fortran which is
- 1:37uh very different i think
- 1:39um cleo what about you how did you get
- 1:41into coding i do the same degree as am i
- 1:44also studying physics for me in coding
- 1:47was just very practical and
- 1:50it became necessary at some point
- 1:52because in first year so we didn't do
- 1:55any coding and it just felt like
- 1:57especially when we were doing labs that
- 2:00there was a lot that we couldn't do and
- 2:02we were actually stuck and not being
- 2:04able to do some things not being able to
- 2:06present the data the way we wanted it to
- 2:09look like
- 2:10so i really felt like coding and using
- 2:12python could help me for that learning
- 2:15to good was actually my lockdown
- 2:16activity because i didn't know what else
- 2:18to do with my time i started doing some
- 2:22online courses because there's just so
- 2:24much out there so when i started
- 2:26learning python and then i took the same
- 2:28module that emma mentioned that was
- 2:30mandatory for us um and i did really
- 2:33enjoy it as well and now i just mostly
- 2:36use python in my labs on almost daily
- 2:40basis i guess uh
- 2:41and my latest lab was on particle
- 2:44physics um and so we were just analyzing
- 2:47a lot of data using coding okay i feel
- 2:49like we'll get into a lot of the details
- 2:51about exactly what you're using it for
- 2:53and various other things as we get
- 2:55through this conversation i really like
- 2:57that you're doing something that's
- 2:58mandatory but also enjoying it yeah you
- 3:01know i think your experience is quite
- 3:03different from emma and clears but i
- 3:05don't want to put any words in your mind
- 3:06so would you want to tell us about it
- 3:08yeah definitely it wasn't a fun story
- 3:11like clay and emma because i had to do
- 3:13it in late during my phd during the
- 3:16third year and whoever did phd knows
- 3:18their stress actually or the third year
- 3:20during phd so i had a phd project which
- 3:24was meant to be totally experimental so
- 3:26i built a rig in the lab tested at
- 3:29different operating conditions but then
- 3:31i reach a point where i need to gain
- 3:33more understanding of the physics and
- 3:35science behind what i'm doing and i need
- 3:37to predict results at different
- 3:39operating conditions so i had to do
- 3:41modeling and i had to start learning
- 3:44coding really in my late uh third year
- 3:46of phd but it was a very very rewarding
- 3:50experience because it opened up a whole
- 3:53world for me and it allows me actually
- 3:55to get the new job i'm going to be
- 3:57starting soon for you i guess you had to
- 3:59self-teach yourself in your phd
- 4:01code right
- 4:03yeah that's true well i had first to
- 4:06gain the logic behind uh coding which
- 4:09wasn't really
- 4:11the logic that we use in our day-to-day
- 4:13life isn't it to do that i just had to
- 4:16break some some link in my mind so what
- 4:19i did is i had to watch videos
- 4:23every night before sleeping for 10
- 4:26minutes about coding whatever it is
- 4:28python or matlab
- 4:30any language really and then it seems
- 4:33like with time i start to get the logic
- 4:36behind it and i start to be more
- 4:37familiar with what we are doing here and
- 4:40then i start really taking uh online
- 4:43training self-teaching and then getting
- 4:46on the track of
- 4:47most people do actually to learn coding
- 4:51wow that's so impressive and the fact
- 4:52that self-teaching actually helped you
- 4:54in your career as well very cool yeah
- 4:56and it sounds like there are some common
- 4:57themes that you've all put the effort in
- 4:59to learn to code in your spare time it
- 5:02sounds like so i've mentioned that i did
- 5:03physics as part of my undergraduate
- 5:05degrees a long time ago now and i
- 5:08learned fortran it's mostly maths based
- 5:10i didn't think much about it at the time
- 5:12but maybe about five years later i ended
- 5:14up doing a phd and i got that phd
- 5:16position because i knew fortran and it
- 5:19was useful for the computational
- 5:21chemistry that i was doing in the phd
- 5:23but i think fortran's very different to
- 5:25matlab and to python as well so i guess
- 5:28before we get into our discussion about
- 5:30what projects are working on now and a
- 5:32few other things it might make sense to
- 5:34explain what some of those differences
- 5:35is and how the coding languages work so
- 5:38if i say that 4chan is maths based it's
- 5:41quite simple it's the only sort of
- 5:44inbuilt things it can do is like
- 5:46trigonometric functions in logarithms i
- 5:49think
- 5:50exponents and how does that compare to
- 5:52python but like starters i noticed what
- 5:55i found incredibly useful about python
- 5:58when i was working on my lab in
- 6:00astrophysics was just you have a module
- 6:04called astropi and it does everything
- 6:06you could ever want it to do in
- 6:08astrophysics and the most important
- 6:10thing i found it did was actually like
- 6:12convert between coordinate systems
- 6:14because i still don't really know right
- 6:16ascension declination and latitude and
- 6:18longitude
- 6:20you don't actually need to know it um
- 6:22you can just use like the inbuilt
- 6:24functions and in matlab as well i've
- 6:26noticed already there's loads of like
- 6:28inbuilt things you can like install as
- 6:30well specifically for robotics and like
- 6:33statistical maths like modules you can
- 6:36install and you can use them to generate
- 6:38random numbers or you can use them to
- 6:40model different systems and it does kind
- 6:43of a lot of the work for you and it's
- 6:44like mainly just adapting what's there
- 6:47to what you want it to do python and
- 6:49matlab are probably a lot more similar
- 6:51to each other than fortran is by the
- 6:53sound of it probably a fortune might
- 6:55have changed since i first started using
- 6:57it i think it was it originated like
- 6:581977 and i was using a version called
- 7:01fortran 95.
- 7:03[Music]
- 7:06so what about matlab i know a little bit
- 7:07about how it works i think i used it
- 7:09once again a long time ago i was mostly
- 7:12frustrated by it i think it's mainly for
- 7:13chemical engineers so i'm surprised it's
- 7:15used for robotics but again remember you
- 7:17can tell me more yeah so i use matlab
- 7:19actually because it has these built-in
- 7:22functions that helps me solve the
- 7:24mathematical equations that i want and i
- 7:26remember i used something called cftool
- 7:29that basically does all the job for you
- 7:31so you just need to choose what type of
- 7:34equation you need or try it really to
- 7:36fit your data and then once you choose
- 7:39the type of equation that fits well your
- 7:41data it generates all the functions and
- 7:44everything for you so you don't have to
- 7:46build actually the function itself so it
- 7:48was really easy in that term okay so has
- 7:52it got something built in there that can
- 7:53sort of like figure out all the maths
- 7:55behind um like the trends that are in
- 7:57your data is that right that you mean by
- 7:59function if you have a trend that you
- 8:01have from laboratories so let's say
- 8:04whatever mass variation as a function of
- 8:06time and then you have a graph for that
- 8:08and you need to um
- 8:10what's the word for it laura
- 8:14you need to fit your data you need to
- 8:16fit your data so you need to fit your
- 8:19data so you have a set of equations you
- 8:22can use for example a linear equation an
- 8:25exponential equation uh whatever so you
- 8:28can try different equations and the one
- 8:30that you think that fits the best your
- 8:33data or really it makes sense for what
- 8:35you are using so you just choose uh this
- 8:38and a tool called cf tool and then
- 8:41matlab is going to generate the function
- 8:44for you rather than you making the
- 8:46function from scratch and try to fit
- 8:49your data yourself so that was really
- 8:52make my life easy
- 8:54i thought we would talk about the same
- 8:55thing but i just wanted to make sure
- 8:57yes different disciplines use different
- 8:59words same different same words to mean
- 9:00different things
- 9:02i think maybe that's
- 9:04one of the challenges when you learn to
- 9:05code yourself you don't necessarily know
- 9:08like the formal terms and things like
- 9:10that that's what i've found when i've
- 9:12picked up something new
- 9:14one of the things i think i found really
- 9:15useful from what fortran does is using
- 9:18two coding things called loops and if
- 9:20statements are like do loops and if loop
- 9:22that means that you can like automate a
- 9:24whole load of things and like set it
- 9:26some sort of decision-making criteria to
- 9:28get your code to do what you wanted to
- 9:30do so if it encounters um so i was
- 9:32working on them atomistic simulations so
- 9:34i encountered like a bond length that i
- 9:36had made too short it could tell me
- 9:38about it it took some of the
- 9:40the mindless treachery out of it yeah
- 9:43you were trying to build your molecule
- 9:44so i think we're all saying like you
- 9:46could concentrate on like the
- 9:47interpretation of the data or whether
- 9:49that fits is a physically possible thing
- 9:52yeah with the the like if statements as
- 9:54well as soon as i found out about them i
- 9:57don't think i've ever stopped using them
- 9:58we've had like a couple of projects
- 10:00where we've had to filter out data
- 10:02especially in labs and like noisy data
- 10:05like you can use if statements to get
- 10:07you like i guess quote-unquote good data
- 10:10to then fit one of our projects like
- 10:12initially one of the main tasks of it
- 10:14was like getting rid of the nands and
- 10:16the infinites and then trying to like
- 10:18actually get the data so you could see a
- 10:20relationship because a lot of the time
- 10:21if you don't actually do that you just
- 10:23get like a horizontal line and like the
- 10:25values are just don't mean anything so
- 10:28i've used if statements
- 10:30way more than i ever thought i would
- 10:32when i first like found them and my mind
- 10:34just keeps on going to them all the time
- 10:36good to know i find it so funny that you
- 10:38said nan because you were the only other
- 10:40person i've ever encountered that says
- 10:41none rather than not a number
- 10:51this is
- 10:52this is not a number this is an end
- 10:55yeah
- 10:56when your math has done something it's
- 10:57just not physical and the equation's
- 10:59like i don't know what that is
- 11:01you just get a whole page of not a
- 11:02number
- 11:03yeah
- 11:04but so i guess that sort of explains one
- 11:07of the benefits of learning to use these
- 11:09languages i mentioned it can take some
- 11:11of the drudgery out of it you mentioned
- 11:13that you can use it to filter things so
- 11:15it can make things a lot easier for you
- 11:18yeah because in chemical engineering
- 11:20also we need to use it or i need to use
- 11:22it just to set boundaries actually for
- 11:25my functions because sometimes for
- 11:27example the function cannot be let's say
- 11:29negative so you need to filter all that
- 11:31data by using um if statement and it's
- 11:34quite funny so it get in my mind so deep
- 11:37so whenever i want for example to go and
- 11:39do some shopping i would be like if the
- 11:42price is
- 11:44if not or if this sandwich is if not and
- 11:47then
- 11:48just crazy
- 11:50you spend your entire time shopping
- 11:52writing logic statements in your head
- 11:54exactly i can't get rid of it actually
- 11:57and my daily life and daily tasks is
- 11:59just funny
- 12:01i love it i think i do some of that in
- 12:02my writing as well i've noticed i'm far
- 12:04more likely to write if and then then in
- 12:06a sentence rather than just using one of
- 12:08those words i sort of alluded to some of
- 12:10the stuff i did in my phd and i feel
- 12:12like i should explain it in a bit more
- 12:14detail to help demonstrate some of the
- 12:16benefits uh so i said my phd was
- 12:19computational chemistry and the starting
- 12:21point there is to build your molecule on
- 12:23your computer which usually involves
- 12:25using coordinates sucks you cut using
- 12:27coordinates and there is software that
- 12:29can do this for you
- 12:30for fairly straightforward well-known
- 12:33molecules but i wasn't working on those
- 12:35i was working on some really novel
- 12:37complicated ones they were polymers and
- 12:40they had maybe 100 atoms or so in each
- 12:42monomer and they had all these
- 12:44not unphysical linkages going on but
- 12:47things that you wouldn't tend to see
- 12:48very often
- 12:49so i had to figure out a way of building
- 12:51them and then once i build them i had to
- 12:54explain to the software that was going
- 12:57to run the molecular dynamics
- 12:58simulations
- 12:59i had to explain to it what my molecule
- 13:01looked like so i had to tell it which
- 13:02atom was bonded to which and then where
- 13:04all the angles were between the bonds
- 13:07and i could have done that by eye and
- 13:08written a very long list but there's no
- 13:11guarantee it would have been correct and
- 13:12it probably would have taken me
- 13:14days to do just one molecule and i had
- 13:1615 molecules in my simulation box i
- 13:19thought of a way of writing some code
- 13:20and fortran i didn't actually know it
- 13:22was going to work i just had an idea of
- 13:24how to do this algorithm using all of
- 13:26these if statements and loop until
- 13:29it had gone through my list of the bonds
- 13:31that i'd written and written down all
- 13:33the angles and various other things for
- 13:34me so that's my example of how coding
- 13:37made my science easier and allowed me to
- 13:39focus on the outcomes of the simulations
- 13:42and building the simulations but what
- 13:44about you guys emma i'm intrigued by
- 13:45your robotic chest playing arm yeah well
- 13:49it's very much early stages of
- 13:50development right now because uh there
- 13:53was people who were working on the arm
- 13:55last year they kind of got it to
- 13:56recognize where it was in 3d space a
- 13:59part of what i'm working on because
- 14:01we have a problem as like a team when we
- 14:03think about all the stuff we have to do
- 14:05every single time it gets more
- 14:06complicated and we're like okay let's
- 14:08try and focus on the simplest of things
- 14:09we can think of right now and then we'll
- 14:12see where we go after that and so we're
- 14:14working on actually trying to get the
- 14:16arm to move to pick up the pieces which
- 14:19sounds easy but then when your pieces
- 14:21could be different sizes it's like the
- 14:24arm's gonna knock some over eventually
- 14:26and so we're trying to figure out what
- 14:28like function is best for the arm to
- 14:30pick up the pieces and uh how we can
- 14:33actually make that efficient because we
- 14:35don't want a chess piece to take five
- 14:36minutes to be took in a game it's a bit
- 14:38too much thinking time for the opponent
- 14:40and so that's what like my subgroup is
- 14:42working on it's been really easy to
- 14:44visualize how the arm is working by
- 14:47using matlab and the psycho robotics
- 14:49like a package that helps you there's
- 14:51always like these limitations which go
- 14:53on because the arm has loads of joints
- 14:55and so those have been pre-coded the
- 14:56year before and so when we run something
- 14:58we can see if that path is going to work
- 15:01because it like visualizes it which is
- 15:03something that's like borderline
- 15:04impossible to do without code because
- 15:07we're working on getting the piece to be
- 15:08picked up and then moved back it's also
- 15:11trying to understand how to get the arm
- 15:12to recognize what piece it is and so we
- 15:15have different parts of that project who
- 15:16are working on playing the game of chess
- 15:18which is a completely separate thing
- 15:20and then actually recognizing where the
- 15:24chess piece is on the board and like
- 15:26what it's taken up i think it's quite a
- 15:28big task but it's been really fun just
- 15:30trying to like think about it and work
- 15:32on it because i'm on physics and a
- 15:35couple of my friends are on it doing
- 15:37physics but there's also a few
- 15:39electrical and electronic engineers and
- 15:41we all think about the same problems in
- 15:44a different way and so they might say
- 15:46something and we're like oh wait that's
- 15:48actually a really good way to think
- 15:49about it that we didn't think of even
- 15:51just being in that environment with
- 15:53engineers and physicists is really
- 15:55useful for a problem that like helps us
- 15:57like actually optimize the code because
- 16:00there's so many ways you can do things
- 16:01in coding sometimes it's not always
- 16:04obvious which one's actually going to be
- 16:06the best one and so a lot of my coding
- 16:09experience has been just like staring at
- 16:11a wall and trying to think about what's
- 16:12actually best and then i'll give it a go
- 16:14and then maybe it works maybe it doesn't
- 16:16yeah that sounds about right so can can
- 16:18the robotic arm can it see the pieces
- 16:22it has a camera and so
- 16:24a lot of there is like an idea for like
- 16:26the the people on the computer vision
- 16:28squad is what they're known as in the
- 16:30group it's like although i think they
- 16:32don't want to do this but it's uh doing
- 16:34like uh qr codes like the leap then
- 16:36beneath the chessboard so that when it
- 16:38picks it up it can read the qr code
- 16:40which corresponds to a piece and then
- 16:42that is how it gets recognized there's
- 16:44loads of ways we could do that's like a
- 16:46process which we're trying to do but
- 16:48first of all i think they're working on
- 16:49like getting the the camera to recognize
- 16:52when something's blocking a square so it
- 16:54means there's a piece there and then
- 16:55they're gonna work on how you recognize
- 16:57the specific piece but there's there's
- 16:58so many ways you could do it you could
- 17:00do it with some form of infrared camera
- 17:02labeling or
- 17:04there's loads of ways but that's like me
- 17:05talking about physics because we're
- 17:07talking about picking up the pieces as
- 17:08well and uh all the physicists on the
- 17:11team were like electromagnets and
- 17:13everyone else was like
- 17:14no
- 17:15yeah i imagine it having like i'll never
- 17:17think about the end of it so it sort of
- 17:19physically pinches things fixed up i
- 17:21mean that's a bit too simplistic i quite
- 17:23like the idea of using magnets but i
- 17:24guess you need to make sure it's gotten
- 17:25close enough to the right piece to pick
- 17:27it up and not pick up the wrong thing
- 17:28yeah i mean i think that was a bit of a
- 17:30joke among the physicists at the time on
- 17:32the arm there is like a hand which can
- 17:34pick it up but we also have to figure
- 17:36out how the hand which is like the two
- 17:38like pincers i guess how we even code
- 17:41that to pick it up and how like much
- 17:44pressure we use and everything like that
- 17:46but like right now we're all thinking
- 17:48it's a year-long project that is a
- 17:50problem for futures
- 17:53you mentioned that you you got a job as
- 17:55a result of learning to code and that
- 17:57sounds really useful
- 17:58getting paid codes yeah
- 18:01that's very true actually it was a
- 18:03positive point on on my cv that i do
- 18:06coding by the same time i understand uh
- 18:08the experimental side of stuff because
- 18:10usually people are either in experiments
- 18:14and they don't want to know anything
- 18:15about coding or they are encoding but
- 18:18they're not very much into experiments
- 18:20and linking both experiments and coding
- 18:23is very useful especially in what i do
- 18:25so you have always to validate what
- 18:28you're coding and modeling
- 18:30in the lab and see if it really makes
- 18:32sense i think i understand what you mean
- 18:34because
- 18:35you can see the problem from two
- 18:36different points of view can't you you
- 18:37can see like how you would code this
- 18:39thing and what the data may look like so
- 18:42it gives you more insight beyond just
- 18:43doing the experiment and seeing what
- 18:46comes out of your chemical engineering
- 18:48rig at the end yeah um i mean in your
- 18:51case laura
- 18:52you did only modeling so you didn't have
- 18:54to validate anything in the lab didn't
- 18:57you
- 18:58uh it was modeling polymers that had
- 19:00been designed by chemists in their lab
- 19:02so there was a little bit of making sure
- 19:04that it did actually have the same
- 19:05properties as the polymers that were
- 19:07made by the chemists i see so there's
- 19:10that link because in my case even in my
- 19:13group whoever is doing
- 19:14modeling they just make sure all the
- 19:16time to
- 19:17validate it with some experiments
- 19:20because actually you can model anything
- 19:21we say in mathematics this is something
- 19:23i learned from my math tutor that if you
- 19:26give me three points i can fit you an
- 19:28elephant
- 19:29so you can you can just basically fit
- 19:32anything but then
- 19:34how do you know it makes sense so you
- 19:36got to go back to experiments and to the
- 19:39physics behind it but also i used coding
- 19:42because i need to solve mathematical
- 19:44equations and partial differential
- 19:47equations which are
- 19:49which you cannot solve without coding
- 19:51actually so that's why i used coding
- 19:54basically to solve these mathematical
- 19:56equations perhaps the physicist can help
- 19:57me out because i remember doing partial
- 19:59differential equations and ordinary
- 20:00different differential equations in my
- 20:02undergrad degree in physics and i i
- 20:05guess they were quite simplistic it did
- 20:07take me a while to get my head around
- 20:08them but they were solvable by hand so
- 20:10i'm guessing you're talking about some
- 20:12more complex interplay between different
- 20:15variables yeah so you're talking about a
- 20:17set of equations with boundary layers
- 20:21and
- 20:21with
- 20:22many functions to be solved all together
- 20:25and a boundary conditions so you're
- 20:27talking about really a complex set of
- 20:29mathematical model that wouldn't be
- 20:32solved without coding so is this the
- 20:34sort of like situation where like i
- 20:37imagine like a really simple chemical
- 20:39processing rig if we're talking about
- 20:41chemical engineering so you've got some
- 20:43sort of like reaction vessel with
- 20:44something going on inside it and you've
- 20:46got stuff flowing in and out and you've
- 20:47got temperature so you have to sort of
- 20:49control all those variables and then
- 20:51use the modeling to predict how those
- 20:53variables affect
- 20:55yeah comes out at the end does that
- 20:56sound right yeah that sounds right but
- 20:58in a more complex way so in my case i
- 21:01need to
- 21:03integrate all together heat transfer
- 21:06mass transfer fluid dynamics altogether
- 21:08make a link to what's happening in my
- 21:11rig
- 21:12and then produce from these physical or
- 21:15mathematical equations a set of final
- 21:17partial differential equations that
- 21:19change with time change with mass
- 21:21changes whatever variable you have and
- 21:23then try to solve it within a boundary
- 21:26conditions that i set to my system
- 21:29i get it and the boundary conditions are
- 21:31like so going up to a pressure of this
- 21:34amount is not possible so that's one of
- 21:36your boundary conditions that sort of
- 21:37thing yeah there's a different type of
- 21:39boundary conditions there's stuff that
- 21:41for example some mathematical equations
- 21:44need to be
- 21:45within a certain value some like cannot
- 21:47be negative for example it's again not a
- 21:49number exactly you cannot divide by zero
- 21:52for example this is a very
- 21:54simple example
- 21:56but also you need to set your your time
- 21:58frame if you're having any operating
- 22:00conditions that you cannot exceed as
- 22:03pressure as temperature and so you need
- 22:05to put all these data so imagine you
- 22:08have all that set of conditions all
- 22:11together and you need to solve the
- 22:13problem so it wouldn't i think maybe
- 22:15it's you can solve it in like i don't
- 22:18know
- 22:19in a lifetime
- 22:20you can't just
- 22:22you know be like
- 22:23old scientists having your board and
- 22:25trying to solve the mathematical
- 22:27equations maybe you would do something
- 22:29about it but yeah yes if i can give like
- 22:32another maybe another example of like
- 22:34something that is a lot simpler to maybe
- 22:37imagine in terms of something where
- 22:40you'd need numerical methods and coding
- 22:42so you know when and you probably did
- 22:44that like gcse physics when you have a
- 22:47pendulum and they ask you solve the
- 22:49equation of the pendulum you know how
- 22:51you only solve it for small angles
- 22:53that's because if you don't just solve
- 22:56it for small angles it's a non-linear
- 22:58problem and so you can't solve that
- 23:01equation like you mentioned before by
- 23:04just solving it by hand you need
- 23:06something else and so for when you have
- 23:08a problem like that it is much easier to
- 23:10just use coding it's very very difficult
- 23:13to do by hand and it seems like an easy
- 23:15problem it's just like a pendulum
- 23:17oscillating but even that you'd need
- 23:20coding i'm really glad you brought that
- 23:22up clear in a similar we actually had a
- 23:25computational project on a simple
- 23:27harmonic oscillator but a force driven
- 23:29simple harmonic oscillator and uh so a
- 23:32part of that like was trying to actually
- 23:34model a regular like unforced simple
- 23:36harmonic oscillator which if you speak
- 23:38to any physicist like if you try hard
- 23:40enough anything it's a simple one a
- 23:42gossip later yeah chemical bonds is a
- 23:44simple harmonic oscillator yeah yeah
- 23:47a part of that project was about solving
- 23:49the like equations of motion when you
- 23:51have a force system which you physically
- 23:54cannot do and so to do that we just
- 23:56literally experimented
- 23:58how different mathematical methods work
- 24:00and how they best fit the results and
- 24:03you use the data you have from the
- 24:05unforced case to find the best method
- 24:07and you apply that to the force case and
- 24:09so you can use it to solve these like
- 24:12impossible non-linear systems in a way
- 24:14that actually is not impossible and
- 24:16actually quite like satisfying to do
- 24:18because you you know you can trust your
- 24:20answers it's not just like oh let's try
- 24:22this and see that this is probably right
- 24:24like you can actually validate that
- 24:26they're going to be a good answer which
- 24:28is kind of impressive when you think
- 24:30about it yeah it's not
- 24:32having knowledge of the physics that's
- 24:34good enough to know when the thing that
- 24:36has been done by the computer actually
- 24:39makes sense yeah physics will take you
- 24:41so far but then you can go further with
- 24:44the code which i think is what's quite
- 24:45nice about it for me learning how to
- 24:48code really helped with my confidence
- 24:50like having that insight into how these
- 24:52things work or even like i know that i
- 24:54can't do that thing by hand because it
- 24:55will take too long or i don't have that
- 24:57insight but i can code something that
- 24:59will give me that information would you
- 25:01guys say the same thing yeah i'd say
- 25:04even just giving me confidence to work
- 25:06on a problem but also doing coding has
- 25:08given me more confidence in my coding
- 25:10ability i knew python first and then
- 25:13moved to matlab for the robotics project
- 25:15but i would have never dreamed of doing
- 25:17that if i didn't already know python and
- 25:20i was kind of babied into python in our
- 25:22like intro to programming module having
- 25:24that confidence to then work on lab
- 25:26projects just like writing my own thing
- 25:29and then working on the robotic arm even
- 25:31though it's in a different language it's
- 25:33like you have that confidence built from
- 25:35just practicing it and then that
- 25:37confidence also helps you with the
- 25:38actual physics behind it and the work
- 25:40behind it i definitely feel like it's
- 25:42helped me understand stuff and actually
- 25:44kind of argue how i understand it better
- 25:47than if i didn't actually use code at
- 25:49all i guess there's something to be said
- 25:51for being able to sift through a load of
- 25:53data which i remember doing at various
- 25:55times in my life and occasionally
- 25:57thought
- 25:58maybe i should code this it might make
- 26:00it easier but it was a one-off thing and
- 26:02i think it would have taken just as long
- 26:03to code it as it would have to do it
- 26:05just in an excel spreadsheet
- 26:07i might be proof wrong at some point in
- 26:09the future yeah i've definitely had
- 26:11experiences where i
- 26:13just didn't have a choice but to code in
- 26:16my last lab so it was a particle physics
- 26:18lab so i had to deal with a data set of
- 26:21nine million different events there is
- 26:24no way you can do that by hand you have
- 26:27to use coding and you have to use this
- 26:30if statements that we mentioned earlier
- 26:32and those while loops and and those
- 26:35functions to make to make nice nice plot
- 26:37in order to make some sense of that data
- 26:39that's a good point and i think so we
- 26:40kind of alluded to using these these
- 26:42loops and if statements it helps with if
- 26:44you've got something really repetitive
- 26:45to do like i mentioned with figuring out
- 26:47what every single angle is between these
- 26:49bonds in this molecule yeah my case it
- 26:51was a lot of filtering which i guess we
- 26:53also mentioned before so removing
- 26:55everything that's negative everything
- 26:56that's i'm not a number
- 26:58or
- 27:00in my case i had to look at the data if
- 27:02i was in between two different energies
- 27:05so i had to just like filter those out
- 27:07for example yeah and one of the things
- 27:10it became useful for the simulations i
- 27:13did i fed my molecules into some
- 27:15software one of the software packages
- 27:17did monte carlo simulations of them
- 27:19which is where it adds a random particle
- 27:22somewhere into my system and then
- 27:24calculates the forces acting on that
- 27:26particle and then makes it essentially
- 27:28flips a coin to say is that particle and
- 27:30stay there or not based on the forces
- 27:33the energy in that particular instance
- 27:36and you do that enough times to get
- 27:38what's called good statistics uh
- 27:40statistics that represent what you would
- 27:42see in real life i think is what that
- 27:44phrase means yeah i mean i've done a
- 27:46similar thing with the monte carlo
- 27:48techniques and simulations in a project
- 27:50on neutron scattering it assigned like
- 27:52you have a random number and then
- 27:53depending on the probability of that
- 27:55neutron being absorbed by some form of
- 27:57attenuating material you can actually
- 28:00build up a representation of that
- 28:02material as like an attenuating material
- 28:04and so you can actually use it to apply
- 28:06it which is what i did like as an
- 28:07extension of my project i applied it to
- 28:10if you were going to use like a
- 28:11materials like a moderator in a nuclear
- 28:15experiment or nuclear um what do you
- 28:17think is the right word nuclear
- 28:19you could say that nuclear reactor yeah
- 28:22yeah nuclear reactor and you can in
- 28:24flight to figure out like
- 28:25which material be the best as a
- 28:27moderator and so by like investigating
- 28:29the effects of like graphite lead or or
- 28:32water you can actually use the monte
- 28:34carlo techniques to get a really
- 28:36efficient way
- 28:37of trying to actually just like get the
- 28:39properties of those materials and
- 28:41actually compare them using numbers and
- 28:43not just like using your brain because a
- 28:45lot of the time i was like
- 28:46like lead is obviously not going to be
- 28:48as good as graphite or water or and it's
- 28:51just kind of like actually having
- 28:53numbers to kind of back up what you know
- 28:55from wherever it is you know that
- 28:57information from the monte carlo
- 28:59techniques was definitely just
- 29:00interesting to do and i guess that
- 29:01example of a nuclear reactor if there's
- 29:03radiation going on and you can do it
- 29:05with the simulation rather than exposing
- 29:08yourself to ionizing radiation it also
- 29:10is a better way of doing things like a
- 29:12lot of safety equipment i suppose
- 29:14that's my background in
- 29:16the nuclear industry coming out
- 29:18yeah i did a summer project at the uka
- 29:21last summer so nuclear fusion and there
- 29:24is so much monte carlo going on i didn't
- 29:27do that personally but everyone around
- 29:28me was doing that just figuring out what
- 29:31are the best materials to use in this
- 29:34future nuclear fusion um
- 29:37small reactor nuclear fusion it's uh
- 29:40there's a reaction going on it's i guess
- 29:42yeah fusion and not efficient
- 29:46in the those nuclear fusion devices
- 29:50just makes it sound like a mobile phone
- 29:52like a handheld device so
- 29:54it's a lot bigger
- 29:56but yeah it does the same right
- 29:57simulations do get used a lot to do
- 29:59things that would otherwise be quite
- 30:01difficult or maybe even dangerous i
- 30:03suppose you can do experiments on a
- 30:05computer
- 30:06i accidentally made many small suns when
- 30:09i was doing my simulations because i've
- 30:11accepted the simulation up very slightly
- 30:12wrong so you need to put the time and
- 30:14the effort and invest in your skill and
- 30:17not be afraid of being a newbie anyone
- 30:19can learn how to code yeah a good point
- 30:22of that is like when i've been coding
- 30:23it's been for like a specific purpose
- 30:26and so all i really know about code is
- 30:28like oh can you do this like measuring
- 30:30the drop law can you measure this seem
- 30:33like this non-linear system or monte
- 30:34carlo integration or can you look at a
- 30:36robotic arm and like there's so much you
- 30:37can do with code and it is quite scary
- 30:39to just sometimes think about what you
- 30:41know is such a tiny like subset of all
- 30:44that there is but i think knowing that
- 30:47you're good at what you can do is enough
- 30:49to give you confidence with code because
- 30:51i think with all the subjects you think
- 30:52you need to have a really like huge like
- 30:54grasp on it but with coding you you can
- 30:57understand it and be good at it by only
- 30:58knowing like this small fraction of what
- 31:00to do because it's just what applies to
- 31:03what you're doing individually and so
- 31:04you'll meet people that like seem like
- 31:06they know so much about code but then
- 31:08when you get to talking to them they
- 31:10really just know about what they're
- 31:11doing and they might not be able to
- 31:12understand what you're doing that's true
- 31:14i know when i was doing my phd there was
- 31:16one person in my lab there's about 15 of
- 31:18us in this computer lab there's one
- 31:19person that i kept asking questions of
- 31:21and he's like you know i don't really
- 31:22know this right i'm just really good at
- 31:24googling it
- 31:26clearly that's a skill that i don't
- 31:27possess because i could try and google
- 31:29something and i wouldn't get an answer
- 31:31that made sense to me but maybe just
- 31:32having that person talk to me about what
- 31:35they'd found in google made that
- 31:37difference so i guess that says
- 31:38something like your work learning
- 31:39environment as well find an environment
- 31:41that works for you yeah i think a lot of
- 31:43the problem as well if you have a
- 31:44problem with your code because it's so
- 31:46personal to how you wrote it the person
- 31:49who has to try and understand you
- 31:50understand your code to understand your
- 31:52problem to them fix your problem and
- 31:54then you have to implement that in your
- 31:56code and so the whole like learning
- 31:58process when you ask somebody else
- 32:00sometimes can even be a bit longer than
- 32:02just trying to learn yourself i found
- 32:04that a lot that i was actually getting
- 32:06more out of debugging by just trying to
- 32:09fix it myself because other people would
- 32:10look at it and be like i
- 32:12don't know what you've done here and i'm
- 32:13like oh it's just this and this but it
- 32:15doesn't really necessarily make sense
- 32:17sometimes until you clean up of course i
- 32:19feel like a lot of code is just a mess
- 32:21before you try and actually like make it
- 32:22neat i took to putting comments in my
- 32:25code quite a lot just in case my code
- 32:28had to be passed on to someone else who
- 32:29would use it in their phd to sort of
- 32:31sharing bits of information with each
- 32:33other so i comment is something that the
- 32:35computer or the compiler doesn't read
- 32:36but the people looking at the code can
- 32:38read it and say oh that's what that
- 32:39section of code means i get it that's
- 32:42what that person was doing
- 32:44yeah comments and doc strings for sure
- 32:46in the functions yeah and if you write
- 32:48code without commenting i mean is that
- 32:49really valuable because no one else can
- 32:51understand what your thought process was
- 32:52at the time we got told at the start of
- 32:54our like first module it's like code is
- 32:57read more than it's wrote so make sure
- 32:59you write it well and like in that
- 33:01module i think i was so perfect with how
- 33:03i wrote my code but when i'm like
- 33:04roughly doing something in labs it's so
- 33:06quick to just like assign some bad
- 33:08variable names which i need to fix later
- 33:12but um you ever call them just like
- 33:14susan or dave or something i remember
- 33:17what that means
- 33:19like abcd and then you just go through
- 33:21the whole alphabet and then you're like
- 33:23let's start with the green one
- 33:26it just makes sense to call your
- 33:28variables the thing that they actually
- 33:29reflect otherwise you get very confused
- 33:32don't call them susan
- 33:34with my weird deviations calling
- 33:35variables susan
- 33:38rather than pressure and temperature
- 33:40which would make more sense i think
- 33:41that's probably a good place to draw
- 33:43this to a close so uh hopefully we've
- 33:45introduced valued listeners to uh some
- 33:47different types of coding and how they
- 33:49vary from each other and how you can use
- 33:51it to control something or make a robot
- 33:53arm do what you want it to do or to
- 33:55analyze some data that you wouldn't be
- 33:56able to do yourself or to simulate some
- 33:58atoms that you maybe couldn't do in the
- 34:00lab anyone can code and you can find a
- 34:02way of learning that works best for you
- 34:04whether that's finding the right
- 34:04environment or finding someone to ask or
- 34:07finding videos online and it helps to
- 34:09have a goal to work towards when you're
- 34:12doing that coding so you can start small
- 34:14and then build up your skills from there
- 34:16so if you like listening to this and you
- 34:17want to carry on the conversation with
- 34:19us you can find us on twitter you can
- 34:20leave a comment on the episode or you
- 34:22can email us as well
- 34:24the views expressed in this podcast
- 34:25belong entirely to the person that said
- 34:27them they do not represent any industry
- 34:28or organization if you enjoyed listening
- 34:30to these views it would really help us
- 34:32out if you could rate us leave a review
- 34:33and tell a friend this podcast was
- 34:35sponsored by no one but if you're
- 34:36interested in funding us to continue to
- 34:38have frank discussions about science and
- 34:39engineering please get in touch
- 34:41[Music]