AI assistance for SMath

AI assistance for SMath - Сообщения

#1 Опубликовано: 12.06.2025 16:02:23
Martin Kraska

Martin Kraska

1 245 сообщений из 2 169 понравились пользователям.

Группа: 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 пользователям понравился этот пост
sergio 12.06.2025 20:01:26, Nikolay 09.07.2025 06:15:07
#2 Опубликовано: 13.06.2025 00:09:11
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1 019 сообщений из 1 692 понравились пользователям.

Группа: 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 КиБ) скачан 92 раз(а).

Best regards.
Alvaro.
Отредактировано 13.06.2025 00:20:34
#3 Опубликовано: 09.07.2025 06:21:19
Nikolay

Nikolay

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

Группа: 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 Опубликовано: 10.07.2025 10:06:34
Martin Kraska

Martin Kraska

1 245 сообщений из 2 169 понравились пользователям.

Группа: 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 КиБ) скачан 84 раз(а).

image.png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Опубликовано: 17.07.2025 21:17:32
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

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

Группа: 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. ᵂᴵ
Отредактировано 17.07.2025 21:46:10
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
1 пользователям понравился этот пост
Andrey Ivashov 18.07.2025 23:26:43
#6 Опубликовано: 20.07.2025 07:06:18
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1 019 сообщений из 1 692 понравились пользователям.

Группа: 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 МиБ) скачан 38 раз(а).

Best regards.
Alvaro.
1 пользователям понравился этот пост
Martin Kraska 21.07.2025 11:07:39
#7 Опубликовано: 21.07.2025 11:07:32
Martin Kraska

Martin Kraska

1 245 сообщений из 2 169 понравились пользователям.

Группа: 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 Опубликовано: 21.07.2025 22:36:25
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1 019 сообщений из 1 692 понравились пользователям.

Группа: 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 Опубликовано: 29.07.2025 10:55:03
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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 КиБ) скачан 9 раз(а).

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
Отредактировано 29.07.2025 11:19:12
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Alvaro Diaz Falconi 29.07.2025 17:39:33
#10 Опубликовано: 29.07.2025 18:23:45
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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 КиБ) скачан 13 раз(а).

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 пользователям понравился этот пост
Davide Carpi 29.07.2025 18:58:34, ⚜ Kenny Lemens, P.E. ᵂᴵ 29.07.2025 20:55:34, sergio 30.07.2025 08:38:07
#11 Опубликовано: 30.07.2025 11:31:01
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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 КиБ) скачан 9 раз(а).

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
#12 Опубликовано: 30.07.2025 11:39:48
Davide Carpi

Davide Carpi

1 430 сообщений из 2 891 понравились пользователям.

Группа: 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
Отредактировано 30.07.2025 11:40:11
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#13 Опубликовано: 30.07.2025 11:54:13
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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.
Отредактировано 30.07.2025 12:00:06
Russia ☭ forever, Viacheslav N. Mezentsev
#14 Опубликовано: 30.07.2025 21:11:48
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1 019 сообщений из 1 692 понравились пользователям.

Группа: 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 КиБ) скачан 9 раз(а).

RKA - AI.sm (23 КиБ) скачан 6 раз(а).

Best regards.
Alvaro
1 пользователям понравился этот пост
#15 Опубликовано: 30.07.2025 22:31:03
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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
Отредактировано 30.07.2025 23:01:54
Russia ☭ forever, Viacheslav N. Mezentsev
#16 Опубликовано: 31.07.2025 11:12:20
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: 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
#17 Опубликовано: 31.07.2025 19:58:31
Вячеслав Мезенцев

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

1 433 сообщений из 1 747 понравились пользователям.

Группа: Moderator

I asked to make a model of the amplitude detector. Syntactically, he did everything correctly, but I had to do some work in terms of setting up the values themselves. I've tried about 5 neural networks and so far only one of them can handle it.

image.png

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Davide Carpi 31.07.2025 23:29:46
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений