Variable and Function Names Can't Start With Number

Variable and Function Names Can't Start With Number - Old Worksheet that now produces an error - Сообщения

#1 Опубликовано: 09.08.2017 00:09:56
Ryan Freund

Ryan Freund

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

Группа: User

Attached is an older worksheet for simple span beams. It used to "work". However, now I receive an error "Variable and Function Names Can't Start With Number". I can't seem to find this error.
Any help would be greatly appreciated.

Thanks!

Simple Beam - Function.sm (64 КиБ) скачан 62 раз(а).
#2 Опубликовано: 09.08.2017 05:20:11
Davide Carpi

Davide Carpi

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

Группа: Moderator

Hello,

there are known issues with the iterator name of functions like sum, if that variable was previously defined; just clear it before using inside sum.

Simple Beam - Function.sm (64 КиБ) скачан 83 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 09.08.2017 07:53:43
Ryan Freund

Ryan Freund

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

Группа: User

I see, Thank you!

Alternatively I could have used a different variable name?
#4 Опубликовано: 09.08.2017 11:18:06
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

"Variable and Function Names Can't Start With Number"



That what it means. Since 6179, Sum needs be locally defined.

SumLocalDefinition.PNG
#5 Опубликовано: 09.08.2017 11:21:20
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

I see, Thank you!

Alternatively I could have used a different variable name?



You can, but you might experience the issue again if that variable is used somewhere and then you call your function

2017-08-09 16_19_37-SMath Studio - [Simple Beam - Function.sm_].png

Clear() is the most reliable way to act, and won't change the logic of your function even when this issue will be solved
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#6 Опубликовано: 09.08.2017 23:46:13
Ryan Freund

Ryan Freund

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

Группа: User

Thanks for you help. A couple questions:

1. I seem to get a bad result (it is incorrect) as noticed by the units. I'm not sure what's going on there.
2. Where is 'n' being defined in the original function? Or do I need to clear(n) before every sum?


Thanks again!
#7 Опубликовано: 10.08.2017 09:14:02
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

1. I seem to get a bad result (it is incorrect) as noticed by the units. I'm not sure what's going on there.
2. Where is 'n' being defined in the original function? Or do I need to clear(n) before every sum?



==================================

To me, "Units" is the greatest pest ever invented. I worked all my life with
Engineering formulas "pencil/paper" ... formulas designed in the appropriate units.
Just a comment

There is no error message... what about changing the exponent 'n' in fsin(x,a,n)
with something less confusing. Whether your version needs 'Sum' be locally defined
or not ? ... you must try the example posted before.

Clear(n) does nothing. To clear 'x' in a project, instruct like this
x:=Clear(x) ... don't know if it clears within program ?

If there is error in the construction and if the construction is too involved
it may not report any error at all ... same with Mathcad, can't trace back.
What about a minimal pieces to help checking individual results. would be
much easier to debug.

If you want to clean from the gyzmas '#': easy and not easy
Put the selection on the right of a#, press F8 to select all [highlighted gray]
Press backspace to remove the # ... it does not clean an exponent and may not
clean a long construction. Check each has been cleaned, if not clean manually.

Conditional.PNG
#8 Опубликовано: 10.08.2017 12:28:49
Jean Giraud

Jean Giraud

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

Группа: User

"Variable and function names can't start with number"
[Old work sheet that now produces error]
========================================
That's what you have to isolate first, it was created 5346 or earlier version.
If so => the suspect is the Sum(s). Personally, I have dozens of those.
Good thing we know how to doctor.
#9 Опубликовано: 10.08.2017 20:00:27
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Thanks for you help. A couple questions:

1. I seem to get a bad result (it is incorrect) as noticed by the units. I'm not sure what's going on there.


Not really sure what's going on there while the units are correct, but they shows that something is messed up. What is going different is that nested systems are no more joined (at least for the el() function).
You can use a couple of nested el(), that however are correct for how the result is built (a system of systems)
2017-08-11 00_38_33-SMath Studio - [Simple Beam - Function.sm_].png

Wrote

2. Where is 'n' being defined in the original function?


In the for loops before the sums. Try it on the canvas, the iterator variable is available with his last value outside the loop (by design).
2017-08-11 00_53_19-SMath Studio - [Page1_].png

Wrote

Or do I need to clear(n) before every sum?


before any sum in which you might not have the control on what is defined before; In this case, the first sum() inside the function, whatever you use or not use n locally, because n might be used on the canvas. If you still want to use n in amid of 2 sums, you have to clear it again before the second sum. However if you forget it the error status shows that something is gone wrong.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#10 Опубликовано: 10.08.2017 23:05:51
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Attached is an older worksheet for simple span beams. It used to "work". However, now I receive an error "Variable and Function Names Can't Start With Number". I can't seem to find this error.
Any help would be greatly appreciated.



=============================================
Please, check the attached:

1. Not a case of clearing anything
2. Changed the nSum for mSum
3. Removed all gyzmas #
4. NO error message

I understand nothing in that kind of work,
but results make sense even with units.

Simple Beam - Copy.sm (63 КиБ) скачан 45 раз(а).
#11 Опубликовано: 14.08.2017 22:49:08
Ryan Freund

Ryan Freund

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

Группа: User

@Jean and @Davide thank you both very much for your contributions. I think I understand now.
#12 Опубликовано: 15.08.2017 00:32:27
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

@Jean and @Davide thank you both very much for your contributions. I think I understand now.



Do you have the right results ? That was the question.
If NOT, you may have to debug the program piecewise.

Cheers, Jean

#13 Опубликовано: 15.08.2017 07:50:06
Ryan Freund

Ryan Freund

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

Группа: User

Yes, i do, thank you.
#14 Опубликовано: 15.08.2017 11:22:39
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Yes, i do, thank you.


====================
Nice you have the right result c/w units.
wrt the error message: I can't reproduce it anymore 6179.
It seems it has repaired itself, maybe some left over
from the coding ... similar left over codes in Mathcad 11.

Cheers collab, Jean

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