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 JReg  
#1 Posted : 03 June 2023 12:52:38(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 41
Man
United States

Was thanked: 1 time(s) in 1 post(s)
I am new to SMATH as a previous post indicated. I really need help with programming.

Here is a program I wrote several years ago. It takes almost 20 seconds to run. Scroll down to the section with the nested for-loops in the program. It is a program for coupled finite difference equations.


When I was working on this, someone on the forum modified the code as follows so that it runs instantly. I cannot find the difference because I pasted in from this program its nested for-loops to the above one and got no improvement in runtime. What is the difference?


I am trying to get this much simpler program to run. It seems to be in an endless loop. At least it hasn't finished after several minutes. In Mathcad 15 it runs instantly. I tried to copy the syntax from the above program. Where am I going wrong?


Thank you for any help you can give.
Reg Curry
Reg Curry
Loveland, CO

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

Offline Jean Giraud  
#2 Posted : 03 June 2023 19:20:45(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: JReg Go to Quoted Post
Thank you for any help you can give.

You can make it piece wise ... first.
Cheers ... Jean.

System of Equations (1).sm (33kb) downloaded 3 time(s).
Offline Razonar  
#3 Posted : 03 June 2023 19:26:40(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: JReg Go to Quoted Post

SMath isn't very fast. Sometimes works putting some eval() function or choosing Optimization / Numeric, but not always.

Originally Posted by: JReg Go to Quoted Post

The difference is that in the first length(t) = 160 and 15 in the second.

Originally Posted by: JReg Go to Quoted Post

if you start the loop from j = 1, then S[j-1] is S[0], and SMath have only ORIGIN = 1.

Best regards.
Alvaro

Edited by user 03 June 2023 20:04:09(UTC)  | Reason: Not specified

Offline Jean Giraud  
#4 Posted : 03 June 2023 21:51:35(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)
... Project REG Unk.sm (13kb) downloaded 8 time(s).
Offline JReg  
#5 Posted : 03 June 2023 22:33:19(UTC)
JReg


Rank: Advanced Member

Groups: Registered
Joined: 03/06/2023(UTC)
Posts: 41
Man
United States

Was thanked: 1 time(s) in 1 post(s)
Thanks Clap

Origin = 1 was the problem. It’s hard not to let MATHCAD affect my syntax.
Reg Curry
Loveland, CO
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.