Constrained optimization

Constrained optimization - With new plagin in attach - Messaggi

#1 Pubblicato: 21/11/2026 07:37:33
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Transport-Plagin-Unit.sm (18,44 KiB) scaricato 134 volta(e).
SMathOptimization.1_0_0_0.zip (18,97 KiB) scaricato 36 volta(e). PLAGIN
Transport-Plagin-Unit.png
Modificato 29/11/2026 15:25:03
1 utenti hanno apprezzato questo post
Davide Carpi 27/11/2026 07:58:57
#2 Pubblicato: 21/11/2026 09:40:18
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

One more example - a catenary with mass

Catenary-M.sm (30,4 KiB) scaricato 139 volta(e).

Catenary-M.png
Modificato 29/11/2026 15:28:36
#3 Pubblicato: 22/11/2026 08:12:31
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Linear programming
Lin-Prog.sm (360,79 KiB) scaricato 112 volta(e).
Lin-Prog.png
Modificato 22/11/2026 08:30:55
#4 Pubblicato: 22/11/2026 10:40:21
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Without constarans
Banana.sm (19,45 KiB) scaricato 113 volta(e).
Banana.png
#5 Pubblicato: 23/11/2026 11:36:09
Martin Kraska

Martin Kraska

1.369 apprezzamenti in 2.283 post.

Gruppo: Moderator

Where to get this plugin?
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#6 Pubblicato: 23/11/2026 14:17:08
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Wrote

Where to get this plugin?



Hi Martin!
See pls the first message and this
SMathOptimization.1_0_0_0.zip (18,97 KiB) scaricato 30 volta(e).

Plugin.png
Modificato 23/11/2026 14:42:59
1 utenti hanno apprezzato questo post
Oscar Campo 24/11/2026 10:27:45
#7 Pubblicato: 23/11/2026 23:57:01
Martin Kraska

Martin Kraska

1.369 apprezzamenti in 2.283 post.

Gruppo: Moderator

Valery, thanks a lot, I didn't see the file below the image.

Here is a curve-fitting example, the worksheet is trilingual (including the legend) and generated by AI.

I'll add the function as a minerr() replacement in the mcd converter. The Buchmayr-sheets, which I use for conversion testing, are just Mathcad 7, which according to Claude had no minimize() and maximize().

Parameterfit_Minimize_neu.png
Parameterfit_Minimize_neu.sm (21,73 KiB) scaricato 111 volta(e).
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 utenti hanno apprezzato questo post
Valery Ochkov 24/11/2026 16:08:07
#8 Pubblicato: 24/11/2026 05:04:40
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Thanks, Martin!
One fine example!
#9 Pubblicato: 24/11/2026 11:18:33
Andrey Ivashov

Andrey Ivashov

2.345 apprezzamenti in 4.060 post.

Gruppo: Super Administrator

Hello.

I'm strongly suggesting using the process described here: https://docs.smath.com/developer-guide/#_2 or in Russian: https://docs.smath.com/ru/developer-guide/#_2

Otherwise, we have a risk of sharing viruses in libraries from ZIP files. Besides that, we are working on new version of SMath Studio which will require recompilation of the plugins - we will recompile plugins from public repository, but we can't handle ones shared with a community using ZIP files.

Best regards.
Modificato 24/11/2026 11:19:03
1 utenti hanno apprezzato questo post
Valery Ochkov 24/11/2026 19:13:30
#10 Pubblicato: 24/11/2026 19:16:29
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

One example of the using the Minimize function
Old-Car-2.sm (42,57 KiB) scaricato 76 volta(e).
Old-Car-2.png
Old-Car-Minimize.png
Modificato 25/11/2026 08:31:42
#11 Pubblicato: 25/11/2026 05:44:49
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

One answer from AI

An exact percentage of the new car’s price can’t be given — the market value depends not only on age and mileage but also on the make, model, trim level, condition, sales region, and demand.

How to estimate the percentage of value

A combined approach is usually used: both age and mileage are taken into account.
Impact of age
According to typical depreciation curves, a passenger car loses about 40–50 % of its value in the first 3 years, and by 5–6 years it’s already down by 55–65 %. So, after 5.5 years, a car usually costs roughly 35–45 % of the new price (excluding mileage and condition).

Impact of mileage
34,000 miles is approximately 54,700 km ($1\ \text{mile} \approx 1.609\ \text{km}$, so $34,000 \times 1.609 = 54,706\ \text{km}$).

For a 5.5‑year‑old car, this mileage is considered below average: the typical average annual mileage in Russia is often estimated at 15,000–20,000 km, which would mean 82,500–110,000 km over 5.5 years. A mileage of 55,000 km is a plus for the price: it indicates less wear and makes the car more attractive.

Final estimate
Given the “good” mileage, you can expect the upper end of the depreciation range:

- Approximately 40–48 % of the new car’s price.

---

## Practical ways to get a more accurate estimate

1. Online car valuation calculators** (on classifieds sites and with dealers) — enter the make, model, year, mileage, trim, and region: the system will show a market price range.
2. Analyze listings for the exact same model** in your region: check 10–15 ads for 2018–2019 models with similar mileage and calculate an average price.
3. Get an appraisal from a dealer or an independent expert** — this will give the most accurate result, taking into account the condition of the body, interior, and mechanical parts.

If you tell me the make, model, and region, I’ll help you find comparable cars and calculate a more precise percentage. 😊
Modificato 25/11/2026 06:39:08
#12 Pubblicato: 25/11/2026 06:41:11
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

I would like to get same plot.
In Mathcad - no problem with the NaN constant. SMath needs it.
Old-Car-Plot-Mathcad.png

Modificato 25/11/2026 06:41:36
#13 Pubblicato: 25/11/2026 06:54:40
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

About this calculation (Old car price)

A story I witnessed in West Germany back in the 1980s. A German professor (I was on an internship at the University of Stuttgart at the time) decided to sell his car quickly for 2,000 marks and put it up at that very low price at the local used-car "flea market." For quite a while potential buyers kept coming up to him, looking the car over, asking questions — all to no avail… Then a rather sharp young man rolls up, buys the car without so much as a glance, as they say, changes the price tag on it and resells it right there, before the astonished professor's eyes, for 4,000 marks... That dealer knew how to judge the value of a used car correctly, and he understood that a price set too low is just as useless for bargaining as one set too high.
Modificato 25/11/2026 07:42:46
#14 Pubblicato: 25/11/2026 07:41:12
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

New version of the plagin with examples
SMathOptimization.1_1_0_0.zip (72,5 KiB) scaricato 22 volta(e).
SMathOptimization_Examples.sm (27,2 KiB) scaricato 85 volta(e).
1 utenti hanno apprezzato questo post
Martin Kraska 25/11/2026 21:46:25
#15 Pubblicato: 25/11/2026 13:23:02
Martin Kraska

Martin Kraska

1.369 apprezzamenti in 2.283 post.

Gruppo: Moderator

Seems that I can rewrite my book once the plugin becomes a regular part of the online gallery! Great work!
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 utenti hanno apprezzato questo post
Valery Ochkov 29/11/2026 18:58:28
#16 Pubblicato: 25/11/2026 17:31:57
overlord

overlord

601 apprezzamenti in 1.382 post.

Gruppo: Moderator

You can easily say "why do I care?" but,
Wouldn't it be better if plugin informations were in English?

Regards

2026-11-25_20-30.png
1 utenti hanno apprezzato questo post
francesco rapuano 25/11/2026 17:56:04
#17 Pubblicato: 25/11/2026 19:19:08
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Wrote

You can easily say "why do I care?" but,
Wouldn't it be better if plugin informations were in English?

No problem! We will do it!

#18 Pubblicato: 26/11/2026 00:21:38
Martin Kraska

Martin Kraska

1.369 apprezzamenti in 2.283 post.

Gruppo: Moderator

SMath Optimization 1.1: two problems with Find and units

While simplifying the worksheets of my textbook (FindRoot replaced by Find) I found two cases where Find fails although the system is fine. Both attached worksheets were tested with SMath 1.5.0.9678 and SMath Optimization 1.1.0.0.

1. Equation vector built with stack(): "incompatible dimension: residual" Find_stack_units.sm (17,6 KiB) scaricato 67 volta(e).

Spatial equilibrium of a rigid body with six unknown support forces S.1 ... S.6. The force rows Gf are in N, the moment rows Gm in N m.
Find(G, S.1, ..., S.6)                       G := mat(...) with all six rows: works
Find(stack(Gf, Gm), S.1, ..., S.6)           error 70
Find(stack(Gf, Gm/m), S.1, ..., S.6)         error 70 (all rows in N)
Find(stack(Gf/N, Gm/(N*m)), S.1, ..., S.6)   works
In cases 2 and 3, lastError says "Find: incompatible dimension: residual". The equations are the same in all four cases, only the way the vector is assembled differs. Collecting the force and moment conditions with stack() is the natural way in the textbook (GGB := stack(ΣF, ΣM.A)).

2. Plain 0 on the right-hand side of a vector element Find_zero_units.sm (14,55 KiB) scaricato 70 volta(e).

G := [A + B - 10 N; B*2 m - 10 N*1 m; M - A*1 m]    (A, B, M undefined)
A := 1 N   B := 1 N   M := 1 N*m                     (guess values)
Find(G, A, B, M)                                                works
Find(mat(el(G,1)≡0*N, el(G,2)≡0*N*m, el(G,3)≡0*N*m, 3, 1), A, B, M)  works
Find(mat(el(G,1)≡0, el(G,2)≡0, el(G,3)≡0, 3, 1), A, B, M)           error 70
the same equations written out explicitly with ≡0                works
Everywhere else in SMath, products of 0 with a unit are simplified to 0.

Besides these things, I'd vote for providing the unknowns as a vector just like in roots(), be generous with matrix or system and allow for assumed zero right hand side.
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 utenti hanno apprezzato questo post
Valery Ochkov 29/11/2026 18:58:47
#19 Pubblicato: 26/11/2026 06:55:25
Martin Kraska

Martin Kraska

1.369 apprezzamenti in 2.283 post.

Gruppo: Moderator

Valery, your seem to be committed to supporting units in the numerical functions, yet you deliberately disguise them in the worksheet by giving the regions a close to black text color. Is that some general style preference?
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 utenti hanno apprezzato questo post
Valery Ochkov 29/11/2026 18:58:57
#20 Pubblicato: 26/11/2026 07:00:46
Valery Ochkov

Valery Ochkov

75 apprezzamenti in 735 post.

Gruppo: User

Wrote

Valery, your seem to be committed to supporting units in the numerical functions, yet you deliberately disguise them in the worksheet by giving the regions a close to black text color. Is that some general style preference?


No
  • Nuovi post
  • Nessun nuovo post