- #1
yup790
- 21
- 0
I was wondering which programming language I should learn for general purpose calculations and physics simulations.
I already know a bit java.
I already know a bit java.
yup790 said:I was wondering which programming language I should learn for general purpose calculations and physics simulations.
I already know a bit java.
phinds said:FORTRAN, as old and creaky as it is, has TONS of subroutines that have accumulate over the years specifically for scientific applications so that's in its favor. If you plan on doing much in modern computing, especially outside of science programming, I recommend that whatever you pick, it be fully OO like Java or C++ or C# or VB.NET
PICsmith said:I just want to point out that while Olde FORTRAN (77 and earlier) is indeed old and creaky (though still very useful), modern Fortran (90 and later) is comparable to the other languages mentioned, and is fully OO now.
cmb said:Fortran 77. Is there another language yet that directly handles complex variables?
#include <iostream>
#include <complex>
using namespace std;
int main ()
{
complex<double> z1, z2, z3;
z1 = complex<double> (1.0, 2.0);
z2 = complex<double> (3.0, 4.0);
cout << "z1 = " << z1 << endl;
cout << "z2 = " << z2 << endl;
z3 = z1 + z2;
cout << "Sum = " << z3 << endl;
z3 = z1 * z2;
cout << "Product = " << z3 << endl;
return 0;
}
PICsmith said:But if I were you, I'd just stick with Java if you already know it well.
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
// my attempt at a complex-valued acos() function
complex<double> acos (const complex<double>& x)
{
const complex<double> eye = complex<double>(0,1);
const complex<double> one = 1;
return -eye*log(x + eye*sqrt(one - x*x));
}
int main ()
{
complex<double> z = 2;
cout << acos(z) << endl; // this outputs "(0,1.31696)"
return 0;
}
jtbell said:C++ does.
uart said:I really hate Fortran I/O.
cmb said:If you want (/need) flash and bling, buy MatLab.
cmb said:OK, so what does C++ return when you enter cos-¹(2)?
F77 returns a complex value.
/* File complex_itrig.h */
/* Uart's complex inverse trig library */
#include <complex>
typedef std::complex<double> cmplx;
const cmplx _I = cmplx(0.0,1.0);
const cmplx _1 = cmplx(1.0,0.0);
cmplx atan(cmplx x) {
return 0.5*_I*( log(_1 - _I*x) - log(_1 + _I*x) );
}
cmplx asin(cmplx x) {
return atan( x / sqrt(_1-x*x) );
}
cmplx acos(cmplx x) {
return atan( sqrt(_1-x*x) / x );
}
cmplx acosh(cmplx x) {
return -_I * acos(x);
}
cmplx asinh(cmplx x) {
return -_I * asin(_I*x);
}
cmplx atanh(cmplx x) {
return -_I * atan(_I*x);
}
cmb said:For 'general' use (implying graphs, diagrams and 'free') I was planning to take a good look at the current state of VPython sometime. Has anyone any experience with VPython?
Manju K said:Hi...i'm new to ths blog...
Plz tel me, homework s Fortran(Gfortran95) language?
cmb said:OK, so what does C++ return when you enter cos-¹(2)?
F77 returns a complex value.
pairofstrings said:Hello everyone. Sorry to jump in and ask this question.
I want to make complex calculations and plot it's graphs, should I use Matlab? Can Matlab perform complex mathematical calculations, like calculating expressions that contain inverse trigonometric functions(OP's actual question), logarithms, matrices, etc.? I know Matlab can create graphs. How about C++. I have not seen C++ make any graphs. Is it possible to plot graphs using Java/C/C++? Tell me your best language which can do things like complex mathematical calculations and plotting graphs and physics simulations, or just complex mathematical calculations and plotting graphs, in a single environment. If there's any thing like that. Thanks.
Krunchyman said:As for Matlab, and other scientific programming languages, it's designed specifically for working with things like graphs.
pairofstrings said:Okay. Can I even do complex mathematical calculations in Matlab along with plotting graphs of complex mathematical equations?
chiro said:The basic structure in MATLAB is a matrix type of object.
The way you typically plot graphs in MATLAB is to create row vectors corresponding to your variables (like x and y), and MATLAB provides a lot of routines to generate vectors with certain values (like say for your x-axis), and defining functions is also very easy for calculating your f(x) for example.
If you want to use MATLAB, its a good idea to look up function handles, the linspace command, and the plot functions for what you have described above (functions and graphing).
pairofstrings said:"Okay. Can I even do complex mathematical calculations in Matlab along with plotting graphs of complex mathematical equations?"
Is that a yes? - you mean we can do complex mathematical calculations in Matlab?
Example:
Suppose I want to draw a graph for sec θ=x + 1/4x
I want 'θ' on the y-axis and different values of 'x' on x-axis. Can I plot the graph?
I am Sorry if I am going beyond the context of what should be asked in "Programming & Comp Sci" section. But if anyone here who is good at Matlab can explain me this. That would be great. Just want to know if it's possible to plot graph of complex mathematical functions after performing complex mathematical calculations(calculations involving Calculus, Algebra, Trigonometry, Probability), both done in the Matlab software. I will be doing Digital and Analog Signal Processing and Analysis. Purpose is to analyze signals/graph and generate random signals/graph. I don't want to switch softwares and languages after finding out that it's not useful for my purpose. I only know that Matlab can do things like recognition/detection.
When choosing a programming language, you should consider the purpose of your project, the level of experience of your team, the availability of resources and support, and the compatibility with other systems and tools.
Many experts recommend starting with a high-level language such as Python or Java for beginners. These languages have simpler syntax and are widely used, making it easier to find resources and support.
Front-end languages, such as HTML, CSS, and JavaScript, are used to create the visual and interactive elements of a website or application. Back-end languages, such as Java, C++, and Python, are used to handle the server-side operations and data processing.
There is no one "best" language for web development, as it depends on the specific needs of the project. However, popular languages for web development include JavaScript, PHP, and Python.
Yes, it is common to use multiple programming languages in a project, especially in larger and more complex projects. For example, a web application may use HTML, CSS, JavaScript, and a back-end language like PHP or Python.