Making Vector Elements Cumulative

Making Vector Elements Cumulative - Adding Vector Elements down the column - Messages

#1 Posted: 4/23/2018 2:20:34 PM
usamakhan

usamakhan

3 likes in 75 posts.

Group: User

In the attachment at the start of Page.5 I (so far) am unable to construct a loop or something that cumulatively adds vector elements down the column. So I am manually doing this for now, any ideas?



I have started additions from the 6th element because first x4 were zero ...but I think you get the idea!

https://imgur.com/7KSBDM8

Secondly in the last page there is a 2D-graph. One can easily read the intersection of two lines however is there any solution to find the intercept of two lines when they aren't functions but are rather data points?

Remembraning.sm (38 KiB) downloaded 42 time(s).
#2 Posted: 4/23/2018 2:47:10 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

cumulatively adds vector elements



VectSum.PNG
#3 Posted: 4/23/2018 3:03:49 PM
usamakhan

usamakhan

3 likes in 75 posts.

Group: User

no no ...I think I was unable to make you understand. The summation gives one value ...instead I wanted to have a cumulative elements in a vector. The latter thus can be plotted. please revisit the screenshot
#4 Posted: 4/23/2018 3:37:46 PM
sergio

sergio

115 likes in 329 posts.

Group: User

[albumimg]1481[/albumimg]
sergio
1 users liked this post
NDTM Amarasekera 8/9/2019 3:20:00 AM
#5 Posted: 4/23/2018 3:59:45 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Sum the vectors and vectorize ...
#6 Posted: 4/23/2018 4:48:03 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

cumulatively adds vector elements



... as you wish

VectSumCumul.PNG
#7 Posted: 4/23/2018 4:56:06 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Maths Vectorize.sm (9 KiB) downloaded 74 time(s).
#8 Posted: 4/23/2018 4:56:33 PM
usamakhan

usamakhan

3 likes in 75 posts.

Group: User

Thank you PompelmoTell
#9 Posted: 4/23/2018 5:01:59 PM
usamakhan

usamakhan

3 likes in 75 posts.

Group: User

Jean Giraud, why do you add Line in the following code, I mean why not just type them separately or am I missing something?

Screenshot_3.png
#10 Posted: 4/23/2018 5:13:07 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Jean,
Why did you use Sum(1) with a J loop?

Ioncube,
Just use Sum(4)
Sum Vector.PNG
#11 Posted: 4/23/2018 8:27:53 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

cumsum.png
cumsum.sm (3 KiB) downloaded 52 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#12 Posted: 4/23/2018 9:47:19 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Jean Giraud, why do you add Line in the following code, I mean why not just type them separately or am I missing something?



Yes my friend, you are missing best using Smath feature,
1. the line | collects/instructs the project
2. the { collects for plotting
Visit attached Project PR EOS.sm

Here is your plot and cumulative.

Cumulative.PNG

Project PR EOS.sm (129 KiB) downloaded 50 time(s).
#13 Posted: 4/23/2018 10:08:11 PM
usamakhan

usamakhan

3 likes in 75 posts.

Group: User

Thanks Jean. I myself am a chemical engineer & Equations of state example is very much appreciated!

mkraska, thanks for helping, but your file is created with a newer version of SMATh & throws error in my current version 0.98.6528
#14 Posted: 4/24/2018 12:11:37 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

mkraska, thanks for helping, but your file is created with a newer version of SMATh


You are right: Martin latest version throws error in my 6179.
I love Martin code ... Bingo !
The code I provided should work, as it did previous Smath 5346.
#15 Posted: 4/24/2018 12:28:22 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

You are right: Martin latest version throws error in my 6179.



Try that in your version.

Cumul 6179.PNG
#16 Posted: 8/9/2019 3:16:20 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Wrote

[albumimg]1481[/albumimg]
sergio



I tested 3 programs to find the cumulative totals of a large array of 20820 elements.
The method of Sergio was incredibly fast, while other two methods were much slower.
Thanks Sergio.
Forgot to attach DATA file

Rainfal_Data.xlsx (486 KiB) downloaded 32 time(s).

Cumulative Sum of a Large Matrix.sm (30 KiB) downloaded 47 time(s).

Cum_Totals_Super Fast.png

Cum_Totals.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
1 users liked this post
frapuano 8/9/2019 3:43:00 AM
#17 Posted: 8/9/2019 5:38:20 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Hi Nugegodage. Try this other one.

Cumulative Sum of a Large Matrix.sm (25 KiB) downloaded 39 time(s).

Clipboard.gif

(Notice that mi computer is very slow)
Best regards.
Alvaro

3 users liked this post
sergio 8/9/2019 6:43:00 AM, frapuano 8/9/2019 10:47:00 AM, NDTM Amarasekera 8/9/2019 11:43:00 AM
#18 Posted: 8/9/2019 11:33:32 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Hello Alvaro
I get following result in my laptop.
Yours is a very good alternative.
Thanks.

Cum_Totals_Super Fast2.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#19 Posted: 8/9/2019 1:31:37 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

cumulative totals of a large array of 20820 elements.


... the word is array
1. Unwrap the array in vector
2. ΣV ... vector sum over the unwrapped array
SS 6179 does not open your document.

vectSum.PNG
#20 Posted: 8/9/2019 7:12:35 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

...more and otherwise.

vectSum.sm (15 KiB) downloaded 35 time(s).
  • New Posts New Posts
  • No New Posts No New Posts