1 Pages (19 items)
Rounding Values in Vectors - User Function - Trying to make a function that rounds values in vectors - Messages
#1 Posted: 4/21/2022 2:07:51 PM
Version: 0.99 (Build: 7921)
The rounding function concept for a vector seems to work fine, but I am having trouble with a function that works on a vector containing multiple vectors.
Any ideas on how to make this work?
![2022-04-21 13_02_27-SMath Solver - [Rounding Values in Vectors Function Concepts.sm_].png](/en-US/file/wFdYH6/2022-04-21-13_02_27-SMath-Solver---_Rounding-Values-in-Vectors-Function-Concepts_sm___png)
![2022-04-21 13_03_06-SMath Solver - [Rounding Values in Vectors Function Concepts.sm_].png](/en-US/file/s3rr52/2022-04-21-13_03_06-SMath-Solver---_Rounding-Values-in-Vectors-Function-Concepts_sm___png)
Rounding Values in Vectors Function Concepts.sm (17 KiB) downloaded 30 time(s).
The rounding function concept for a vector seems to work fine, but I am having trouble with a function that works on a vector containing multiple vectors.
Any ideas on how to make this work?
Rounding Values in Vectors Function Concepts.sm (17 KiB) downloaded 30 time(s).
#2 Posted: 4/21/2022 2:35:30 PM
WroteThe rounding function concept for a vector seems to work fine, but I am having trouble with a function that works on a vector containing multiple vectors.
Any ideas on how to make this work?
You can use recursive for that.
You have to also check if rounded row is a vector.
It can work with both vector and nested vector.
Here is your code revised.
Regards
PS: MarB's solution with Razonar's addition is better actually.
I would use that instead of mine, more elegant.
My version is just a brute algorithm.
rounding_matrices.sm (10 KiB) downloaded 37 time(s).
#3 Posted: 4/21/2022 2:40:42 PM
#6 Posted: 4/21/2022 3:13:35 PM
Code revised to solve not just vectors but matrices too.
Now very complicated matrices can be rounded.
Regards
PS: MarB's solution with Razonar's addition is better actually.
I would use that instead of mine, more elegant.
My version is just a brute algorithm.
rounding_matrices.sm (10 KiB) downloaded 37 time(s).

Now very complicated matrices can be rounded.
Regards
PS: MarB's solution with Razonar's addition is better actually.
I would use that instead of mine, more elegant.
My version is just a brute algorithm.
rounding_matrices.sm (10 KiB) downloaded 37 time(s).
4 users liked this post
Wesly Centerwall 4/21/2022 3:16:00 PM, NDTM Amarasekera 4/21/2022 3:41:00 PM, sergio 4/21/2022 4:51:00 PM, Alvaro Diaz Falconi 4/22/2022 11:15:00 AM
#7 Posted: 4/21/2022 3:16:07 PM
Great ideas everyone, thanks for the input and improvements.
#8 Posted: 4/21/2022 5:42:27 PM
#9 Posted: 4/21/2022 7:38:00 PM
#10 Posted: 4/21/2022 7:44:19 PM
#11 Posted: 4/22/2022 7:39:35 AM
4 users liked this post
sergio 4/22/2022 8:09:00 AM, Fridel Selitsky 4/22/2022 9:58:00 AM, Alvaro Diaz Falconi 4/22/2022 11:15:00 AM, overlord 4/22/2022 5:33:00 PM
#12 Posted: 4/22/2022 9:33:12 AM
Up to this point, proposals round nested vectors.
Dealing with big numbers is also available.
123456789123456789 ... 987654321987654321
123000000000000000 typical
Dealing with big numbers is also available.
123456789123456789 ... 987654321987654321
123000000000000000 typical
#13 Posted: 4/22/2022 9:44:08 AM
WroteA very short way is to use recursion.
This is just magnificent. Two heads are better than one.
I couldn't hit off how to do it with vectorize.
Kudos
#14 Posted: 4/22/2022 10:07:55 AM
WroteA very short way is to use recursion:
Wonderful!
#15 Posted: 4/22/2022 11:29:14 AM
#16 Posted: 4/22/2022 5:35:17 PM
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 users liked this post
#17 Posted: 4/22/2022 7:36:17 PM
#18 Posted: 4/22/2022 8:56:06 PM
WroteMinimalistic solution for Maximalists.
Sometimes I really wish I could use Maxima plugin under linux.
#19 Posted: 4/23/2022 6:31:05 AM
WroteWroteMinimalistic solution for Maximalists.
Sometimes I really wish I could use Maxima plugin under linux.
It is on my todo list and I think it is possible, but currently priority is on another project which also involves using Maxima and is entirely open source:
https://github.com/mkraska/meclib
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 Pages (19 items)
-
New Posts
-
No New Posts