Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Razonar  
#1 Posted : 18 November 2020 20:25:14(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 545
Uruguay

Was thanked: 310 time(s) in 195 post(s)
Hi. I don't know if this is a know one. I guess they are related to the fact that functions with if can neither be derived nor integrated. Notice that seems that there are a bug in cases() too.

FunctionBug.sm (14kb) downloaded 6 time(s).
FunctionBug.pdf (49kb) downloaded 7 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 18/11/2020(UTC)
Offline Razonar  
#2 Posted : 18 November 2020 22:21:23(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 545
Uruguay

Was thanked: 310 time(s) in 195 post(s)
... and issues in composite functions with loops.

FunctionBug2.sm (18kb) downloaded 5 time(s).
FunctionBug2.pdf (77kb) downloaded 5 time(s).

Best regards.
Alvaro.


thanks 1 user thanked Razonar for this useful post.
on 18/11/2020(UTC)
Offline Razonar  
#3 Posted : 18 November 2020 22:47:05(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 545
Uruguay

Was thanked: 310 time(s) in 195 post(s)
Originally Posted by: Razonar Go to Quoted Post
... and issues in composite functions with loops.

FunctionBug2.sm (18kb) downloaded 5 time(s).
FunctionBug2.pdf (77kb) downloaded 5 time(s).

Best regards.
Alvaro.




Debugging with trace(), what I see is that when calling g, f takes phi=1, (this is the first phi=1 in the output window) but don't do the loop. Calling f isolated shows another phi=1 and subsequent values for phi.

Clipboard01.jpg

With for(3) gives an error, so I can't debug that. Additionally, calling with for(4) seems to have the same behavior than while.

Clipboard02.jpg
Offline Jean Giraud  
#4 Posted : 18 November 2020 23:48:24(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 4,872
Canada

Was thanked: 801 time(s) in 635 post(s)
Originally Posted by: Razonar Go to Quoted Post
I don't know if this is a know one. I guess they are related to the fact that functions with if can neither be derived nor integrated. Notice that seems that there are a bug in cases() too.

1. You must assign "cases" like in your last example.
2. Before Davide introduced "cases" it was a damned job integrate
unless from discrete finite differences like in the old days.
The min(x) style [undocumented] is quite smart, mostly OK Simpson.

Cheers ... Jean

Integrate Discontinuous [min(x)].sm (17kb) downloaded 8 time(s).

Offline Davide Carpi  
#5 Posted : 19 November 2020 14:30:09(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,312
Man
Italy
Location: Italy

Was thanked: 1167 time(s) in 768 post(s)
As I've already mentioned here and there, assignments shouldn't be made inside cases() arguments, because:

Originally Posted by: Davide Carpi Go to Quoted Post
Please be careful however, since a symbolic evaluation to show the function content or a failed evaluation with an error triggered on the conditions leads to the evalution of all the options.
In general currently is better to use cases to host just dead content (numbers, strings, variables).


This is a downside that currently can't be prevented. As you can see making the assignment outside cases() works as expected.
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.