Mathcad Toolbox

Mathcad Toolbox - Contains analogs of functions from Mathcad - Poruke

#201 Objavljeno: 21. 8. 2025. 20:59:20
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: 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


Izmenjeno 21. 8. 2025. 21:13:21
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 21. 8. 2025. 22:02:04
#202 Objavljeno: 21. 8. 2025. 21:25:35
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: 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 KiB) preuzeto 1459 put(ova).

image.png
Izmenjeno 21. 8. 2025. 21:32:28
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Alvaro 22. 8. 2025. 02:25:04
#203 Objavljeno: 22. 8. 2025. 02:36:02
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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 KiB) preuzeto 1456 put(ova).

Best regards.
Alvaro.
Izmenjeno 22. 8. 2025. 02:45:16
#204 Objavljeno: 22. 8. 2025. 02:43:19
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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 KiB) preuzeto 1538 put(ova).
image.png

Best regards.
Alvaro.
2 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 22. 8. 2025. 04:23:57, francesco rapuano 22. 8. 2025. 12:28:36
#205 Objavljeno: 22. 8. 2025. 12:42:19
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Citat

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 Objavljeno: 22. 8. 2025. 13:37:36
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Citat

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
Izmenjeno 22. 8. 2025. 14:01:39
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Alvaro 22. 8. 2025. 19:26:29
#207 Objavljeno: 22. 8. 2025. 20:05:22
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 22. 8. 2025. 21:28:42
#208 Objavljeno: 23. 8. 2025. 23:23:22
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

SMath Studio compatibility History page Changes AI Assistant

Plugin updated.

Changes:

- find() function syntax extended.

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
2 korisnika je svidelo ovu objavu
Oscar Campo 23. 8. 2025. 23:31:30, Alvaro 24. 8. 2025. 05:45:17
#209 Objavljeno: 24. 8. 2025. 05:49:38
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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 KiB) preuzeto 1379 put(ova).

Best regards.
Alvaro.
3 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 24. 8. 2025. 05:51:44, Oscar Campo 24. 8. 2025. 09:54:25, francesco rapuano 24. 8. 2025. 14:41:15
#210 Objavljeno: 24. 8. 2025. 14:52:26
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

self-check

image.png
Izmenjeno 24. 8. 2025. 14:54:21
Russia ☭ forever, Viacheslav N. Mezentsev
#211 Objavljeno: 24. 8. 2025. 14:55:32
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: 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 KiB) preuzeto 1407 put(ova).
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
2 korisnika je svidelo ovu objavu
francesco rapuano 24. 8. 2025. 15:02:57, Alvaro 25. 8. 2025. 06:21:19
#212 Objavljeno: 24. 8. 2025. 15:08:34
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

You can also try it this way

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
2 korisnika je svidelo ovu objavu
Alvaro 25. 8. 2025. 06:21:12, Martin Kraska 24. 8. 2025. 16:05:35
#213 Objavljeno: 25. 8. 2025. 06:45:40
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: User

Hi, I see you're using the character at position 8 to find the newline. The text inside the mathcad block uses a different character than the one used in the text inside a description(). One way to get both is this (Carriage Return & Line Feed)

image.png

You can then handle text from both the mathcad block and description(), for example, using strrep(text,'CR,'LF)

Best regards.
Alvaro.
Izmenjeno 25. 8. 2025. 06:46:29
1 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 25. 8. 2025. 06:59:03
#214 Objavljeno: 31. 8. 2025. 06:44:52
netsonicyxf

netsonicyxf

1 svidjanja u 14 postova.

Grupa: User

Smath v1.3.0.9126, MathCad Toolbox v0.6.9367

These equations used to work in the original document, but today they all show red. Then I copy them and paste them to a new blank document, the 1st and 2nd equ works except 3rd one.
123.jpg
#215 Objavljeno: 31. 8. 2025. 09:46:57
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

This is the basic form of using the find() function.

image.png

All other methods should be used after mastering the basic ones.

image.png

image.png
Izmenjeno 31. 8. 2025. 09:49:53
Russia ☭ forever, Viacheslav N. Mezentsev
#216 Objavljeno: 31. 8. 2025. 10:01:24
Oscar Campo

Oscar Campo

135 svidjanja u 309 postova.

Grupa: Moderator

Wrote

Smath v1.3.0.9126, MathCad Toolbox v0.6.9367

These equations used to work in the original document, but today they all show red. Then I copy them and paste them to a new blank document, the 1st and 2nd equ works except 3rd one.
...



use Clear() function between 2nd and 3rd equations and evaluate:

image.png

When this function is evaluated, the value of arguments in the function are cleaned.

Regards,
Oscar
#217 Objavljeno: 1. 9. 2025. 05:34:56
netsonicyxf

netsonicyxf

1 svidjanja u 14 postova.

Grupa: User

Wrote

Wrote

Smath v1.3.0.9126, MathCad Toolbox v0.6.9367

These equations used to work in the original document, but today they all show red. Then I copy them and paste them to a new blank document, the 1st and 2nd equ works except 3rd one.
...



use Clear() function between 2nd and 3rd equations and evaluate:

image.png

When this function is evaluated, the value of arguments in the function are cleaned.

Regards,
Oscar


123.jpg

#218 Objavljeno: 1. 9. 2025. 06:25:38
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Try this

image.png
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Davide Carpi 1. 9. 2025. 07:40:24
#219 Objavljeno: 1. 9. 2025. 06:35:02
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: User

Hi. Usually, isn't easy verify the calculus from a picture, it's better from the source. You use ":=", instead "=", as Oscar suggest.

image.png

Best regards.
Alvaro.
Izmenjeno 1. 9. 2025. 06:41:26
#220 Objavljeno: 1. 9. 2025. 10:39:16
Oscar Campo

Oscar Campo

135 svidjanja u 309 postova.

Grupa: Moderator

Wrote


123.jpg



Pay attention to this convention:
When you type ":" in SMath, you are assigneing a value to a variable and SMath renders as: ":=" .
When you type "=", you are asking for the value of a variable, or evaluating a function, and smath renders it as: "="

In your case, Clear() is a function, so, when you type "Clear(z[Ctrl+g]):1" which renders:

image.png

Here you must to type "1" and you are assigning the value "1" to "Clear(zeta)" . This is wrong.
The correct syntaxis to evaluate the function Clear() is : "Clear(z[Ctrl+g])=" which renders:

image.png

Here you don't type "1". The value "1" is an automatic response to evaluation of the function Clear(). It is the boolean answer of successfully having evaluated the Clear() function

Best,

Oscar
2 korisnika je svidelo ovu objavu
netsonicyxf 1. 9. 2025. 11:06:14, sergio 1. 9. 2025. 14:38:15
  • Novi postovi
  • Nema novih postova