Mathcad Toolbox

Mathcad Toolbox - Contains analogs of functions from Mathcad - Сообщения

#201 Опубликовано: 21.08.2025 20:59:20
Martin Kraska

Martin Kraska

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

Группа: Moderator

Interesting things are going on, I am really excited!

I think that the explanation by Gemini is not entirely correct. Yet, he hint on circularity is helpful.

image.png

If that was true, we would not have that circularity problem. Also we would not see the entire find command with it's arguments if we display the stored expression from the find block in the dynamic assistant.
Actually I believe that the find function (like any other function in any assignment does nothing (except for substituting existing definitions from the context) unless a result display is requested. I call this delayed evaluation.

Also, assignment to a variable should not affect anything above the current definition. Backfiring should be limited to absolute variables as sometimes used for iterations with on-the-fly animation.

If Gemini was right here, the simp() function in my above example would not help. simp() actually triggers evaluation because num2str() does so. BTW, in the given case S: eval(S) also does the job.

image.png


Отредактировано 21.08.2025 21:13:21
Martin KraskaPre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
#202 Опубликовано: 21.08.2025 21:25:35
Вячеслав Мезенцев

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

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

Группа: Moderator

SMath Studio compatibility History page Changes AI Assistant

Plugin updated.

Changes:

- Draghilev solver added.

This is a very simple implementation.

MathcadToolbox-Draghilev-simple.sm (20,83 КиБ) скачан 36 раз(а).

image.png
Отредактировано 21.08.2025 21:32:28
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Alvaro Diaz Falconi 22.08.2025 02:25:04
#203 Опубликовано: 22.08.2025 02:36:02
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

... The set of variables to be solved is now implicitly determined from all initial guesses (`≈`) provided in the input system. This removes the need to explicitly declare all variables. ...



Hi Viacheslav. Very good job! Instead of sending the equation with the user variables to the solver, and having problems with cyclic recursions, you can send a system of equations based on a single vector variable. This also enables the use of al_nleqsolve, which is the most robust solver available, and is also compatible with the solvers in the nonlinear solvers plugin. This is demonstrated in the code in the attached file, along with combining the x ≈ a notation with the x = a notation.

nsol-handling-equations.sm (56,51 КиБ) скачан 25 раз(а).

Best regards.
Alvaro.
Отредактировано 22.08.2025 02:45:16
#204 Опубликовано: 22.08.2025 02:43:19
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

... Draghilev solver added.


Hi Viacheslav. With a matrix non-zero finder, like the one in Matlab, you can simplify the axis crossing detection.

MathcadToolbox-Draghilev-MFind.sm (30,45 КиБ) скачан 26 раз(а).
image.png

Best regards.
Alvaro.
2 пользователям понравился этот пост
Вячеслав Мезенцев 22.08.2025 04:23:57, francesco rapuano 22.08.2025 12:28:36
#205 Опубликовано: 22.08.2025 12:42:19
Вячеслав Мезенцев

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

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

Группа: Moderator

Цитата

BTW, in the given case S: eval(S) also does the job.


Сan be used as a temporary solution.

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
#206 Опубликовано: 22.08.2025 13:37:36
Вячеслав Мезенцев

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

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

Группа: Moderator

Цитата

This is demonstrated in the code in the attached file, along with combining the x ≈ a notation with the x = a notation.


You might be interested to know that the find function was written using AI using the nsol function as an example. I have been working with AI for some time and now it can convert almost any description into code.
It understood perfectly what was happening in the nsol code, praised the author and offered the implementation as a find function. Of course, I told it what to do, but basically all the code was written by AI.
All numerical solvers that find() uses are also written by AI in 10 minutes.

The same goes for Draghilev's method, it is also based on your example. It is too complex to understand, but in general I know what is happening there, and for AI there were no difficulties at all.

Now I'm trying to port lsode (odesolve) from C code to c#. It's too huge to be done in one evening and there are many complexities, but the AI ​​said that everything will be fine.

I will later connect all the existing numerical solvers to the find function, and all the numerical differential solvers to odesolve. In particular, it will learn to classify a problem by a set of equations and select an appropriate solver.
Unfortunately, when working with the AI, you need less time, but more knowledge. Not everything it offers corresponds to my level as a programmer.

AI also helped to understand splines. It found an inaccuracy in the Mathcad.

image.png

image.png

image.png
Отредактировано 22.08.2025 14:01:39
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Alvaro Diaz Falconi 22.08.2025 19:26:29
#207 Опубликовано: 22.08.2025 20:05:22
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

... You might be interested to know that the find function was written using AI using the nsol function as an example. I have been working with AI for some time and now it can convert almost any description into code.

In that case, please also check ndsol , as the way it converts differential equations into systems allows for numerical solutions of hard coupled systems that I can only solve in SMath, but not Maple or Mathematica.

Wrote

... All numerical solvers that find() uses are also written by AI in 10 minutes.

The nleqsol solver is the most powerful one you have at hand, it reminds me of the tksolver solver.

Wrote

... The same goes for Draghilev's method, it is also based on your example. It is too complex to understand, but in general I know what is happening there, and for AI there were no difficulties at all.

Remember to add the option to have the Jacobian as an argument, and the ode solver too.

Wrote

... I will later connect all the existing numerical solvers to the find function, and all the numerical differential solvers to odesolve. In particular, it will learn to classify a problem by a set of equations and select an appropriate solver.

I haven't reviewed the code in the SMath plugin repository, but Adams' algorithm is clearly much faster than the others. Perhaps you could implement the way it evaluates D(t,u) values ​​in rkfixed and RKadapt.

Wrote

... AI also helped to understand splines. It found an inaccuracy in the Mathcad.


You can find the codes in SMath here: https://smath.com/en-US/forum/topic/sKU7o2/CSpline-interpolation#msg129361 . My idea for math software is that advanced functions should be written in their own code, with the exception of those that require a large number of flops (Matlab Word). This should make it easier for developers to discover bugs and optimize the core code. However, there is something very good about SMath's code for the cspline function. Unlike Mathcad, it doesn't require prior calculation of the matrix with splines, yet it still works very quickly.

Finally, as you refine your procedures and add examples, you'll eventually need to consider how to pass arguments to find and specialized ode solvers, as they won't be able to solve all problems with the default parameters. The option I suggest is something similar to the Options(~fname, "pname", pvalue) function you can find in nsol to store "pname" and "pvalue" as strings in the ~fname variable, and Options(~fname,"pname") to obtain pvalue. Remembering that in SMath, every function can modify the value of its arguments globally, and treating ~fname as if it were an object that has the pname parameters as if they were properties of an object.

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

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

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

Группа: Moderator

SMath Studio compatibility History page Changes AI Assistant

Plugin updated.

Changes:

- find() function syntax extended.

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Oscar Campo 23.08.2025 23:31:30, Alvaro Diaz Falconi 24.08.2025 05:45:17
#209 Опубликовано: 24.08.2025 05:49:38
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Hi Viacheslav. You also can ask the IA for matrices with known examples to check the answers. In this case, one variable function, the guess and the root.

image.png

check-find.sm (37,51 КиБ) скачан 6 раз(а).

Best regards.
Alvaro.
3 пользователям понравился этот пост
Вячеслав Мезенцев 24.08.2025 05:51:44, Oscar Campo 24.08.2025 09:54:25, francesco rapuano 24.08.2025 14:41:15
#210 Опубликовано: 24.08.2025 14:52:26
Вячеслав Мезенцев

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

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

Группа: Moderator

self-check

image.png
Отредактировано 24.08.2025 14:54:21
Russia ☭ forever, Viacheslav N. Mezentsev
#211 Опубликовано: 24.08.2025 14:55:32
Martin Kraska

Martin Kraska

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

Группа: Moderator

Mathcad block for entering matrices. This allows for inserting and deleting rows and columns using ordinary SMath edit. Each entry is a formula cell.

Problem is that it is easy to get the wrong sequence by slightly misplacing entries.

Also, it is not nice that the procedure can't guess the shape of the matrix from the arrangement of the entries.

image.png

collect.sm (14,9 КиБ) скачан 4 раз(а).
Martin KraskaPre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
francesco rapuano 24.08.2025 15:02:57
#212 Опубликовано: 24.08.2025 15:08:34
Вячеслав Мезенцев

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

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

Группа: Moderator

You can also try it this way

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Martin Kraska 24.08.2025 16:05:35
  • Новые сообщения
  • Нет новых сообщений