【错误】 y1重定义,以前的定义是“函数”

今天敲代码发现这个错误,找半天也没发现到底是哪里重定义了,y1重定义
把错误列表往上拉了一下,才发现…
错误声明
我是个憨憨,原来这个y1在math.h里定义过了。有点神奇,居然写了个这么常用的命名方式做它的函数名。

继续打开math.h - corecrt_math.h ,让我来看看到底是哪个神奇函数在作怪,定义的y1
然后你会发现,不仅是y1,连j0,j1,jn,y0,yn都被定义了,

作用:

Function: double j0 (double x)
j0 returns the Bessel function of the first kind of order 0 of x. It may signal underflow if x is too large.

Function: double j1 (double x)
j1 returns the Bessel function of the first kind of order 1 of x. It may signal underflow if x is too large.

Function: double jn (int n, double x)
jn returns the Bessel function of the first kind of order n of x. It may signal underflow if x is too large.

Function: double y0 (double x)
y0 returns the Bessel function of the second kind of order 0 of x. It may signal underflow if x is too large. If x is negative, y0 signals a domain error; if it is zero, y0 signals overflow and returns -∞.

Function: double y1 (double x)y1 returns the Bessel function of the second kind of order 1 of x. It may signal underflow if x is too large. If x is negative, y1 signals a domain error; if it is zero, y1 signals overflow and returns -∞.

Function: double yn (int n, double x)yn returns the Bessel function of the second kind of order n of x. It may signal underflow if x is too large. If x is negative, yn signals a domain error; if it is zero, yn signals overflow and returns -∞.

大概意思就是返回一个贝塞尔函数什么什么的(没学过贝塞尔,不乱翻译了)

参考:

  • 24
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先,我们需要定义带第一类修正贝塞尔函数的三积分函数。假设我们要拟合的函数为: $$f(x,y,z) = \int_0^{\infty} \int_0^{\infty} \int_0^{\infty} j_0(ax)j_0(by)j_0(cz)e^{-\alpha\sqrt{x^2+y^2+z^2}}dxdydz$$ 其中,$j_0(x)$为第一类修正贝塞尔函数,$a,b,c,\alpha$为待拟合的参数。 接下来,我们可以使用Mathematica中的NonlinearModelFit函数进行参数拟合。首先,我们需要准备一些数据用于拟合。假设我们已经有了一些实验数据$(x_i,y_i,z_i,f_i)$,那么我们可以将其封装成一个列表: data = {{x1,y1,z1,f1},{x2,y2,z2,f2},...,{xn,yn,zn,fn}} 然后,我们可以定义拟合函数: fitfunc[a_,b_,c_,alpha_,x_,y_,z_] := NIntegrate[BesselJ[0,a*x]BesselJ[0,b*y]BesselJ[0,c*z]Exp[-alpha*Sqrt[x^2+y^2+z^2]],{x,0,Infinity},{y,0,Infinity},{z,0,Infinity}] 这里使用了NIntegrate函数对三积分进行数值积分。 接下来,我们可以使用NonlinearModelFit函数进行参数拟合: fit = NonlinearModelFit[data,fitfunc[a,b,c,alpha,x,y,z],{{a,1},{b,1},{c,1},{alpha,1}}, {x,y,z}] 其中,第一个参数为实验数据,第二个参数为拟合函数,第三个参数为初始参数值,第四个参数为自变量。 最后,我们可以使用fit对象的各种方法获取拟合结果,如最优参数值、拟合曲线、拟合残差等。例如,要获取最优参数值,可以使用: fit["BestFitParameters"] 要获取拟合曲线,可以使用: Plot3D[fitfunc[a,b,c,alpha,x,y,z]/.fit["BestFitParameters"],{x,0,10},{y,0,10},{z,0,10}] 要获取拟合残差,可以使用: fit["FitResiduals"]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值