Simulate Random Resistor Networks: What Language Do I Need?

  • Thread starter Thread starter RossJJ
  • Start date Start date
  • Tags Tags
    Language
Click For Summary

Discussion Overview

The discussion revolves around the appropriate programming language for simulating random resistor networks, particularly in the context of experimental physics and nanomaterials for solar cells. Participants explore various software options and programming languages suitable for this task, including considerations of ease of use and availability.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Ross expresses a need for guidance on which programming language to use for simulating random resistor networks, considering C++ or Fortran based on his previous knowledge.
  • One participant suggests using existing software like SPICE for circuit simulation instead of starting with a basic coding language.
  • Another participant mentions that while C++ is powerful, it has a steep learning curve and recommends starting with C or Fortran if a compiled language is preferred.
  • Python is proposed as a user-friendly, free, and extensible option with many specialized modules for scientific computing.
  • Matlab is highlighted as a strong choice for scientific computing, with a user-friendly interface and good availability in academic settings, despite being proprietary.
  • Mathematica is mentioned as another proprietary option, noted for its mathematical computing capabilities and graphical output, but also comes with access limitations.
  • A participant shares positive experiences with Matlab for first programming projects, citing its helpful functions and available tutorials.
  • Mathcad is suggested as an alternative with good graphing capabilities and a user-friendly interface for mathematical notation, though a specific version is recommended due to issues with newer releases.
  • Another participant emphasizes the benefits of using established software packages for efficiency and reliability, especially for those with no coding experience.
  • There is a reiteration of the advantages of mature software development, including accuracy and stability, which can provide reliable results without the need for extensive coding knowledge.

Areas of Agreement / Disagreement

Participants present multiple competing views on the best programming language or software to use, with no consensus reached on a single preferred option. Some advocate for established software like SPICE, while others suggest various programming languages, indicating a diversity of opinions on the best approach.

Contextual Notes

Participants express varying levels of familiarity with programming and simulation, which influences their recommendations. The discussion reflects a range of assumptions about access to proprietary software and the learning curve associated with different programming languages.

RossJJ
Messages
1
Reaction score
0
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 kirchhoffs 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.

Thanks.

Ross
 
Physics news on Phys.org


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.
 


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:


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.
 


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.
 


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.
 


chiro said:
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.
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.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
Replies
4
Views
2K
  • · Replies 397 ·
14
Replies
397
Views
22K
  • · Replies 133 ·
5
Replies
133
Views
12K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 44 ·
2
Replies
44
Views
6K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 106 ·
4
Replies
106
Views
16K