تبلیغات
برنامه نویسی به زبان ++c - برنامه حل معادله به روش گاوس در حالت کلی
 
برنامه نویسی به زبان ++c
درباره وبلاگ



مدیر وبلاگ : برنامه نویس
نویسندگان
نظرسنجی
شما از کدام سیستم عامل استفاده می کنید؟








آمار وبلاگ
  • کل بازدید :
  • بازدید امروز :
  • بازدید دیروز :
  • بازدید این ماه :
  • بازدید ماه قبل :
  • تعداد نویسندگان :
  • تعداد کل پست ها :
  • آخرین بازدید :
  • آخرین بروز رسانی :

/* Gaussian Elimination */
#include <math.h>
#include <stdio.h>

int main()
{
double matrix[16][16];
double b[16],x[16];
int n,i,count,j;
double ratio,temp;

/* Read in matrix and b */
scanf("%d",&n);
printf("The matrix is %d by %d\n",n,n);
printf("Matrix:\n");
for(i=0;i<n;i++){
        for(j=0;j<n;j++){
                /*scanf("%lf ",&matrix[i][j]);*/
                /* for Hilbert matrix */
                matrix[i][j] = 1. / (i+j+1);
        }
        scanf("%lf ",&b[i]);
        scanf("\n");
        b[i] = 1.;
}
for(i=0;i<n;i++){
        for(j=0;j<n;j++){
                printf("%lf ",matrix[i][j]);
        }
        printf("\n");
}
printf("Right Hand Side:\n");
for(i=0;i<n;i++){
        printf("%lf ",b[i]);
}
printf("\n");
/* Gaussian elimination */
for(i=0;i<(n-1);i++){
        for(j=(i+1);j<n;j++){
                ratio = matrix[j][i] / matrix[i][i];
                for(count=i;count<n;count++) {
                        matrix[j][count] -= (ratio * matrix[i][count]);
                }
                b[j] -= (ratio * b[i]);
        }
}
for (i=0;i<=n-1;i++){
        for(j=0;j<n;j++){
                printf("%lf ",matrix[i][j]);
        }
        printf("\n");
}
/* Back substitution */
x[n-1] = b[n-1] / matrix[n-1][n-1];
for(i=(n-2);i>=0;i--){
        temp = b[i];
        for(j=(i+1);j<n;j++){
                temp -= (matrix[i][j] * x[j]);
        }
        x[i] = temp / matrix[i][i];
}
printf("Answer:\n");
for(i=0;i<n;i++){
        printf("x%d = %lf\n",i,x[i]);
}
}





نوع مطلب : برنامه نویسی، 
برچسب ها : زبان سی، c++، visual studio c، برنامه نویسی، سی پلاس پلاس، پروژه c، روش حذفی گاوس، روش حذفی گاوس در حالت کلی،
لینک های مرتبط :

       نظرات
جمعه 22 اردیبهشت 1391
برنامه نویس
شنبه 5 مرداد 1398 04:34 ق.ظ
Round about guys gather additions of the have possession of fat,
hyaluronic p or even man made matter toward increase the fullness with the male member shank.
It can be not clear whether or not this insertion is there safe and sound and it has not really been attested to
facilitate vaccinations preserve augment manhood mass.

And since using the different formulaes, it will not improve the operate of the penis.

In this article, we pray check out that cure
imparts the most effective answer. Ensued unusual.
You can view advertisements pertaining to gel, creams or oils with says
in the direction of manhood rise. Effects that you'll be able to apply to your current male member might hold hormones, body issue boosting drugs,
oils or maybe parsleys, otherwise vitamin supplements.
There is no evince that your relevant produce
may improve the dimension of ones male member, moreover round about could potentially cause a skin tone response
as well as irritation.
There's an array of Male organ Growth Capsule in the marketplace in the present day.
Most of them develop the attitude that will the usual organic ingredients raise body drift
to the manhood. We notice how the product that will drudgeries for example qualities
might not exactly work with the subsequent so you should be well thought-out as soon as deciding on the right
supplement for you. Out of the numerous supplement to
argue to function, we have gone for particular reputable re-examine never-endingly
ones behalf, due to the fact they have a demonstrated popularity.
They heard a great ratings regarding customer and well known because paramount tablet.
دوشنبه 12 فروردین 1398 11:01 ق.ظ
jnglcqwhl tadalafil la rochelle http://cialissom.com/ cialis [url=http://www.cialissom.com/]low cost cialis 20mg[/url] tadalafil kadınlarda kullanabilir mi
شنبه 18 شهریور 1396 11:44 ق.ظ
I will immediately grab your rss as I can't in finding your e-mail subscription link or e-newsletter service.
Do you've any? Kindly permit me recognize so that I could subscribe.
Thanks.
یکشنبه 15 مرداد 1396 03:03 ب.ظ
When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is
added I get four emails with the same comment.

Is there any way you can remove people from that service?

Thanks a lot!
یکشنبه 15 مرداد 1396 12:57 ق.ظ
It's in fact very complex in this busy life to listen news on Television, so I only use the web for that reason, and obtain the latest information.
دوشنبه 9 مرداد 1396 09:45 ب.ظ
These are truly enormous ideas in regarding blogging.

You have touched some good points here. Any way keep up wrinting.
دوشنبه 25 اردیبهشت 1396 12:31 ب.ظ
I enjoy what you guys are up too. This type of clever work
and reporting! Keep up the wonderful works guys I've included you guys to our blogroll.
سه شنبه 22 فروردین 1396 03:26 ب.ظ
Very quickly this web page will be famous among all blogging people, due to it's nice content
یکشنبه 13 فروردین 1396 02:37 ب.ظ
We're a group of volunteers and starting a
new scheme in our community. Your website provided
us with valuable information to work on. You have done a formidable
job and our whole community will be thankful to you.
شنبه 12 فروردین 1396 02:22 ب.ظ
اقا این برنامه جواب درست نمیده من امتحان کردم
برنامه اشتباهه
شنبه 12 فروردین 1396 02:10 ب.ظ
اقا این برنامه جواب درست نمیده من امتحان کردم
برنامه اشتباهه
جمعه 11 دی 1394 11:23 ب.ظ
اگه امکانش هست ی ماتریس 5.5رو با زبان ویژوال برنامه نویسی کنید با روش حذف گوس
ممنون
پنجشنبه 16 آبان 1392 05:25 ب.ظ
اجرکم عندالله
شنبه 27 مهر 1392 05:34 ب.ظ
سلام. میشه لطفا برنامه ای بنویسید که به روش حذفی گاوس با محورگیری جزیی دستگاه AX=b را حل کنه.
دوشنبه 11 دی 1391 08:39 ب.ظ
salam
mishe lotfan barnameye matrise gos be soorate class dar c++ benevisid?
tashakor az webloge khoobetoon
دوشنبه 11 دی 1391 08:24 ب.ظ
salam
mishe lotfan barnameye matrise gos be soorate class dar c++ benevisid?
tashakor az webloge khoobetoon
دوشنبه 4 دی 1391 09:54 ق.ظ
Man kolli az weblogetun yad gereftam
Mamnoon
برنامه نویس
خواهش می کنم
چهارشنبه 15 آذر 1391 10:24 ق.ظ
agha mamnun karam rah oftad
برنامه نویس خواهش می کنم
یکشنبه 24 اردیبهشت 1391 02:20 ب.ظ
ممنون بابت لطف زیادتون
خیلی به دردم خورد
موفق باشید
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر