import matplotlib.pyplot as plt
R = 2
for x in range(0,50):
y = x**R
# plt.plot(x,y,marker = 'o')
plt.plot(x,y,'--')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('plot test')
plt.legend()
plt.show()
The reason I am looking to understand how to put it in the subroutine, is I am looking to learn how to build larger code in the future and use makefiles to compile.
In terms of how fast i can't tell for now as they both run in a blink
Dear FactChecker the following is the corrected version that works with your helps :), Thanks
======================================================================
program msd
implicit none
real, parameter :: tstop=100.
integer i
real, dimension(2000) :: t,y,v
open (2, file = "test.txt")...
I have a simple Fortran code for solving velocity and displacement of spring, the code works fine when writing all together without using a subroutine. but as I am learning Fortran I tried to do it using subroutine, but I keep getting errors
appreciate any help in advance.
program msd
implicit...
Thank you very much for your answer
I am trying to follow the change of s as a function of time and h, then plot s vs h.
for example: if s is a strength of a material, while h is height (from 100 to 1cm), I would like to plot s vs h for 100 years time.
Kind regards,
Joseph
I am trying to solve the following first order ODE using a simple Fortran code :
$$ ds/dt=k_i * \sqrt{v}$$
where both (ki) and (v) are variables depending on (h) as follows
$$ k_i=\sqrt{χ/h^2}$$
$$v= \mu h$$
where (μ) and (χ) are constants. (the arbitrary values of each of them can be seen...
Hello
My name is Joseph I am a physics student, I am new to Fortran, I know how to write a code for solving differential equations, but now I have a physics equation for evolving star rotation as a function of mass. and I do not know how to evolve (using any numerical method, such as Euler) so...