In[4]:= D[x^4*y+y^a*Cos[z],a] a Out[4]= y Cos[ z]Log[ y ] 实 验 表 明 求 导 计 算 与 指 定 函 数 的 变 量 有 关 。 如 果 函 数 中 有 很 多 可 以 作 为 变 量 参 数 , 则 在 求 导 命 令 中 , 只 把 命 令 中 指 定 的 参 数 作 为 变 量 , 其 余 参 数 作 为 常 数 处 理 。 这 实 际 上 是 多 元 函 数 的 偏 导 数 概 念 。 8. In[1]:= f[x_]:=x*Cos[x^2]; In[2]:= f1[x_]=D[f[x],x]; In[3]:= x0=2.0; In[4]:=Table[f[x0+h]-f[x0]-f1[x0]*h, {h,0.1,0,-0.005}] Out[4]={0.141826, 0.128511, 0.115785, 0.103663, 0.092156, 0.0812772, 0.0710377, 0.0614484, 0.0525198, 0.0442618, 0.0366837, 0.0297945, 0.0236024, 0.0181154, 0.0133407, 0.0092852, 0.00595522, 0.00335659, 0.00149467, 0.000374342, 0.} 计 算 结 果 给 出 的 一 组 数 表 是 按 自 变 量 增 量 x = h 取 值 由 h = 0.1开 始 , 每 次 减 少 2 0.005 直 到 0 y = xcos x 在 x 0 = 2.0 的 增 量 Δ y 微 分 dy 的 差 , 从 计 算 结 果 可 以 看 到 当 自 变 量 增 量 x = h 越 接 近 零 时 函 数 增 量 Δ y 与 微 分 dy 越 接 近 。 因 此 , 在 使 用 由 微 分 得 到 的 近 似 计 算 公 式 h = 算 出 的 函 数 ( ) ( ) ( ) ′( ) f x+ Δx ≈ f x + f x Δ x 做 近 似 计 算 , 应 该 考 虑 自 变 量 增 量 的 绝 对 值 9.For[i=5,i{{-5Pi,5Pi},{-1.5,1.5}}, Δ x 应 该 较 小 这 一 特 点 。 PlotStyle->{RGBColor[1,0,0], {Thickness[0.015],RGBColor[0,1,0]}}, PlotLabel->i" 次 Taylor 展 开 的 图 形 比 较 "]] 执 行 命 令 后 输 出 如 下 一 系 列 图 形
命 令 中 语 句 For[stat,test,incr,body] 的 功 能 是 以 stat 为 初 值 , 重 复 计 算 incr 和 body 直 到 test 为 False 终 止 。i+=5 表 示 i=i+5。