mathematica 发表于 2019-11-8 12:55:49

如何求下面的函数的极值?

求下面这个表达式的极值\[
y=\frac{\sin (a+x) \sin (b+x)}{\sin (c+x) \sin (d+x)}
\]令导数=0易得驻点条件\[
\frac{\sin (a+x) \sin (b+x)}{\sin (c+x) \sin (d+x)}=\frac{\sin(2x+a+b)}{\sin(2x+c+d)}
\]怎么解这个驻点方程呢?

题目背景:土木专业,求岩土边坡上的破裂角

northwolves 发表于 2019-11-10 20:03:04

K>> syms a b c d x y
y=sin(x+a)*sin(x+b)/(sin(x+c)*sin(x+d))
solve(diff(y))

有解的情况下,返回
$
ans =
   -log(-((exp(a*2i)*exp(b*2i) - exp(c*2i)*exp(d*2i) + ((exp(a*2i) - exp(c*2i))*(exp(a*2i) - exp(d*2i))*(exp(b*2i) - exp(c*2i))*(exp(b*2i) - exp(d*2i)))^(1/2))/(exp(a*2i)*exp(b*2i)*exp(c*2i) + exp(a*2i)*exp(b*2i)*exp(d*2i) - exp(a*2i)*exp(c*2i)*exp(d*2i) - exp(b*2i)*exp(c*2i)*exp(d*2i)))^(1/2))*1i
-log(-(-(- exp(a*2i)*exp(b*2i) + exp(c*2i)*exp(d*2i) + ((exp(a*2i) - exp(c*2i))*(exp(a*2i) - exp(d*2i))*(exp(b*2i) - exp(c*2i))*(exp(b*2i) - exp(d*2i)))^(1/2))/(exp(a*2i)*exp(b*2i)*exp(c*2i) + exp(a*2i)*exp(b*2i)*exp(d*2i) - exp(a*2i)*exp(c*2i)*exp(d*2i) - exp(b*2i)*exp(c*2i)*exp(d*2i)))^(1/2))*1i
   -log(((exp(a*2i)*exp(b*2i) - exp(c*2i)*exp(d*2i) + ((exp(a*2i) - exp(c*2i))*(exp(a*2i) - exp(d*2i))*(exp(b*2i) - exp(c*2i))*(exp(b*2i) - exp(d*2i)))^(1/2))/(exp(a*2i)*exp(b*2i)*exp(c*2i) + exp(a*2i)*exp(b*2i)*exp(d*2i) - exp(a*2i)*exp(c*2i)*exp(d*2i) - exp(b*2i)*exp(c*2i)*exp(d*2i)))^(1/2))*1i
-log((-(- exp(a*2i)*exp(b*2i) + exp(c*2i)*exp(d*2i) + ((exp(a*2i) - exp(c*2i))*(exp(a*2i) - exp(d*2i))*(exp(b*2i) - exp(c*2i))*(exp(b*2i) - exp(d*2i)))^(1/2))/(exp(a*2i)*exp(b*2i)*exp(c*2i) + exp(a*2i)*exp(b*2i)*exp(d*2i) - exp(a*2i)*exp(c*2i)*exp(d*2i) - exp(b*2i)*exp(c*2i)*exp(d*2i)))^(1/2))*1i$

chyanog 发表于 2019-11-11 10:08:24

本帖最后由 chyanog 于 2019-11-11 11:06 编辑

\(x\to \arctan \left(-\tan (a)-\tan (b)+\tan (c)+\tan (d),\ \tan (a) \tan (b)-\tan (c) \tan (d)+\sqrt{(\tan (a)-\tan (c)) (\tan (b)-\tan (c)) (\tan (a)-\tan (d)) (\tan (b)-\tan (d))}\right)\)
\(x\to \arctan \left(\tan (a)+\tan (b)-\tan (c)-\tan (d),\ -\tan (a) \tan (b)+\tan (c) \tan (d)+\sqrt{(\tan (a)-\tan (c)) (\tan (b)-\tan (c)) (\tan (a)-\tan (d)) (\tan (b)-\tan (d))}\right)\)
Mathematica检验代码
Sin Sin Sin-Sin Sin Sin /.{
   {x->ArcTan[-Tan-Tan+Tan+Tan, Tan Tan-Tan Tan+Sqrt[(Tan-Tan) (Tan-Tan) (Tan-Tan) (Tan-Tan)]]},
   {x->ArcTan+Tan-Tan-Tan, -Tan Tan+Tan Tan+Sqrt[(Tan-Tan) (Tan-Tan) (Tan-Tan) (Tan-Tan)]]}
} // TrigExpand // Simplify
输出
{0, 0}

