线性代数 (1)(c 语言版)

第一

二阶矩阵

#include<stdio.h>

int main()

{

    double a11,a12,b1,a21,a22,b2;

    scanf("%lf %lf %lf",&a11,&a12,&b1);

    scanf("%lf %lf %lf",&a21,&a22,&b2);

    double D,D1,D2;

    D = a11*a22-a12*a21;

    D1 = b1*a22-b2*a12;

    D2 = a11*b2-b1*a21;

    double x1,x2;

    x1 = D1/D;

    x2 = D2/D;

    printf("%lf %lf",&x1,&x2);

    return 0;

}

#include<stdio.h>

int main()

{

    double a11,a12,a13,b1,a21,a22,a23,b2,a31,a32,a33,b3;

    scanf("%lf %lf %lf %lf",&a11,&a12,&a13,&b1);

    scanf("%lf %lf %lf %lf",&a21,&a22,&a23,&b2);

    scanf("%lf %lf %lf %lf",&a31,&a32,&a33,&b3);

    double D,D1,D2,D3;

    D = a11*a22*a33+a12*a23*a31+a13*a21*a32-a13*a22*a31-a12*a21*a33-a11*a23*a32;

    D1 = b1*a22*a33+a12*a23*b3+a13*b2*a32-a13*a22*b3-a12*b2*a33-b1*a23*a32;

    D2 = a11*b2*a33+b1*a23*a31+a13*a21*b3-a13*b2*a31-b1*a21*a33-a11*a23*b3;

    D3 = a11*a22*b3+a12*b2*a31+b1*a21*a32-b1*a22*a31-a12*a21*b3-a11*b2*a32;

    double x1,x2,x3;

    x1 = D1/D;

    x2 = D2/D;

    x3 = D3/D;

    printf("%lf %lf %lf",&x1,&x2,&x3);

    return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值