How to calculate rotation, divergence in C/C++

  • Context: C/C++ 
  • Thread starter Thread starter walnutTree
  • Start date Start date
  • Tags Tags
    Divergence Rotation
Click For Summary
SUMMARY

This discussion focuses on calculating divergence and rotation of vector fields using C/C++. The user seeks assistance in implementing these calculations, specifically highlighting the need for a custom "Vector" class to handle mathematical operations, as C++ lacks native support for such objects. The Boost uBLAS library is recommended as a resource for vector operations, while numerical differentiation techniques are noted as relatively straightforward to implement in C++. The conversation emphasizes the complexity of the task compared to higher-level languages like Matlab.

PREREQUISITES
  • Understanding of C++ programming and object-oriented design
  • Familiarity with vector mathematics and operations
  • Knowledge of numerical differentiation techniques
  • Experience with the Boost uBLAS library for linear algebra
NEXT STEPS
  • Implement a custom "Vector" class in C++ for mathematical operations
  • Explore the Boost uBLAS library for vector manipulation
  • Research numerical differentiation methods applicable in C++
  • Study the mathematical concepts of divergence and curl in vector calculus
USEFUL FOR

Software developers, particularly those working in scientific computing or physics simulations, as well as students learning about vector calculus and its applications in programming.

walnutTree
Messages
5
Reaction score
0
Dear Experts,

I started to look deeper into the electromagnetic fields.
So I would like to write a simple code in C/C++, which is capable of calculating the divergence or rotation of the vector fields.

Could someone helps me please, to get this started?
How to illustrate partial derivatives in the program?

I would be very grateful for your helps!
 
Technology news on Phys.org
Unfortunately your program won't be very simple! Unlike a 4-th generation language such as Matlab, C++ does not natively support mathematical objects such as vectors. You'll need at least to write a "Vector" class, and define your operators (div, curl, etc) based on that.

You might be interested in the uBLAS library in Boost (www.boost.org).

Numerical differentiation is more or less straightforward in C++, Google should help you out with that.
 

Similar threads

  • · Replies 22 ·
Replies
22
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
81
Views
7K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 29 ·
Replies
29
Views
8K
Replies
53
Views
5K
  • · Replies 25 ·
Replies
25
Views
1K