if() inside user defined function problem?

if() inside user defined function problem? - Сообщения

#1 Опубликовано: 24.01.2012 09:20:21
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 Опубликовано: 24.01.2012 17:29:18
Andrey Ivashov

Andrey Ivashov

2269 сообщений из 3734 понравились пользователям.

Группа: 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 пользователям понравился этот пост
Radovan Omorjan 24.01.2012 19:21:00
#3 Опубликовано: 24.01.2012 19:29:08
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений