AI assistance for SMath

AI assistance for SMath - Messages

#1 Posted: 6/12/2025 4:02:23 PM
Martin Kraska

Martin Kraska

1,245 likes in 2,169 posts.

Group: Moderator

Recently I gave an undergraduate course on Numerical Mathematics. It involved solving tasks using SMath and Python. The students complained that AI is nearly useless for SMath, whereas for python they get solutions which work out of the box with just a few prompt iterations in tools like ChatGPT.

Also, when I copy the text of my online tasks (STACK questions in the Moodle learning management system) to ChatGPT, the tool not only paraphrases the task with an impressive correctness (there are sometimes glitches like swapped numbers in data tables), but also upon request produces programs which generate the solution, even if it can't create the solution by itself. This works with Python programs and, to much less extent, also with Maxima.

I guess that many users made similar experience. For Python, even if you can't really rely on correct implementation of the requested algorithms, you usually still get a very helpful starting point.

Not so with SMath.

I guess that in the near future, software without strong AI coverage (i.e. you can ask AI any questions about it or even let it do your work) will be regarded as outdated, cumbersome and inconvenient. People using non-AI supported tools will be much less efficient than those benefitting from AI support.

I don't know if the available data to feed an LLM woud be enough to make it a good companion or co-pilot for creating or analyzing SMath sheets. The data I think of is
- handbooks
- forum contents (messages and attachments)
- public cloud worksheets
- source repository for extensions

I am aware of the AI features in the SMath roadmap like automatic keyword generation and worksheet translation to other languages.

Additional interesting features would be:
- convert printout (PDF) from SMath back to sm files
- convert handwritten calculations to sm files
- edit expressions based on written or spoken commands ("insert an empty column in the matrix right to the second one")
- optimize performance of existing sheets
- Make consistent layout, create tables of contents, interlink sections etc.

This post is to open a discussion on what you expect from AI support and what ideas or experience do you have to improve AI coverage of SMath for the users.


Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 users liked this post
sergio 6/12/2025 8:01:26 PM, Nikolay 7/9/2025 6:15:07 AM
#2 Posted: 6/13/2025 12:09:11 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,019 likes in 1,692 posts.

Group: User

Hi Martin. You can try this code utility ( https://smath.com/en-US/forum/topic/GbopVw/Code-utility#msg137576 ) for scripting SMath functions. By relying on plain text, the AI will be able to provide some form of useful source code for basic applications.

Also, you can use an editor for syntax highlighting

image.png

For notepad++:

userDefineLang.xml (79 KiB) downloaded 92 time(s).

Best regards.
Alvaro.
Edited 6/13/2025 12:20:34 AM
#3 Posted: 7/9/2025 6:21:19 AM
Nikolay

Nikolay

0 likes in 6 posts.

Group: User

The world is galloping by while I took a break. What do you know about combining Python and AI to solve engineering problems? Do you have any links?
#4 Posted: 7/10/2025 10:06:34 AM
Martin Kraska

Martin Kraska

1,245 likes in 2,169 posts.

Group: Moderator

I don't know if this counts as an engineering problem. It is a python script written by ChatGPT. I didn't save the chat history but as I recall, the prompt was to simulate the movement of a double pendulum and animate it using VPython. The axes of the plot have some glitches, I guess with one more interaction Chatgpt would have fixed that as well.

The process of the making took well below one hour, even though the last time I used vpython was more than 20 years ago.

Pendulum.py (4 KiB) downloaded 81 time(s).

image.png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Posted: 7/17/2025 9:17:32 PM
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

80 likes in 172 posts.

Group: User

Greetings,

For training the model, here is my thought.
  1. Handbooks
  2. forum contents (messages and attachments)
    * Download SMath Studio and Archive
    * Samples
    * Extensions
    * Questions
    * Feature Requests
    * Bugs & Problems
    * Features Announcements
    * Project Discussions
  3. p̶u̶b̶l̶i̶c̶ ̶c̶l̶o̶u̶d̶ ̶w̶o̶r̶k̶s̶h̶e̶e̶t̶s I would avoid this as no peer review, and prone to collect bad data; just refer to those published as samples in the forum
  4. source repository for extensions https://smath.com:8443/!/#public
  5. API Smath Core Documentation https://smath.com/documentation/api/SMathStudio.Core/1.73.9126/html/N_SMath_Controls.htm
  6. SMath wiki:
    * https://wiki.smath.com/en-US/Main_Page
    * https://smath.com/wiki/Tutorials.ashx
  7. Bug/Issues Tracter (https://smath.com/bts/)
  8. 3rd Party Publications:
    * SMath Studio Handbuch (348 Seiten) [https://smath.com/en-US/files/Download/T7PAY/SMath%20Einf%C3%BChrung.pdf]
    * SMath Suite: A Primer (Prof. Gilberto E. Urroz) [https://smath.info/wiki/GetFile.aspx?File=Tutorials/SMathPrimer.pdf]
    * SMath for Physics (Bernard V Liengme) [https://iopscience.iop.org/book/mono/978-1-6270-5925-1.pdf]


As for the nature of an AI; I will note, it would probably be wise to treat "AI SMath" in (4) different roles:
  1. Assist in Calculations within SMath Solver
  2. Assist in Reporting within SMath Writer
  3. Programming/plugin development/deployment for SMath Studio
  4. SMath Studio: Version Management, EULA, Bugs, Feature Requests, Extension, Forum Interface, Account Management



As for an effective AI: having good information to train it is important, but I think there is benefit if the AI would be able to 'compile' the code/answer it is willing to provide you. To the best of my knowledge, the current models will auto-generate code for you, you will try/compile it: it will fail, and you will need to inform the AI that it got it wrong: of which the AI would then acknowledge: YEP! that will not compile: IF we can determine a way for the AI to debug its own answer with output matching the goal INSTEAD of guessing at which assortment of coding can/might work.


Finally, to some benefits of AI, you can add "Units Management" as featured in an article posted on this forum a while back (I don't know how to find the thread, but it was uploaded by a user acrXAz )
https://smath.com/en-US/files/Download/acrXAz/AI-Units.pdf
i.e., just because units can be simplified to a common base term, it doesn't mean they represent the same 'thing'; like percentage, radians, and Specific Gravity are all 'unitless' but do not refer to the same concept; AI could manage this.


May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
Edited 7/17/2025 9:46:10 PM
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
1 users liked this post
Andrey Ivashov 7/18/2025 11:26:43 PM
#6 Posted: 7/20/2025 7:06:18 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,019 likes in 1,692 posts.

Group: User

Hi. This prompt can be used to ask Gemini or another AI to generate code that can be interpreted within the Code utility. It's obviously not complete and still has a lot of work to do, but it's a starting point.

SMath prompt spa.docx (3 MiB) downloaded 38 time(s).

Best regards.
Alvaro.
1 users liked this post
Martin Kraska 7/21/2025 11:07:39 AM
#7 Posted: 7/21/2025 11:07:32 AM
Martin Kraska

Martin Kraska

1,245 likes in 2,169 posts.

Group: Moderator

Alvaro, did you experiment with direct generation of the internal text format and pasting that to a math region without resorting to meta-code?

BTW, range(3) is range(start,end,step).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#8 Posted: 7/21/2025 10:36:25 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,019 likes in 1,692 posts.

Group: User

Hi Martin. Yes, but in that case, I don't know if the AI provides useful code, since I'm the one who can't read it. Too many parentheses and an endless line of instructions. I suppose something interesting could be achieved by giving the AI the full list of instructions, for example, taking the definitions from the text_XXX.lang file.

Another option could be to ask it for the code in RPN, either to try to manipulate the XML file in a SMath spreadsheet or to use the function at https://smath.com/en-US/forum/topic/mNFvE7/RPN-Interpreter#msg131314 . I suppose RPN is "inherent" to an AI.

Finally, I haven't tested it in AIs specialized in code generation, nor within VS Code or similar environments, where I assume better results should be obtained.

Best regards.
Alvaro.
#9 Posted: 7/29/2025 10:55:03 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

My rough draft of the syntax description. May contain errors and inaccuracies. The limit of free communication with ChatGPT has been exhausted.

uni-ai-smath-syntax-20250729 (ebnf, draft, rus).md (15 KiB) downloaded 6 time(s).

The implementation could look like this. It is now technically possible to call a python script that makes a request and returns the result.

image.png
Edited 7/29/2025 11:19:12 AM
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Alvaro Diaz Falconi 7/29/2025 5:39:33 PM
#10 Posted: 7/29/2025 6:23:45 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

Improved syntax description, but still ambiguous. This document can already be used as a draft, but it still requires revision.

uni-ai-smath-syntax-20250730 (ebnf, draft, rus).md (16 KiB) downloaded 11 time(s).

If you set a correct and compact description, then it is not necessary to train AI on a bunch of documents, it can simply translate known algorithms using this description. You only need to attach the rules for such an operation and a set of examples.
Russia ☭ forever, Viacheslav N. Mezentsev
3 users liked this post
Davide Carpi 7/29/2025 6:58:34 PM, ⚜ Kenny Lemens, P.E. ᵂᴵ 7/29/2025 8:55:34 PM, sergio 7/30/2025 8:38:07 AM
#11 Posted: 7/30/2025 11:31:01 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

Improved syntax description. I can't explain how to specify the sizes of program blocks as constants. Deepseek is already producing good results, but he constantly forgets some details. Perhaps here we need to use a neural network that is trained only to work with code.

uni-ai-smath-syntax-20250730 (ebnf, draft, rus).md (18 KiB) downloaded 7 time(s).

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
#12 Posted: 7/30/2025 11:39:48 AM
Davide Carpi

Davide Carpi

1,430 likes in 2,891 posts.

Group: Moderator

Have you tried with different AIs?

DuckDuckGo has a set of 5 to use freely: https://duckduckgo.com/?q=DuckDuckGo+AI+Chat&ia=chat&duckai=1&atb=v378-1
Edited 7/30/2025 11:40:11 AM
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#13 Posted: 7/30/2025 11:54:13 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

The syntax description was developed using ChatGPT, but I would like to use it in free popular services.
This direction of code generation seems promising to me. At the first stage, it is necessary to develop a syntax description, at the second stage - its transformation into a document, and at the third stage - the design of the document style.

It is already possible to obtain pseudo code even with such a limited description.
Edited 7/30/2025 12:00:06 PM
Russia ☭ forever, Viacheslav N. Mezentsev
#14 Posted: 7/30/2025 9:11:48 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,019 likes in 1,692 posts.

Group: User

I modify a little the prompt given by Viacheslav. Using the prompt SMathAI.md on https://aistudio.google.com/

image.png

SMathAI.md (6 KiB) downloaded 5 time(s).

RKA - AI.sm (23 KiB) downloaded 4 time(s).

Best regards.
Alvaro
1 users liked this post
Вячеслав Мезенцев 7/30/2025 10:17:51 PM
#15 Posted: 7/30/2025 10:31:03 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

Yes, it worked for me too. This is a significant event for the entire community. Now we can gradually increase the functionality.

image.png
Edited 7/30/2025 11:01:54 PM
Russia ☭ forever, Viacheslav N. Mezentsev
#16 Posted: 7/31/2025 11:12:20 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1,432 likes in 1,746 posts.

Group: Moderator

Deepseek and Kimi can't solve the problem completely yet, unlike Google AI. They stumble on the size indication, as I described earlier. It is necessary to conduct some research on how to correctly get around this problem.
Russia ☭ forever, Viacheslav N. Mezentsev
  • New Posts New Posts
  • No New Posts No New Posts