Mcad2Smath Iteration&recursion

Mcad2Smath Iteration&recursion - migration from mcad to smath - Сообщения

#1 Опубликовано: 28.03.2021 15:05:23
welter

welter

0 сообщений из 3 понравились пользователям.

Группа: User

[albumimg]1630[/albumimg]

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?
#2 Опубликовано: 28.03.2021 15:18:26
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

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.
#3 Опубликовано: 28.03.2021 18:00:54
welter

welter

0 сообщений из 3 понравились пользователям.

Группа: User

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
#4 Опубликовано: 28.03.2021 18:43:49
overlord

overlord

552 сообщений из 1332 понравились пользователям.

Группа: Moderator

Wrote

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
#5 Опубликовано: 28.03.2021 18:49:49
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

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.
#6 Опубликовано: 28.03.2021 20:26:12
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

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 (20 КиБ) скачан 29 раз(а).
#7 Опубликовано: 28.03.2021 20:35:23
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

... added the graph.

Page7 Recursive Otherwise.sm (22 КиБ) скачан 27 раз(а).
#8 Опубликовано: 28.03.2021 20:43:57
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

... This one is anchored at ORIGIN 0 [X,Y]

Page7 Recursive Otherwise.sm (22 КиБ) скачан 30 раз(а).
#9 Опубликовано: 29.03.2021 03:53:49
welter

welter

0 сообщений из 3 понравились пользователям.

Группа: User

Hi & thank's both of you!

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

Greetings

Adrien
#10 Опубликовано: 29.03.2021 08:18:16
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

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


Adrian, enjoy that classical model ... Jean

Page34 Recursive Model DE.sm (10 КиБ) скачан 28 раз(а).


  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений