No real roots ?

No real roots ? - Solve function does not work - Сообщения

#1 Опубликовано: 26.12.2020 14:41:03
Aleksey_here

Aleksey_here

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

Группа: User

no real roots
#2 Опубликовано: 26.12.2020 16:47:58
Jean Giraud

Jean Giraud

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

Группа: User

Please, attach the document to see something profitable for doctoring.
Your solve bloc is incorrect anyway. Generally 4 arguments solve(,,,,).
#3 Опубликовано: 26.12.2020 18:56:52
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Your solve bloc is incorrect anyway. Generally 4 arguments solve(,,,,).


What's going on ... I posted this example.

Solve Example.sm (7 КиБ) скачан 42 раз(а).

#4 Опубликовано: 27.12.2020 01:25:02
Aleksey_here

Aleksey_here

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

Группа: User

Wrote

Please, attach the document to see something profitable for doctoring.
Your solve bloc is incorrect anyway. Generally 4 arguments solve(,,,,).



Please see the file, the last page

minimal_model.sm (93 КиБ) скачан 37 раз(а).

#5 Опубликовано: 27.12.2020 07:51:39
overlord

overlord

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

Группа: Moderator

Wrote

Wrote

Please, attach the document to see something profitable for doctoring.
Your solve bloc is incorrect anyway. Generally 4 arguments solve(,,,,).



Please see the file, the last page

minimal_model.sm (93 КиБ) скачан 37 раз(а).


Not everything is solved with solve. Try to use root.
This was same issue I had to deal some near time.
I had completely forgotten the root function back then.

Usually works with units if you do as in example.
Otherwise you will encounter units mismatch.

Regards

2020-12-27_13-48.png
#6 Опубликовано: 27.12.2020 09:24:28
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Please see the file, the last page


Solve will work with a units-less construction.
By same token you can solve Maple for either X or Y units-less.

2D Parametric Plot [Create Trifolium].sm (33 КиБ) скачан 39 раз(а).
#7 Опубликовано: 27.12.2020 09:54:14
overlord

overlord

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

Группа: Moderator

Wrote

Please see the file, the last page
minimal_model.sm (93 КиБ) скачан 37 раз(а).


My bad, you can use solve too in this example. Even with units as mentioned before.
Just check your roots range in Tools>Options>Calculation for other calculations.

Regards

2020-12-27_15-46.png
#8 Опубликовано: 27.12.2020 13:54:06
Aleksey_here

Aleksey_here

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

Группа: User

Wrote

Wrote

Please see the file, the last page
minimal_model.sm (93 КиБ) скачан 37 раз(а).


My bad, you can use solve too in this example. Even with units as mentioned before.
Just check your roots range in Tools>Options>Calculation for other calculations.

Regards

2020-12-27_15-46.png



My roots range is -20 to +20

I don't know how to add units to the first parameter of the T1
because ' does not work there.

#9 Опубликовано: 27.12.2020 14:12:56
Aleksey_here

Aleksey_here

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

Группа: User

Wrote

Wrote

Wrote

Please see the file, the last page
minimal_model.sm (93 КиБ) скачан 37 раз(а).


My bad, you can use solve too in this example. Even with units as mentioned before.
Just check your roots range in Tools>Options>Calculation for other calculations.

Regards

2020-12-27_15-46.png



My roots range is -20 to +20

I don't know how to add units to the first parameter of the T1
because ' does not work there.



I copied "25 m" to the first parameter,
then I replaced the number "25" with parameter "y",
as a result there was parameter with units like "y m"
and after that the "solve" started to work.

If I write "y" then press ' - I cannot add units.

#10 Опубликовано: 27.12.2020 18:28:47
Martin Kraska

Martin Kraska

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

Группа: Moderator

In your case the FindRoot() function from the Nonlinear Solvers plugin seems to be appropriate.

It can handle variables with units and has embedded assignment (the solution is assigned to the variable. The solver requires an initial guess, which also tells the solver what unit to use. Another advantage of the solver is the precision control. In your case, the default precision seems to be a bit sloppy.

minimal_model_Kr.sm (94 КиБ) скачан 31 раз(а).
2020-12-27 22_21_11-SMath Studio - [minimal_model.sm_].png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#11 Опубликовано: 27.12.2020 19:52:16
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

...

I don't know how to add units to the first parameter of the T1
because ' does not work there.
...



Hi. For add units to a variable you need multiply it by the unit, this is what you need to write with the keyboard:

y.s:roots(T.1(γ*'m,19*'m)≡-0.0017*'J,γ)*'m
Wrote

...
...
I copied "25 m" to the first parameter,
then I replaced the number "25" with parameter "y",
as a result there was parameter with units like "y m"
and after that the "solve" started to work.

If I write "y" then press ' - I cannot add units.



You can add units to y.s writing y.s*'m. When you copy "25 m" the clipboard have just "25*'m".

For understand the behavior of solve with units, you can think in this way: solve don't handle units, but your T.1 do, so if solve try to evaluate T.1(γ,19*'m) returns an error because units don't match, the workaround is tell solve to call T.1(γ*'m,19*'m). This make solve to work, but the answer is unitless. Next, you can add the correct unit to the answer, which if there are nothing strange it must to be the same unit that you need to add to γ getting the correct expression for solve adding two 'm in the expression

y.s:roots(T.1(γ*'m,19*'m)≡-0.0017*'J,γ)*'m

This note is for answer your doubts about solve, not for recommend to use it. As overlod points, in your case could be better to use roots, which have the same issues than solve with units and the same workaround, or use FindRoots as mkraska shows using units in the guess values.

Best regards.
Alvaro.
#12 Опубликовано: 28.12.2020 05:18:07
Aleksey_here

Aleksey_here

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

Группа: User

Wrote

For add units to a variable you need multiply it by the unit



Thank you, it would be good to write this here: Units
:-)
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений