SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
failing evaluation under vectorize()
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1126 time(s) in 723 post(s)
|
Why does the vectorize operation fail while it seems to be safe to use an explicit loop? 6-2-Bug.sm (28kb) downloaded 7 time(s). |
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: mkraska Why does the vectorize operation fail while it seems to be safe to use an explicit loop? Hi Martin. Because you have just only one function which can't be vectorized: the norme or dot product of vectors. Best regards. Alvaro
|
3 users thanked Razonar for this useful post.
|
on 22/11/2023(UTC), on 22/11/2023(UTC), on 22/11/2023(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1126 time(s) in 723 post(s)
|
Is that just by observation or is there a fundamental obstacle?
|
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: mkraska Is that just by observation or is there a fundamental obstacle? Hi. I guess that it is fundamental. Some notes about how other CAS handle this issue. Pretty old matlab version, from its symbolic toolbox The help page from the newest version So, it looks like they have some issues with automatic vectorization. With maple it is very uncomfortable, you need to use map even for simple cases Wolfram's solution is very practical: Function with attribute 'Listable' expands over lists But for make a table you actually need a loop or the Mathematica's Map function. Best regards. Alvaro.
|
2 users thanked Razonar for this useful post.
|
on 24/11/2023(UTC), on 26/11/2023(UTC)
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: mkraska Why does the vectorize operation fail while it seems to be safe to use an explicit loop ? Set the demand in local definition mode ... new(t):=|a(t) vectorize and equate 6-2-Bug Doctored.sm (30kb) downloaded 3 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1126 time(s) in 723 post(s)
|
Thanks Alvaro and Jean. Here is a reduced working example. When a scalar function involves scalar products then it must be defined in a line()-block in order to be vectorize()able. Worksheet13.sm (6kb) downloaded 5 time(s). |
|
1 user thanked mkraska for this useful post.
|
|
|
SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
failing evaluation under vectorize()
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.