[已解决] 如程序所见,错误使用 symengine Unable to convert expression into double array.希望有大佬能帮忙解决。最后一行sym转double错误

[复制链接]
add. 发表于 2022-7-10 16:51:10
本帖最后由 add. 于 2022-7-10 17:01 编辑
  1. clear;clc
  2. syms y
  3. gt = 4.2374;
  4. atm = 2;
  5. utm = 2;
  6. A0t = 0.0620;
  7. hlt = 0.1219;
  8. hfm = 0.8660;
  9. xishut = utm/(A0t*hlt*hfm)^atm;
  10. k1 = 1 - gt^2/atm;
  11. k2 = (atm*utm - gt^2)/atm;
  12. k3 = -gt^2/atm;

  13. ft = y^(gt^2/2)* meijerG([k1], [1], [0, k2], [k3], xishut*y^(atm/2));

  14. gf = 4.5749;
  15. afm = 4.4948;
  16. bfm = 2.5442;
  17. A0f = 0.3900;
  18. hlf = 0.8603;
  19. xishuf = ((afm*bfm)/(4*A0f*hlf))^2;
  20. k4 = (gf^2 + 1)/2;
  21. k5 = (gf^2 + 2)/2;
  22. k6 = (gf^2)/2;
  23. k7 = (gf^2 + 1)/2;
  24. k8 = (afm)/2;
  25. k9 = (afm + 1)/2;
  26. k10 = (bfm)/2;
  27. k11 = (bfm + 1)/2;

  28. ff = meijerG([1], [k4, k5], [k6, k7, k8, k9, k10, k11], [0], xishuf*y);

  29. fx = (1 - exp(-y))^(1 - 1)*(exp(-y))^(3 - 1 + 1);

  30. f=ft.*ff.*fx

  31. j2=int(f,y,-10.6855,50)

  32. j2=abs(double(j2))
复制代码

最佳答案


20141303 发表于 2022-7-10 17:11:28
仅供参考,估计积分区间存在奇异点
  1. clear;clc
  2. syms y
  3. gt = 4.2374;
  4. atm = 2;
  5. utm = 2;
  6. A0t = 0.0620;
  7. hlt = 0.1219;
  8. hfm = 0.8660;
  9. xishut = utm/(A0t*hlt*hfm)^atm;
  10. k1 = 1 - gt^2/atm;
  11. k2 = (atm*utm - gt^2)/atm;
  12. k3 = -gt^2/atm;

  13. ft = y^(gt^2/2)* meijerG([k1], [1], [0, k2], [k3], xishut*y^(atm/2));

  14. gf = 4.5749;
  15. afm = 4.4948;
  16. bfm = 2.5442;
  17. A0f = 0.3900;
  18. hlf = 0.8603;
  19. xishuf = ((afm*bfm)/(4*A0f*hlf))^2;
  20. k4 = (gf^2 + 1)/2;
  21. k5 = (gf^2 + 2)/2;
  22. k6 = (gf^2)/2;
  23. k7 = (gf^2 + 1)/2;
  24. k8 = (afm)/2;
  25. k9 = (afm + 1)/2;
  26. k10 = (bfm)/2;
  27. k11 = (bfm + 1)/2;

  28. ff = meijerG([1], [k4, k5], [k6, k7, k8, k9, k10, k11], [0], xishuf*y);

  29. fx = (1 - exp(-y))^(1 - 1)*(exp(-y))^(3 - 1 + 1);

  30. f=ft.*ff.*fx;
  31. fun=matlabFunction(f);

  32. j2=integral(fun,-10.6855,50)

  33. j2=abs(double(j2))
复制代码
回复此楼

2 条回复


20141303 发表于 2022-7-10 17:11:28
仅供参考,估计积分区间存在奇异点
  1. clear;clc
  2. syms y
  3. gt = 4.2374;
  4. atm = 2;
  5. utm = 2;
  6. A0t = 0.0620;
  7. hlt = 0.1219;
  8. hfm = 0.8660;
  9. xishut = utm/(A0t*hlt*hfm)^atm;
  10. k1 = 1 - gt^2/atm;
  11. k2 = (atm*utm - gt^2)/atm;
  12. k3 = -gt^2/atm;

  13. ft = y^(gt^2/2)* meijerG([k1], [1], [0, k2], [k3], xishut*y^(atm/2));

  14. gf = 4.5749;
  15. afm = 4.4948;
  16. bfm = 2.5442;
  17. A0f = 0.3900;
  18. hlf = 0.8603;
  19. xishuf = ((afm*bfm)/(4*A0f*hlf))^2;
  20. k4 = (gf^2 + 1)/2;
  21. k5 = (gf^2 + 2)/2;
  22. k6 = (gf^2)/2;
  23. k7 = (gf^2 + 1)/2;
  24. k8 = (afm)/2;
  25. k9 = (afm + 1)/2;
  26. k10 = (bfm)/2;
  27. k11 = (bfm + 1)/2;

  28. ff = meijerG([1], [k4, k5], [k6, k7, k8, k9, k10, k11], [0], xishuf*y);

  29. fx = (1 - exp(-y))^(1 - 1)*(exp(-y))^(3 - 1 + 1);

  30. f=ft.*ff.*fx;
  31. fun=matlabFunction(f);

  32. j2=integral(fun,-10.6855,50)

  33. j2=abs(double(j2))
复制代码
回复此楼

add. 发表于 2022-7-11 15:51:44
20141303 发表于 2022-7-10 17:11
仅供参考,估计积分区间存在奇异点

感谢,数值积分integral是可以积出来的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
相关文章
热门教程
站长推荐
快速回复 返回顶部 返回列表