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 Andrey Ivashov  
#1 Posted : 29 August 2010 05:19:04(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
To discuss appeared issue I copying our e-mail log with ing.sosa.

ing.sosa wrote:
Im using Smath in my Numeric Analysis course, and found an issue with the Summatory arguments... when programming some algorithms we usually need to define summatorys using variable index, and we're getting errors when having, in example, summatorys from 1 to 0... of course we dont spect the summatory to do nothing, but it would be useful if this kind of definition of the arguments doesnt cause an error, because in the next iterations the same summatory will be from 1 to 1, then from 1 to 2, ... and then from 1 to n


smath wrote:
Issue you're talking about is fixed now (see attached image). Next version of SMath Studio (0.90) will correctly work with summatory arguments from your case.


ing.sosa wrote:
This solution is very useful for most cases, i guess, but my problem was not tryng to sum backward, only not to get an error but not iteration to happen. I'm attaching an example.

Anyway, this issue can be solved introducing some programming lines in our files... not big deal... but thinking in a good improvement to your soft, maybe would be a great solution introducing the notation proposed at the end of the .sm file i'm sending.

File attached: sum_example.sm




I've investigated the issue more carefully and here is what I've got:

where a = 7 (bottom limit) and x is ranged variable.

For now it seems that Maple solution is the best, but I can't find any information about the 100% right one. Can anyone help with this? What is the right decision to implement functionality when bottom limit of the sum(..) function is larger then the top one?

Best regards, Andrey Ivashov.

Edited by user 29 August 2010 05:31:22(UTC)  | Reason: Not specified

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

Offline omorr  
#2 Posted : 29 August 2010 11:00:16(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,

I do not know what is right but do not mind if the next SMath release will implement the summation and product operation to work as Andrey described - lower limit might be greter than the upper - the same as in Mathcad and Mathematica.
On the other hand we can supress some elements in the sumation and products this by using "if" function. As explained, at the moment this will do the job about lower limit higher then the upper.
s1(x,a)←if(x>a,0,sum(k,k,x,a))
s1(3,5)=12
s1(5,3)=0

I think this would be Ok and, to be honest, do not understand what is behind Maple solution.

Regards,
Radovan

P.S. I was thinking about having another sum and product operators with the additional step argument. At the moment it is
product(el(c,i),i,a,Cool
At the moment "a" must be lower than "b" and the step equals to unity (1). If the position of "a" and "b" would not be important (as Andrey said that might be introduced in 0.9) again from "a" to "b" or from "b" to "a" step will be 1 or -1. What about to have an additional argument after "a", say lower limit to be (i=a,a+2) and the value of "i" will take valuse {a,a+2,a+4..) etc. This is closer to the Math notation. Mathcad's ancient sum and product operators (this is still present) uses the sum and product operator with only one limit - a range variable.
Moreover, the step might be unity by default. If the upper limit is smaller than the lower limit - error will be reported. Then, If you still want to sum backward you have to put (i=a,a-1). This way some errors will be easyer to track.

Of course, all of this can be done with "for" loop.
Just my thoughts.

Edited by user 29 August 2010 14:36:55(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline ing.sosa  
#3 Posted : 29 August 2010 21:13:01(UTC)
ing.sosa


Rank: Member

Groups: Registered
Joined: 29/08/2010(UTC)
Posts: 14
Location: Buenos Aires

I think in a similar way that Radovan... in my file i was talking about backward and forward sum functions, but maybe an optional "step" variable will give full compatibility with older sm files, cause by default the step is +1.

The only important thing -in my opinion- is no getting errors when trying to sum forward from 5 to 4 (ie) or sum backward from 4 to 5... in this cases, no iteration must occur, so the result of the sum needs to be 0. When doing productory, the logic can be the same, not error but 0 result...

Thanks,
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.