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 Obliterate  
#1 Posted : 12 March 2024 21:31:22(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
How can i pick a speed based on a "n" value.


Let's say my n= 13 i want to get the value 30km/h for V, but if its 8 i want 60km/h.
I have tried with for/while/if. But im guessing im doing something wrong or i don't know what to write exactly.


Any help is much apprecite it!

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

Offline mkraska  
#2 Posted : 12 March 2024 23:18:17(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,987
Germany

Was thanked: 1124 time(s) in 721 post(s)
Worksheet6.png
Worksheet6.sm (5kb) downloaded 3 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Obliterate  
#3 Posted : 12 March 2024 23:41:24(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: mkraska Go to Quoted Post
Worksheet6.png
Worksheet6.sm (5kb) downloaded 3 time(s).


Thank you for the answer, but this doesn't help me. Or i don't understand it Good.

Example, i have N=10, based on N i want to get V. V for N=10 it's from here:
, but if i change N to 9 i want to obtain V=30km/hr.
Thing is i have 8 variable based on N, and i want to obtain the values only by changing N.


Sorry if i don't explain very well.
Offline mkraska  
#4 Posted : 13 March 2024 00:28:42(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,987
Germany

Was thanked: 1124 time(s) in 721 post(s)
The procedure is to get a vector of the potential values which can then be accessed by index.
You also could implement it as a function v(n) = 30 + mod(n-1, 4)*10

Worksheet6a.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Obliterate  
#5 Posted : 13 March 2024 00:51:40(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: mkraska Go to Quoted Post
The procedure is to get a vector of the potential values which can then be accessed by index.
You also could implement it as a function v(n) = 30 + mod(n-1, 4)*10

Worksheet6a.png


Great it works now. I just have to figure it out how to implement it for the rest of the file Biggrin.
Thank you very much!

How would you tackle this one?

Edited by user 13 March 2024 01:42:46(UTC)  | Reason: Not specified

Offline mkraska  
#6 Posted : 13 March 2024 02:52:27(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,987
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Obliterate Go to Quoted Post


Great it works now. I just have to figure it out how to implement it for the rest of the file Biggrin.
Thank you very much!

How would you tackle this one?


Divide n by 2, a bit of rounding and offset adjustment should do the job.

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Obliterate  
#7 Posted : 19 March 2024 02:26:30(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: mkraska Go to Quoted Post
Originally Posted by: Obliterate Go to Quoted Post


Great it works now. I just have to figure it out how to implement it for the rest of the file Biggrin.
Thank you very much!

How would you tackle this one?


Divide n by 2, a bit of rounding and offset adjustment should do the job.



I can't seem to get it to work, and for next examples i need to match it with a list that has some randomnes in number list. Isn't there a way i can create a list of number and if my "n" matches that list then i can get the correct value? I tried with for, if and so on. but im still a newbie in Smath.

Thank you once again!
Offline Davide Carpi  
#8 Posted : 19 March 2024 03:19:04(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1331 time(s) in 876 post(s)
If you have a limited set of choiches, this might be a solution.

Screenshot 2024-03-18 141755.png

Also, I think Martin has a point, since these "n" values should come from some formula.

Edited by user 19 March 2024 04:39:52(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline mkraska  
#9 Posted : 19 March 2024 08:10:00(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,987
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Obliterate Go to Quoted Post
Originally Posted by: mkraska Go to Quoted Post
Originally Posted by: Obliterate Go to Quoted Post


Great it works now. I just have to figure it out how to implement it for the rest of the file Biggrin.
Thank you very much!

How would you tackle this one?


Divide n by 2, a bit of rounding and offset adjustment should do the job.



I can't seem to get it to work, and for next examples i need to match it with a list that has some randomnes in number list. Isn't there a way i can create a list of number and if my "n" matches that list then i can get the correct value? I tried with for, if and so on. but im still a newbie in Smath.

Thank you once again!


If there is no rule, then you have to provide a vector with values and adress it with index n. A simple lookup table by index. Fill the vector by hand, by reading a file or asking a chatbot.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Obliterate  
#10 Posted : 19 March 2024 20:49:03(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
If you have a limited set of choiches, this might be a solution.

Screenshot 2024-03-18 141755.png

Also, I think Martin has a point, since these "n" values should come from some formula.


This works but i have other areas with diferent increment and i can't control them with interval. I will list a few of them:

here is 1,2,3 then goes to 16,17,18 then 26,27,28.

So i have this interval from the picture above and the one before with "Latimea benzii".
Offline Obliterate  
#11 Posted : 19 March 2024 21:57:49(UTC)
Obliterate


Rank: Member

Groups: Registered
Joined: 12/03/2024(UTC)
Posts: 10
Romania

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Obliterate Go to Quoted Post
Originally Posted by: Davide Carpi Go to Quoted Post
If you have a limited set of choiches, this might be a solution.

Screenshot 2024-03-18 141755.png

Also, I think Martin has a point, since these "n" values should come from some formula.


This works but i have other areas with diferent increment and i can't control them with interval. I will list a few of them:

here is 1,2,3 then goes to 16,17,18 then 26,27,28.

So i have this interval from the picture above and the one before with "Latimea benzii".


Found a not very fancy solution, but it works Good.
pick a number from a list.sm (7kb) downloaded 3 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.