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 Adrien Welter  
#1 Posted : 28 March 2021 21:05:23(UTC)
Adrien Welter

Rank: Newbie

Groups: Registered
Joined: 27/03/2021(UTC)
Posts: 3
Man
Germany



Hi there,

I am migrating my old mathcad files to Smath.
As you can see in the uploaded picture i tried
to emulate the function in Smath without succes.
I know that i can write a few line code to achieve this.
But I want to keep it easy readable for people who are not
so fit in reading code.
Does somebody have a hint how to achieve this?

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

Offline Razonar  
#2 Posted : 28 March 2021 21:18:26(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)
Hi Adrian. SMath it's ORIGIN = 1, and you can't change it. It's probably best to rewrite the code in Mathcad for ORIGIN = 1 and then move it to SMath.

Best regards.
Alvaro.
Offline Adrien Welter  
#3 Posted : 29 March 2021 00:00:54(UTC)
Adrien Welter

Rank: Newbie

Groups: Registered
Joined: 27/03/2021(UTC)
Posts: 3
Man
Germany

Hi Alvaro,

Thank's for your input. Well I am not importing the mcad files in Smath, I am rewriting it in Smath.
Even when I set the ORIGIN in Smath to 1, i.e: n:=[1..10] , I don't get any result. Could it be that
this feature "x[n+1" is not availlable in Smath?

Greetings

Adrien
Offline overlord  
#4 Posted : 29 March 2021 00:43:49(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,128
Turkey

Was thanked: 509 time(s) in 339 post(s)
Originally Posted by: Adrien Welter Go to Quoted Post
Hi Alvaro,

Thank's for your input. Well I am not importing the mcad files in Smath, I am rewriting it in Smath.
Even when I set the ORIGIN in Smath to 1, i.e: n:=[1..10] , I don't get any result. Could it be that
this feature "x[n+1" is not availlable in Smath?

Greetings

Adrien

This works, if it suits you.

Regards.

2021-03-29_00-42.png
Offline Razonar  
#5 Posted : 29 March 2021 00:49:49(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)
Hi Adrien (sorry, I wrote Adrian before). ORIGIN it's an option for Mathcad, not for SMath. You can read about it in the Mathcad help here. As another example of changing the array origin, you have the 'Option base 1' in visual basic.

This is your code in Mathcad with ORIGIN = 0, which is the default value:

Clipboard01.jpg

Here, the same Mathcad code with ORIGIN = 1:

Clipboard02.jpg

Finally, you can translate it to SMath:

Clipboard07.jpg

Notice that the scan in SMath under the index array isn't that complete like in Mathcad nor Matlab, and usually you can use only variable ranges but not operations over those ranges in the left-side of the assignment.

Hope that's helps.

Best regards.
Alvaro.
Offline Jean Giraud  
#6 Posted : 29 March 2021 02:26:12(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: Adrien Welter Go to Quoted Post
Thank's for your input. Well I am not importing the mcad files in Smath, I am rewriting it in Smath.
Even when I set the ORIGIN in Smath to 1,i.e: n:=[1..10] , I don't get any result.Could it be that
this feature "x[n 1"is not available in Smath?

You ambiguate yourself between the two .
Try this same/otherwise than Alvaro ... Jean

Page7 Recursive Otherwise.sm (21kb) downloaded 6 time(s).
Offline Jean Giraud  
#7 Posted : 29 March 2021 02:35:23(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)
... added the graph.

Page7 Recursive Otherwise.sm (23kb) downloaded 6 time(s).
Offline Jean Giraud  
#8 Posted : 29 March 2021 02:43:57(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)
... This one is anchored at ORIGIN 0 [X,Y]

Page7 Recursive Otherwise.sm (23kb) downloaded 8 time(s).
Offline Adrien Welter  
#9 Posted : 29 March 2021 09:53:49(UTC)
Adrien Welter

Rank: Newbie

Groups: Registered
Joined: 27/03/2021(UTC)
Posts: 3
Man
Germany

Hi & thank's both of you! Clap

Fantastic and many thank's for your quick and competent reply.

Greetings

Adrien
Offline Jean Giraud  
#10 Posted : 29 March 2021 14:18:16(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: Adrien Welter Go to Quoted Post
Fantastic and many thank's for your quick and competent reply.

Adrian, enjoy that classical model ... Jean

Page34 Recursive Model DE.sm (11kb) downloaded 6 time(s).


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.