Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline mkraska  
#1 Posted : 22 November 2023 07:22:45(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 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).
2023-11-21 18_18_50-SMath Solver - [6-2-Bug.sm_].png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Razonar  
#2 Posted : 22 November 2023 08:41:12(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: mkraska Go to Quoted Post
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.

vec.png

Best regards.
Alvaro
thanks 3 users thanked Razonar for this useful post.
on 22/11/2023(UTC),  on 22/11/2023(UTC),  on 22/11/2023(UTC)
Offline mkraska  
#3 Posted : 22 November 2023 10:35:34(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Is that just by observation or is there a fundamental obstacle?
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Razonar  
#4 Posted : 22 November 2023 12:57:58(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: mkraska Go to Quoted Post
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

v1.png

The help page from the newest version

v2.png

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

map.png

Wolfram's solution is very practical: Function with attribute 'Listable' expands over lists

math.png

But for make a table you actually need a loop or the Mathematica's Map function.

Best regards.
Alvaro.
thanks 2 users thanked Razonar for this useful post.
on 24/11/2023(UTC),  on 26/11/2023(UTC)
Offline Jean Giraud  
#5 Posted : 26 November 2023 02:15:21(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: mkraska Go to Quoted Post
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).
thanks 1 user thanked Jean Giraud for this useful post.
on 26/11/2023(UTC)
Offline mkraska  
#6 Posted : 26 November 2023 05:17:47(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 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.png
Worksheet13.sm (6kb) downloaded 5 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 27/11/2023(UTC)
Users browsing this topic
Guest
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.