Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What Language do I need?

  1. Oct 23, 2012 #1
    What Language do I need??

    Hi All,

    I'm an experimental physicist working on nanomaterials for solar cells. I am looking at silver nanowires for transparent conductive electrodes.

    I'm looking to simulate a random resistor network utilising some data on resistivities I will be measuring using a nano 4 point probe.

    Basically first I want to simulate a number of random networks, then if I remember my 2nd year EM course correctly (it was some time ago!!) I can use kirchoff's laws to solve them.

    I have a general idea of how this will work using a few basic coding skills I picked up from codeacademy. But I have never written any code/done any simulations before so was wandering what language do I want to use to try and do this. My initial assumptions would be C++ or Fortran.

    Any direction in this would be great.


  2. jcsd
  3. Oct 23, 2012 #2


    User Avatar
    Science Advisor

    Re: What Language do I need??

    If you just want to simulate a resistor network, I don't think you should go to a basic coding language like C or Fortran. You should use existing software designed to simulate circuits, like SPICE. There are free versions of SPICE, like ngSPICE, available online.
  4. Oct 23, 2012 #3

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Re: What Language do I need??

    C++ is a very powerful language but has a steep learning curve. I would not recommend C++ as a first language. If you insist on a compiled language, I recommend starting with C or Fortran.

    There are other options. Three come to the top of my head:
    • Python.
      Python is a free, general purpose, and highly extensible scripting language with lots and lots of various specialized modules. The syntax is fairly easy to learn. It's free, as are the modules. Python itself isn't aimed at scientific computing, but there are modules galore that are.

    • Matlab.
      Matlab is a proprietary scripting language aimed specifically at scientific computing. The syntax is once again fairly easy to learn. Matlab has a very nice graphical user interface (GUI). Help is immediately available, and the plots are absolutely fantastic. Matlab has one huge downside: It's not free. It is so very, very far from free. However, being an experimental physicist, you almost certainly have free access to it through your research institute or employer. Ask your sys admin, or ask around via email. One of your coworkers will be more than happy to give a demo.

    • Mathematica.
      Mathematica is a proprietary scripting language aimed specifically at mathematical computing. The syntax is a perhaps a bit bizarre, but it makes sense once you learn it. It, too, has a very nice GUI and it, too, makes absolutely fantastic plots and graphs. Mathematica has the same downside as Matlab: It too is a rather expensive product (but not quite so bad as Matlab). It's also a bit more of a niche product than is Matlab, so you may or may not already have access to it. Once again, ask around.
    Last edited: Oct 23, 2012
  5. Oct 23, 2012 #4
    Re: What Language do I need??

    For first programming projects Matlab is excellent in my experience. The help-function is easy to use, it tells you what you're doing wrong, and there are many good tutorials available.
  6. Oct 24, 2012 #5
    Re: What Language do I need??

    Matlab is the most reasonable choice, given likely academic availability.

    Mathcad is an alternative that may be available. It has reasonable 2D and 3D graphing capability but offers the major advantage of being largely WYSIWYG as far as mathematical notation goes, making many investigations self-documenting - think of it as a smart mathematical whiteboard. ... caveat: stick to Mathcad 15 until they sort Mathcad Prime out.
  7. Oct 24, 2012 #6


    User Avatar
    Science Advisor

    Re: What Language do I need??

    Hey RossJJ and welcome to the forums.

    I would echo phyzguys advice on using something like a SPICE package: the stuff is ready made and ready to use, and if you want to see source code then get an open source project and dig through it.

    Also if you have no coding experience, then be aware that if you just need this to get relevant results for your electrical networks, using something that again is ready made, in use already, and ready to use is a much better option.

    Also things that are mature in development are usually already developed in an optimum way to get things done quickly where those things are common problems faced in that field, so they will have designed the program and its interface to aid solving problems in an efficient way and learning that interface is going to be much better (and will help you understand the field as well) than trying to create everything from scratch.
  8. Oct 24, 2012 #7

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Re: What Language do I need??

    Even more importantly, things that are mature in development give the right answer. They have been tested umpteen ways to Sunday. Those commercial packages are accurate, stable, and fast.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook