task:18 微分积分运算(8.1-8.4)

语法知识

8.1 差分与近似微分

在这里插入图片描述
在这里插入图片描述

8.2 微分运算

在这里插入图片描述

8.3 不定积分与定积分计算

在这里插入图片描述

8.4 数值积分

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

实例演练

8.1

♥dim取1和2的区别:

>> X=magic(4)

X =

    16     2     3    13
     5    11    10     8
     9     7     6    12
     4    14    15     1
     
>> Y1=diff(X)

Y1 =

   -11     9     7    -5
     4    -4    -4     4
    -5     7     9   -11

>> Y2=diff(X,1,2)

Y2 =

   -14     1    10
     6    -1    -2
    -2    -1     6
    10     1   -14

在这里插入图片描述

>> t=1:10;
>> s=[2 6 12 20 30 42 56 72 90 110];
>> v=diff(s)./diff(t)

v =

     4     6     8    10    12    14    16    18    20

>> a=diff(v)./diff(t(1:9))

a =

     2     2     2     2     2     2     2     2

8.2

♥微分:

>> syms x
>> y=x*sin(x)+15;
>> diff(y)
 
ans =
 
sin(x) + x*cos(x)
 
>> x=pi/4;
>> eval(ans)

ans =

    1.2625

♥六阶微分:

>> syms x
>> y=x^6;
>> diff(y,6)
 
ans =
 
720

♥偏微分:

>> syms x t
>> y=exp(-t)*sin(x*t);
>> yt=diff(y,'t')
 
yt =
 
x*exp(-t)*cos(t*x) - exp(-t)*sin(t*x)

♥:
在这里插入图片描述

>> syms x t
>> y=exp(t)*(sin(t)+cos(t));
>> t=log(x);
>> yx=diff(y)*diff(t)
 
yx =
 
(exp(t)*(cos(t) + sin(t)) + exp(t)*(cos(t) - sin(t)))/x
 
>> simple(yx)
未定义函数或变量 'simple'>> simplify(yx)
 
ans =
 
(2*exp(t)*cos(t))/x

注:化简用simplify

8.3

♥求简单不定积分:

>> syms x
>> y=1/(1+x^2);
>> R=int(y)
 
R =
 
atan(x)

♥代参变量积分:

>> syms a b x
>> y=exp(a*x)*sin(b*x);
>> R=int(y)
 
R =
 
-(exp(a*x)*(b*cos(b*x) - a*sin(b*x)))/(a^2 + b^2)
 
>> R=int(y,a)
 
R =
 
(exp(a*x)*sin(b*x))/x

♥ 求椭圆面积:

>> syms a b t
>> x=a*cos(t);
>> y=b*sin(t);
>> S=y*diff(x)
 
S =
 
-a*b*sin(t)^2
 
>> A=int(S,2*pi,0)
 
A =
 
pi*a*b

♥抛物线椭圆函数与xy面围成的体积:

>> syms x y
>> z=10-x^2/4-y^2/9;
>> V=int(int(z,x,-4,4),y,-4,4)
 
V =
 
13952/27
 
>> eval(V)

ans =

  516.7407

8.4

♥求y=sinx的均方根值(其中修改步长为π/1000):

>> x=0:pi/1000:pi;
>> y=sin(x).^2;
>> delta=pi/1000;
>> z=(1/pi*delta*trapz(y))^(1/2)

z =

    0.7071

♥:
在这里插入图片描述

>> syms x y
>> V=int(int(6-x.^2/4-y.^2/9,y,-4,4),x,-4,4)
 
V =
 
7040/27
 
>> eval(V)

ans =

  260.7407

>> [X,Y]=meshgrid(-4:0.2:4);
>> Z=6-X.^2/4-Y.^2/9;
>> surfc(X,Y,Z)
>> colormap(jet)

在这里插入图片描述

总结思考

emmmm发现很多基本数学知识自己还没有掌握很好,所以在练习的过程中,函数会使用,但是有些不理解计算方法,能解决的自己也尽量已通过各种渠道解决了,其余的还是应该加强自己的数学功底才行~~~T^T
在这里插入图片描述

Executing tasks: [:app:assembleDebug] in project D:\Users\lenovo\AndroidStudioProjects\Pinduoduo WARNING: The specified Android SDK Build Tools version (27.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.2. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '27.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. > Task :app:preBuild UP-TO-DATE > Task :app:preDebugBuild UP-TO-DATE > Task :app:checkDebugManifest UP-TO-DATE > Task :app:generateDebugBuildConfig UP-TO-DATE > Task :app:javaPreCompileDebug UP-TO-DATE > Task :app:mainApkListPersistenceDebug UP-TO-DATE > Task :app:generateDebugResValues UP-TO-DATE > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE > Task :app:mergeDebugShaders UP-TO-DATE > Task :app:compileDebugShaders UP-TO-DATE > Task :app:generateDebugAssets UP-TO-DATE > Task :app:compileDebugRenderscript NO-SOURCE > Task :app:compileDebugAidl NO-SOURCE > Task :app:generateDebugResources UP-TO-DATE > Task :app:mergeDebugResources UP-TO-DATE > Task :app:processDebugManifest > Task :app:processDebugResources FAILED AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"D:\\Users\\lenovo\\AndroidStudioProjects\\Pinduoduo\\app\\src\\main\\res\\layout\\activity_main.xml","position":{"startLine":34}}],"original":"D:\\Users\\lenovo\\AndroidStudioProjects\\Pinduoduo\\app\\src\\main\\res\\layout\\activity_main.xml:35: AAPT: error: '#875ale' is incompatible with attribute textColor (attr) reference|color.\n ","tool":"AAPT"} FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android resource linking failed D:\Users\lenovo\AndroidStudioProjects\Pinduoduo\app\src\main\res\layout\activity_main.xml:35: AAPT: error: '#875ale' is incompatible with attribute textColor (attr) reference|color. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s 11 actionable tasks: 2 executed, 9 up-to-date
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值