mathematica 发表于 2019-11-11 10:36:38

chyanog 发表于 2019-11-11 10:08
\(x\to \arctan \left(-\tan (a)-\tan (b)+\tan (c)+\tan (d), \tan (a) \tan (b)-\tan (c) \tan (d)+\sqrt ...

牛人,你这个怎么算出来的,
你这个ArcTan[-2,-1]是180度+atan0.5吗?

mathematica 发表于 2019-11-11 11:07:10

chyanog 发表于 2019-11-11 10:08
\(x\to \arctan \left(-\tan (a)-\tan (b)+\tan (c)+\tan (d),\ \tan (a) \tan (b)-\tan (c) \tan (d)+\sqr ...

Sin Sin Sin-Sin Sin Sin/.{{x->ArcTan[-Tan-Tan+Tan+Tan,Tan Tan-Tan Tan-Sqrt[(Tan-Tan) (Tan-Tan) (Tan-Tan) (Tan-Tan)]]},
{x->ArcTan+Tan-Tan-Tan,-Tan Tan+Tan Tan-Sqrt[(Tan-Tan) (Tan-Tan) (Tan-Tan) (Tan-Tan)]]}}//TrigExpand//Simplify

如我所猜,这两个也是解!

mathematica 发表于 2019-11-11 11:14:38

mathematica 发表于 2019-11-11 11:07
如我所猜,这两个也是解!

Clear["Global`*"];(*Clear all variables*)
y1=Sin*Sin
y2=Sin*Sin
yx=D*y2-y1*D
Reduce//FullSimplify

输出结果
\\right)+\pic_1\right)\lor x=2 \left(\tan ^{-1}\left(\text{Root}\left[\text{$\#$1}^4 (\sin (1) \sin (2) \sin (3) \cos (4)-\sin (1) \sin (4) \sin (3) \cos (2)-\sin (2) \sin (4) \sin (3) \cos (1)+\sin (1) \sin (2) \sin (4) \cos (3))+\text{$\#$1}^3 (4 \sin (3) \sin (4) \cos (1) \cos (2)-4 \sin (1) \sin (2) \cos (3) \cos (4))+\text{$\#$1}^2 (4 \sin (1) \cos (2) \cos (3) \cos (4)-2 \sin (2) \sin (3) \sin (1) \cos (4)-2 \sin (2) \sin (4) \sin (1) \cos (3)+2 \sin (3) \sin (4) \sin (1) \cos (2)+4 \sin (2) \cos (1) \cos (3) \cos (4)-4 \sin (3) \cos (1) \cos (2) \cos (4)-4 \sin (4) \cos (1) \cos (2) \cos (3)+2 \sin (2) \sin (3) \sin (4) \cos (1))+\text{$\#$1} (4 \sin (1) \sin (2) \cos (3) \cos (4)-4 \sin (3) \sin (4) \cos (1) \cos (2))+\sin (1) \sin (2) \sin (3) \cos (4)+\sin (1) \sin (2) \sin (4) \cos (3)-\sin (1) \sin (3) \sin (4) \cos (2)-\sin (2) \sin (3) \sin (4) \cos (1)\&,2\right]\right)+\pic_1\right)\lor x=2 \left(\tan ^{-1}\left(\text{Root}\left[\text{$\#$1}^4 (\sin (1) \sin (2) \sin (3) \cos (4)-\sin (1) \sin (4) \sin (3) \cos (2)-\sin (2) \sin (4) \sin (3) \cos (1)+\sin (1) \sin (2) \sin (4) \cos (3))+\text{$\#$1}^3 (4 \sin (3) \sin (4) \cos (1) \cos (2)-4 \sin (1) \sin (2) \cos (3) \cos (4))+\text{$\#$1}^2 (4 \sin (1) \cos (2) \cos (3) \cos (4)-2 \sin (2) \sin (3) \sin (1) \cos (4)-2 \sin (2) \sin (4) \sin (1) \cos (3)+2 \sin (3) \sin (4) \sin (1) \cos (2)+4 \sin (2) \cos (1) \cos (3) \cos (4)-4 \sin (3) \cos (1) \cos (2) \cos (4)-4 \sin (4) \cos (1) \cos (2) \cos (3)+2 \sin (2) \sin (3) \sin (4) \cos (1))+\text{$\#$1} (4 \sin (1) \sin (2) \cos (3) \cos (4)-4 \sin (3) \sin (4) \cos (1) \cos (2))+\sin (1) \sin (2) \sin (3) \cos (4)+\sin (1) \sin (2) \sin (4) \cos (3)-\sin (1) \sin (3) \sin (4) \cos (2)-\sin (2) \sin (3) \sin (4) \cos (1)\&,3\right]\right)+\pic_1\right)\lor x=2 \left(\tan ^{-1}\left(\text{Root}\left[\text{$\#$1}^4 (\sin (1) \sin (2) \sin (3) \cos (4)-\sin (1) \sin (4) \sin (3) \cos (2)-\sin (2) \sin (4) \sin (3) \cos (1)+\sin (1) \sin (2) \sin (4) \cos (3))+\text{$\#$1}^3 (4 \sin (3) \sin (4) \cos (1) \cos (2)-4 \sin (1) \sin (2) \cos (3) \cos (4))+\text{$\#$1}^2 (4 \sin (1) \cos (2) \cos (3) \cos (4)-2 \sin (2) \sin (3) \sin (1) \cos (4)-2 \sin (2) \sin (4) \sin (1) \cos (3)+2 \sin (3) \sin (4) \sin (1) \cos (2)+4 \sin (2) \cos (1) \cos (3) \cos (4)-4 \sin (3) \cos (1) \cos (2) \cos (4)-4 \sin (4) \cos (1) \cos (2) \cos (3)+2 \sin (2) \sin (3) \sin (4) \cos (1))+\text{$\#$1} (4 \sin (1) \sin (2) \cos (3) \cos (4)-4 \sin (3) \sin (4) \cos (1) \cos (2))+\sin (1) \sin (2) \sin (3) \cos (4)+\sin (1) \sin (2) \sin (4) \cos (3)-\sin (1) \sin (3) \sin (4) \cos (2)-\sin (2) \sin (3) \sin (4) \cos (1)\&,4\right]\right)+\pic_1\right)\right)\]

markfang2050 发表于 2019-11-11 13:45:39

chyanog 发表于 2019-11-11 10:08
\(x\to \arctan \left(-\tan (a)-\tan (b)+\tan (c)+\tan (d),\ \tan (a) \tan (b)-\tan (c) \tan (d)+\sqr ...

这个解怎么算出来的,代码?

chyanog 发表于 2019-11-11 14:00:17

markfang2050 发表于 2019-11-11 13:45
这个解怎么算出来的,代码?

Solve Sin)/(Sin Sin), x] == 0 /. x -> ArcTan // TrigExpand, t]
% /. Sin :> Cos HoldForm@Tan // Simplify
% /. k_ Sqrt :> Sqrt // Simplify // ReleaseHold

markfang2050 发表于 2019-11-11 14:04:44

chyanog 发表于 2019-11-11 14:00


学习了。

mathematica 发表于 2019-11-11 16:05:39

chyanog 发表于 2019-11-11 14:00


x -> ArcTan
你这么一替换,就漏解了,
因为ArcTan的范围是从-90度到90度,
而x的范围没这个限制
页: [1] 2
查看完整版本: 如何求下面的函数的极值?