Ok,
i use in this exmaple a grid size with dimensions Nx,Ny (4x4).
The 'particle' will be initial at position xpos,ypos.Then you choose a step in both sirections (stepx,stepy) and you must calculate the new position (xpos,ypos) after applying the periodic boundary conditions)...
I mean , i am confused at how to return xup,xdown to new xpos and yup ,ydown to new ypos.
Ok , use a structure but how to relate xup and xdown with xpos?
Thank you
Hello , i am trying to implement this algorithm for 2d grid.
1) i am not sure if my calculations are correct.
2 ) i don't understand how to return my final calculation ( how will i insert to the matrix i want (the 's' in this example) the new coordinates (xup,xdow,yup,ydown)).
I mean ...
Hello and thanks for the help.
C_1 and C_2 are scalars.
So, ok J*R=..=scalar.
But i can't understand how to do the (J*R|R*C_2) .
I will compute the J*R and then the R*C_2 , and then what?
Hello,
I have this equation that computes the electric field from electric currents.
E=-j*k_n (J*C_1- (J*R|R*C_2) e^ -j*k*R/4πR )
The data are:
k_n=377 , k=20.93 , R=Sqrt(3) ,J_x=0.72576821 ,J_y=0.03763659 , J_z=0.86104220 ,
C_1=0.999239077741 + 1 / 36.2518234024j...
Hello ,
i have the algorithm attached.
the compiler gives me the following errors:
where i have "t=new double [x];" it gives -> error: expression in new-declarator must have integral or enumeration type|
and where " result=w*f(*t); " ->error: invalid operands of types ‘double*’...
Hello , i have the algorithm attached and i am trying to execute it in c++.
My code until now is : ( i have created the function f with limits (-1,1) )
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cmath>
using namespace std;
const double...
I used the same code in mathematica and it works fine.It gives me the right answer after 2 iterations.The same is happening here but it continues to step 8.(it gives me the right result every "even" steps)..
Ok, i changed the for loops : for (int i=1;i<=n/2-1;i++)
for (int i=1;i<=n/2;i++)
(it was a mistake ,i didn't want to insert double values in the loops!)
But now again , it gives me the exit as a say above..
Hello,you are right but
if i do :
int n=1;//initial point
result=simpson(1.0,2.0,n);
while (fabs(result-exact)>eps) {
result=simpson(1.0,2.0,n);
cout <<"\nFor n = "<<n<<",error = "<<fabs(result-exact)<<",value = "<<result;
n++;
}
then the loop...
c++ simpson's method --loop doesn't stop
Hello, i have done the simpson's method and it works fine.My problem is that it doesn't stop when it gives me the desired result but the loop continues for ever..
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include...