No real roots ?

No real roots ? - Solve function does not work - Messages

#1 Posted: 12/26/2020 2:41:03 PM
Aleksey_here

Aleksey_here

0 likes in 8 posts.

Group: User

no real roots
#2 Posted: 12/26/2020 4:47:58 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Please, attach the document to see something profitable for doctoring.
Your solve bloc is incorrect anyway. Generally 4 arguments solve(,,,,).
#3 Posted: 12/26/2020 6:56:52 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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


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

Solve Example.sm (7 KiB) downloaded 40 time(s).

#4 Posted: 12/27/2020 1:25:02 AM
Aleksey_here

Aleksey_here

0 likes in 8 posts.

Group: 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 KiB) downloaded 36 time(s).

#5 Posted: 12/27/2020 7:51:39 AM
overlord

overlord

552 likes in 1332 posts.

Group: 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 KiB) downloaded 36 time(s).


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 Posted: 12/27/2020 9:24:28 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 KiB) downloaded 38 time(s).
#7 Posted: 12/27/2020 9:54:14 AM
overlord

overlord

552 likes in 1332 posts.

Group: Moderator

Wrote

Please see the file, the last page
minimal_model.sm (93 KiB) downloaded 36 time(s).


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 Posted: 12/27/2020 1:54:06 PM
Aleksey_here

Aleksey_here

0 likes in 8 posts.

Group: User

Wrote

Wrote

Please see the file, the last page
minimal_model.sm (93 KiB) downloaded 36 time(s).


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 Posted: 12/27/2020 2:12:56 PM
Aleksey_here

Aleksey_here

0 likes in 8 posts.

Group: User

Wrote

Wrote

Wrote

Please see the file, the last page
minimal_model.sm (93 KiB) downloaded 36 time(s).


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 Posted: 12/27/2020 6:28:47 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: 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 KiB) downloaded 30 time(s).
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 Posted: 12/27/2020 7:52:16 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: 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 Posted: 12/28/2020 5:18:07 AM
Aleksey_here

Aleksey_here

0 likes in 8 posts.

Group: 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
:-)
  • New Posts New Posts
  • No New Posts No New Posts