if() inside user defined function problem?

if() inside user defined function problem? - Messages

#1 Posted: 1/24/2012 9:20:21 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello,

Take a look at this simple example, please.

As you can see, there is the difference in plotting f(x) and f1(x). Do not understand why?. The graphs should be the same.
Moreover, calculating the individual function values for a chosen argument seems to be correct.

Actually, I tried to use roots() and solve() with a defined discontinuous function using if(). I was surprised when the roots() and solve() worked with f(x) but not with f1(x). Definitely, roots() and solve() should be working with such defined kind of discontinuous functions. Is this a bug or I can not see something?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#2 Posted: 1/24/2012 5:29:18 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Thank you, Radovan.

This was very interesting bug! The error that was hidden very deep in the evaluation core of SMath Studio. And now it is fixed! Thank you for figuring it out - this is very important to correct such things as soon as possible.

Proof:


Best regards, Andrey Ivashov.
1 users liked this post
Radovan Omorjan 1/24/2012 7:21:00 PM
#3 Posted: 1/24/2012 7:29:08 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

You are very welcome Andrey,

I am glad that I found it. On the other hand I would be very grateful to you if this would work with either g(x) or m(x)

solve(g(x),x,1,2)=
roots(g(x),x,1)=

giving the result. It is very important that root finding functions have the possibility to accept this.

Regards,
Radovan


When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts