Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void make_matrix(double t, FILE f, int N, int M){
- double t1 = 1 / t;
- for (int i = 0; i <= N + 1; i++){
- for (int j = 0; j <= N + 1; j++){
- if ((i == j && i == 0) || (i == j && i == N + 1)){
- fprintf(f, "%d ", 1);
- }
- else{
- if ((i == 0) || i == N + 1){
- fprintf(f, "%d ", 0);
- }
- else{
- if ((i == j - 1) || (i == j + 1)){
- fprintf(f, "%lf ", - 1 / pow(h, (double) 2));
- }
- else{
- if (i == j){
- fprintf(f, "%lf ", 2 / pow(h, (double) 2) + t1);
- }
- else{
- fprintf(f, "%d ", 0);
- }
- }
- }
- }
- }
- fprintf(f, "%lf\n", sin(h * i) + (1 + pow(exp, -t)) * sin(h * i));
- }
- fclose(f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement