Newbie problem - Using a range of angles inside a cosine function

Newbie problem - Using a range of angles inside a cosine function - Trying to use cos(variable angle) - Messages

#1 Posted: 10/3/2012 6:41:00 AM
jjuddgb

jjuddgb

0 likes in 2 posts.

Group: User

Hi,
I'm trying to convert some old Mathcad files into SMath but am stuck with what must be an elementary problem, I've looked at various tutorials but can't find a solution, no doubt due to my own incompetence.

I am defining the following variables: angle:=72 and varangle:= 0, angle/2..360

In Mathcad if I then define: test(varangle):= cos(varangle) the output of test(varangle) displays correctly in a column.

If I try the same in SMath I receive either an 'argument must be scalar' or 'fill in all empty elements' error.

Thanks for any advice.

Screenshots of Mathcad and SMath attached.

btw, great software.
Mathcad - output.pdf (26 KiB) downloaded 68 time(s).
#2 Posted: 10/3/2012 7:49:27 AM
kilele

kilele

133 likes in 397 posts.

Group: User

Correct me if i'm wrong, trigonometric functions don't support arrays currently.
For now, you can do something like this.
cosinOfArray.sm (5 KiB) downloaded 171 time(s).
1 users liked this post
1752 9/28/2024 2:44:00 PM
#3 Posted: 10/3/2012 11:09:17 AM
jjuddgb

jjuddgb

0 likes in 2 posts.

Group: User

Thank you kilele
#4 Posted: 10/3/2012 11:31:19 AM
Fridel Selitsky

Fridel Selitsky

520 likes in 451 posts.

Group: User

You can convert the vector into a system (by w3b5urf3r_reloaded)
Regards, Ber7
https://smath.com/wiki/GetFile.aspx?File=cosinOfArray%5b1%5d.rar
1 users liked this post
Davide Carpi 10/3/2012 1:33:00 PM
#5 Posted: 10/3/2012 11:33:28 AM
Fridel Selitsky

Fridel Selitsky

520 likes in 451 posts.

Group: User



Regards, Ber7

#6 Posted: 9/28/2024 2:44:50 PM
1752

1752

0 likes in 3 posts.

Group: User

Wrote

Correct me if i'm wrong, trigonometric functions don't support arrays currently.
For now, you can do something like this.



did arrays appear in trigonometric functions?
#7 Posted: 9/28/2024 4:09:41 PM
sergio

sergio

115 likes in 329 posts.

Group: User

now you can use the "vectorize" function, which you also find in the side panel, and perform the trigonometric function element by element.
sergio

28-1369.png
1 users liked this post
1752 9/28/2024 4:30:00 PM
#8 Posted: 9/29/2024 10:22:50 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

An alternative to the vectorize() function is the use of index vectors.

They, however, only work if they are used in a definition.

Worksheet1.png
Worksheet1.sm (5 KiB) downloaded 18 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
sergio 9/29/2024 11:37:00 PM
  • New Posts New Posts
  • No New Posts No New Posts