Can't get"Solve" function to work

Can't get"Solve" function to work - Сообщения

#1 Опубликовано: 04.03.2017 03:36:15
Mo

Mo

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

Группа: User

Hi,
I am new to SMath and still learning. I had two unknown with two equations and was trying to solve them simultaneously but unfortunately SMath does not have the "solve block" option as in MathCad (if there is a way please let me know).
so I consolidate the two equations into one quadratic equation with one unknown, and tried to use the "solve" function to get the roots of the equation but it says that there is no real roots while it has!! so what i am doing wrong?!
please help!!
Файл не найден.Файл не найден.
#2 Опубликовано: 04.03.2017 04:56:43
Radovan Omorjan

Radovan Omorjan

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

Группа: Moderator

Hello,

You have the problem with inconsistent units. Either get rid of them or add unit 'm to argument w in calling solve(Eq3(w*'m)=0,w). You will get two results (0.2162, 1.4238).

Reards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 пользователям понравился этот пост
Mo 04.03.2017 18:55:00
#3 Опубликовано: 04.03.2017 07:51:45
Martin Kraska

Martin Kraska

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

Группа: Moderator

You can solve the original equations using FindRoot() from the Plugin Nonlinear Solvers or Solve() from the Maxima Plugin.
FindRoot() requires initial guesses, to be given with correct dimension (unit)
Solve() does not need initial guesses but leaves you with the chance or problem to select the correct solution.

BTW, why did you re-define MPa and kN? These are available in the units selector dialog. Also, mPa is confusing as it would read as Millipascal.
Solve_kr.sm (100 КиБ) скачан 104 раз(а).
solve-2.png
Solve-1.png

Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Mo 04.03.2017 18:55:00
#4 Опубликовано: 04.03.2017 19:25:33
Mo

Mo

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

Группа: User

Thanks Martin and Radovan,
Radovan, I tried what you said and did not work, can you kindly send the file, and for your information, if you have not changed my numbers then the answer should not be what you mentioned, so the units thing must mess with the results!! Also I want to understand why the units are inconsistent? units between what exactly? Eq(w) has an area unit because (W) is squared.

Also Martin thanks for the file, it seems the Maxima plugin can't open on my computer for some reason. I am running on windows 10 which i am not sure it is incompatible with it or not. I searched and found that you posted a portable version of SMath that works with Maxima but the website would not open "https://extmoodle.th-brandenburg.de/course/view.php?id=34"

Also, is there an English version of the manual you created in SMath? it looks great but I don't know German unfortunately
Thanks again, really appreciate it.

error plugin.png
#5 Опубликовано: 04.03.2017 20:19:01
Martin Kraska

Martin Kraska

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

Группа: Moderator

Wrote



Also Martin thanks for the file, it seems the Maxima plugin can't open on my computer for some reason. I am running on windows 10 which i am not sure it is incompatible with it or not.
I searched and found that you posted a portable version of SMath that works with Maxima but the website would not open "https://extmoodle.th-brandenburg.de/course/view.php?id=34"

Also, is there an English version of the manual you created in SMath? it looks great but I don't know German unfortunately



The maxima plugin doesn't work with Win10. You can still open the file and ignore the maxima stuff. I corrected the units in the definitions of the parameters. FindRoot should do the job anyways.

In the extension manager (Tools> Plug-ins) go to the Interactive books tab. In the online gallery you find a bilingual english/german handbook. If you set this as default you can open the book using the [?] button of the toolbar.




Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#6 Опубликовано: 04.03.2017 20:40:43
Mo

Mo

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

Группа: User

Thanks again Martin, may I ask why the findroot function gives only one solution? And on what bases it chooses which root for the result.
#7 Опубликовано: 05.03.2017 05:34:10
Radovan Omorjan

Radovan Omorjan

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

Группа: Moderator

Wrote

Radovan, I tried what you said and did not work, can you kindly send the file, and for your information, if you have not changed my numbers then the answer should not be what you mentioned, so the units thing must mess with the results!! Also I want to understand why the units are inconsistent? units between what exactly? Eq(w) has an area unit because (W) is squared.



Here is the corrected file Solve_corr.sm (101 КиБ) скачан 102 раз(а).,

Solve_corr.PNG

The results were different from Martin's solution because of h.c in the equation Eq.3(w) (there was h mistakenly instead of h.c).

I hope that you figured out why the units are not consistent if you put only w without unit length. Actually, you have to give w the unit, not use it without it. Then the equation will be right. In the Eq.3(w) unit of w must be unit length in order the equation to be in units length squared (unit consistent).

Regards,
Radovan

P.S. Davide's FindRoout() uses the algorithm which solves the nonlinear equation giving only one solution (requiring an initial value) while solve() uses search algorithm in the given range (range can be change as third and fourth parameter)
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#8 Опубликовано: 05.03.2017 05:54:55
Martin Kraska

Martin Kraska

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

Группа: Moderator

Wrote

Thanks again Martin, may I ask why the findroot function gives only one solution? And on what bases it chooses which root for the result.


As Radovan said, if multiple solutions exist, the result depends on the initial guess, where the algorithm starts. The range of initial values leading to a particular solution can be quite different and is depending on the particular shape of the function and the algorithm in use. If you use NewtonRaphson instead of FindRoot, you get the same results but with different ranges of convergence.

With FindRoot, you need initial guesses quite close to the second solution in order to actually get it. That's why symbolic solutions are preferrable if available.

2017-03-05 09_51_11-SMath Studio 0.98.6179 - [Solve_kr.sm].png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#9 Опубликовано: 05.03.2017 16:48:44
Mo

Mo

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

Группа: User

Thanks again for both of you Martin and Radovan, really appreciate it.
So it seems that I have an issue with my SMath version, when I opened your file Radovan, it was not able to calculate the Solve function as it happened with me (see attached). is that because I am running with Windows 10?
Solve_Error.png

Also Martin, Can you send another link to the SMath Poratble version?, because your link in you signature does not work.
Thanks alot.
#10 Опубликовано: 05.03.2017 17:46:25
Martin Kraska

Martin Kraska

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

Группа: Moderator

Wrote


Also Martin, Can you send another link to the SMath Poratble version?, because your link in you signature does not work.
Thanks alot.



I need to ask our IT guys what happened to the Moodle system. I hope to get this fixed tomorrow.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#11 Опубликовано: 05.03.2017 17:55:07
Radovan Omorjan

Radovan Omorjan

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

Группа: Moderator

Wrote


So it seems that I have an issue with my SMath version, when I opened your file Radovan, it was not able to calculate the Solve function as it happened with me (see attached). is that because I am running with Windows 10?


I do not think so (I was using Win10 for your file as well). As far as I know, the problem with solve() when it reported "No real roots" is usually with the search range for roots. It can be set globally in Tools->Options->Calculation->Roots(range) or locally with third and fourth argument. I think in you case it might be zero and one like solve( , ,0,1). By the way, you can also use roots() function for the numerical roots or (as Marting suggested) the symbolical solution. Besides Maxima you have maple plugin as well.

Regards,
Radovan

roots2.PNG

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений