楼主: sllhappy0729
4280 1

[原创博文] 求助怎么用SAS求函数的倒数和hessian矩阵 [推广有奖]

  • 0关注
  • 0粉丝

已卖:88份资源

硕士生

54%

还不是VIP/贵宾

-

威望
0
论坛币
48 个
通用积分
0.0023
学术水平
2 点
热心指数
1 点
信用等级
0 点
经验
7894 点
帖子
75
精华
0
在线时间
229 小时
注册时间
2008-11-5
最后登录
2020-10-28

楼主
sllhappy0729 发表于 2009-12-20 19:20:04 |AI写论文
3论坛币
我想通过SAS完成求一个函数F的hessian矩阵和一阶导数,不知应该怎么求?能否告知是调用哪个模块?请大家给我指个方向,谢谢!

最佳答案

bobguy 查看完整内容

Unfortunately, SAS does not provide gradian and hessian for a given function. If the function is explicitly defined, one could provide the information(simple math mostly) to some sas procs. Otherwise most sas procs will calculate it for you WITHIN those procs using finite difference method. Here is an example of the Newton-Raphson methed in Finite difference formulae for a quadratic equation. I ...
关键词:Hessian HESS ESS SIA 倒数

回帖推荐

bobguy 发表于2楼  查看完整内容

Unfortunately, SAS does not provide gradian and hessian for a given function. If the function is explicitly defined, one could provide the information(simple math mostly) to some sas procs. Otherwise most sas procs will calculate it for you WITHIN those procs using finite difference method. Here is an example of the Newton-Raphson methed in Finite difference formulae for a quadratic equation. I ...

本帖被以下文库推荐

沙发
bobguy 发表于 2009-12-20 19:20:05
Unfortunately, SAS does not provide gradian and hessian for a given function. If the function is explicitly defined, one could provide the information(simple math mostly) to some sas procs. Otherwise most sas procs will calculate it for you WITHIN those procs using finite difference method.

Here is an example of the Newton-Raphson methed in Finite difference formulae for a quadratic equation. I hope this sheds light on the approach.

HTH.


501  ****Newton's Method;
502  ***Finite difference formulae;
503  ***example f(x)=x^2 + x -3;
504
505  ***min f(-0.5) = -3.25   ;
506
507  %macro f(x);
508       (&x)**2+(&x)-3
509  %mend;
510
511  %macro f1st(x, h);
512   (  (  %f(&x+&h) ) -  (  %f(&x-&h)  ) )/(2*&h)
513  %mend;
514
515  %macro f2nd(x, h);
516   (  (  %f(&x+&h)  )  - 2*( %f(&x) ) +  ( %f(&x-&h) ) )/(&h**2)
517  %mend;
518
519  data _null_;
520
521   x0=90;h=0.006;
522   do i = 1 to 100;
523       z1=%f1st(x0, h); z2=%f2nd(x0, h);
524
525      x=x0 - z1 /z2;
526       if abs  ( %f1st(x, h) )  <1e-6 then do;
527            *evaluate function values at optimal point;
528            z0=%f(x);  z1=%f1st(x, h);  z2=%f2nd(x, h);
529            put i= x= z0= z1= z2=;
530            stop;
531       end;
532       else x0=x;
533   end;
534  run;

i=1 x=-0.499999835 z0=-3.25 z1=3.2998479E-7 z2=2
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
bakoll + 3 + 3 精彩帖子
sllhappy0729 + 1 + 1 + 1 你太nice了,非常感谢你!

总评分: 经验 + 3  论坛币 + 3  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-28 17:59