简体   繁体   English

如何在求解函数中使用用 Func 定义的函数?

[英]How do I use functions defined with Func in the solve function?

Say I have this function defined using Func :假设我使用Func定义了这个函数:

Define f(x)=Func
              Return x²
            EndFunc

I can use this function in most cases perfectly fine:在大多数情况下,我可以完美地使用此功能:

f(2)            © 4
f(3)+f(4)       © 24
cos(f(sqrt(π))) © -1
expand(f(x+1))  © x²+2⋅x+1

However, when I try to use this function in solve or cSolve (possibly some other functions as well), it doesn't work as expected:但是,当我尝试在solvecSolve (也可能是其他一些函数)中使用此函数时,它无法按预期工作:

© I expected 'x=-2 or x=2'
solve(f(x)=4,x)   © f(x)=4
© I expected 'x=-2⋅i or x=2⋅i'
cSolve(f(x)=-4,x) © f(x)=-4

It doesn't seem to expand/evaluate the function call and leaves it as f(x) .它似乎没有扩展/评估函数调用并将其保留为f(x)

On the other hand, if I don't use Func , it works perfectly fine:另一方面,如果我不使用Func ,它工作得很好:

Define g(x)=x²   © Done
solve(g(x)=4,x)  © x=-2 or x=2
cSolve(g(x)=4,x) © x=-2⋅i or x=2⋅i

nSolve works for both f and g as intended, so this makes me think it's something to do with symbolic computations. nSolve按预期对fg都有效,所以这让我认为这与符号计算有关。

  • Is there any documentation about this difference?有没有关于这种差异的文档? I've looked over the relevant sections of the reference guide and the guidebook, but have found nothing.我查看了参考指南和指南的相关部分,但一无所获。
  • Is there a way of defining functions using Func (so I can use local variables and things like that) that still work with functions like solve and cSolve ?有没有一种使用Func定义函数的方法(这样我就可以使用局部变量和类似的东西)仍然可以使用solvecSolve类的函数?

I'm using a TI-Nspire CX CAS Handheld (the older one, not the CX II).我使用的是 TI-Nspire CX CAS 手持设备(旧的,不是 CX II)。

I contacted customer support and they responded with我联系了客户支持,他们回复了

There is not a way to use the function defined the way you did using "func" and "return" with the solve command.没有办法像使用“func”和“return”和solve命令那样使用定义的函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM