Loop Not Returning All Values

Loop Not Returning All Values - Programming - Mensajes

#1 Publicado: 27/1/2021 16:23:36
Tow Wai Lim

Tow Wai Lim

0 me gusta en 42 mensajes.

Grupo: User

Hi,

I've have a loop interpolating and searching for values. I not sure what went wrong, the loop is suppose to return 4 answer, however I am only getting (1), the last value.

Appreaciate some help and guidane.

Page7.sm (45,9 KiB) descargado 1393 vez(es).
#2 Publicado: 27/1/2021 20:27:26
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

I've have a loop interpolating and searching for values. I not sure what went wrong, the loop is suppose to return 4 answer, however I am only getting (1), the last value.


Sorry Collab, I don't understand what you are interpolating.
That sub-spaces technique is very useful in many applications.
Cheers ... Jean

Page7 Subspaces.sm (41,92 KiB) descargado 1374 vez(es).
A 1 usuarios les gustó este mensaje
Tow Wai Lim 28/1/2021 10:50:00
#3 Publicado: 27/1/2021 21:48:48
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Hi,

I've have a loop interpolating and searching for values. I not sure what went wrong, the loop is suppose to return 4 answer, however I am only getting (1), the last value.

Appreaciate some help and guidane.

Page7.sm (45,9 KiB) descargado 1393 vez(es).


Below you can find corrected file.
I have revised some equations in var_file() and G().
They were trying to reach out of matrix.
Since I don't have original mathcad file this is best I can do.
I did some error check but maybe you have to dig further.

Regards

Archivo no encontrado.

page7.png
A 1 usuarios les gustó este mensaje
Tow Wai Lim 28/1/2021 10:50:00
#4 Publicado: 28/1/2021 7:54:46
Tow Wai Lim

Tow Wai Lim

0 me gusta en 42 mensajes.

Grupo: User

Hi Overlord,

Thanks for the reply. Although the val_file() is not returning the same answer as per the attached MathCAD but the overall loop actual works.

Capture14.JPG

Capture14_2.JPG



See attached calculation in mathcad.

Page 7.xmcd (97,02 KiB) descargado 1495 vez(es).
#5 Publicado: 28/1/2021 9:23:25
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

Wrote

Hi Overlord,

Thanks for the reply. Although the val_file() is not returning the same answer as per the attached MathCAD but the overall loop actual works.



Hi. val_find() returns the vector index, so it must to be the mathcad answer plus one, because ORIGIN:=0 in mathcad.

val_find.sm (134,2 KiB) descargado 1234 vez(es).

Clipboard01.jpg

Best regards.
Alvaro.
A 1 usuarios les gustó este mensaje
Tow Wai Lim 28/1/2021 10:50:00
#6 Publicado: 28/1/2021 9:45:12
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Page19 Search_Locate.sm (369,34 KiB) descargado 1168 vez(es).
A 1 usuarios les gustó este mensaje
Tow Wai Lim 28/1/2021 10:50:00
#7 Publicado: 28/1/2021 10:48:40
Tow Wai Lim

Tow Wai Lim

0 me gusta en 42 mensajes.

Grupo: User

Thanks Alvaro for your comment.

Jean, that is cool stuff... you can draw something like this in the SMath...
#8 Publicado: 28/1/2021 10:54:19
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Hi Overlord,

Thanks for the reply. Although the val_file() is not returning the same answer as per the attached MathCAD but the overall loop actual works.

See attached calculation in mathcad.

Page 7.xmcd (97,02 KiB) descargado 1495 vez(es).


Having the mathcad file revealed the difference of two programs.
The problem is n_min and n_max in smath version.
Mathcad assigns them [0 0], [0 1] and [1 1] only, whatever you enter.
min_offset and max_offset can be calculated within bounds of 9x9 matrix by them.
By that, offsets are always lower then 9 during max_offset=ii*n_max+1.
Your current smath function will produce out of matrix.
Because n_min and n_max are [1 1], [1 2] and [2 2].
And by adding ii to them it will be bigger than 9.
Algorithm should be revised with respect to that.
n_min and n_max should be lowered by 1 to correct it.
You can find re-revised file according to this.
If anything is unusual you can tell, we will try to fix it.

Regards

Page7_re-revised.sm (47,13 KiB) descargado 1375 vez(es).
A 1 usuarios les gustó este mensaje
Tow Wai Lim 28/1/2021 13:09:00
#9 Publicado: 28/1/2021 13:09:44
Tow Wai Lim

Tow Wai Lim

0 me gusta en 42 mensajes.

Grupo: User

Hi Overloard,

Thanks for the comprehensive explaination. I will look into it and let you know if there are any bug.
#10 Publicado: 28/1/2021 14:30:02
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Jean, that is cool stuff... you can draw something like this in the SMath...


Your project can be done entirely in Smath.
Unfortunately, it is not modular, unexplained
it reduces the de-bug sanity procedure.
Cheers ... Jean

  • Nuevos mensajes
  • Sin mensajes nuevos