2 equations with 2 unknowns

2 equations with 2 unknowns - How to solve 2 equations with 2 unknowns - Сообщения

#1 Опубликовано: 28.06.2016 15:42:01
Wuxen

Wuxen

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

Группа: User

Hi.

I am new to SMath.

Is there a new a easy way to solve 2 equations with 2 unknowns?
Like 3*a-4*b=24 and 5*a+2*b=-3 ?

I did this in MathCAD just to show what I think is an easy and fast way.
2_equations_with_2_unknowns.PNG

// Wuxen
#2 Опубликовано: 28.06.2016 17:05:38
Ernesto

Ernesto

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

Группа: User

Why not use linear algebra?

Capture.PNG
#3 Опубликовано: 28.06.2016 17:40:17
Wuxen

Wuxen

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

Группа: User

That is a good way! But I know that many high-school student don't really know linear algebra and that is why i asked
But thanks for the fast answer!

// Wuxen
#4 Опубликовано: 28.06.2016 20:31:29
Jean Giraud

Jean Giraud

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

Группа: User

Present it otherwise as you wish.

In the attached, in "So much from so little"
experiment 7.2 and 7.201 vs result !!!

Forum Solve 2x2.gif

Solve [x,y,z] Compactum.sm (62 КиБ) скачан 64 раз(а).
#5 Опубликовано: 28.06.2016 21:07:16
Wuxen

Wuxen

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

Группа: User

I understand what you are saying, but the thing I am looking for is:

In Matlab I can also solve 2 eqs. with 2 unknowns without using linear alg.
in Matlab I can solve it with solve(3*a-4*b=24 AND 5*a+2*b=-3,[a b])

I hope you understand what I'm looking for - It is to solve it without using linear alg.

// Wuxen
#6 Опубликовано: 28.06.2016 21:51:09
Davide Carpi

Davide Carpi

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

Группа: Moderator

You can use the built-in function roots()

2016-06-29 09_27_49-SMath Studio Desktop - [roots.sm_].png

Settings about roots' range are in Tools > Options > Calculation > Roots (range); you can also give an initial guess as third argument.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Опубликовано: 28.06.2016 23:20:04
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

I understand what you are saying, but the thing I am looking for is:

In Matlab I can also solve 2 eqs. with 2 unknowns without using linear alg.
in Matlab I can solve it with solve(3*a-4*b=24 AND 5*a 2*b=-3,[a b])

I hope you understand what I'm looking for - It is to solve it without using linear alg.



There are many ways to solve, about ½ dozen more. Where do you see "linear alg"
in my reply ? My typical answer is over 3 centuries old, coded universal in any
system handling maths. Mathcad, Matlab ... they just code the solving like Smath
coding 2*3 =6. If you would have a system 1000 variables/unknowns, you would use
"linsolve", doing the same but more efficiently for speed of computation.

Gauss elimination, Cramer are not efficient. Above a certain size, Cramer will
never end between all big blues of the world together, and you will be dead
sucking roots for centuries.


2 пользователям понравился этот пост
Davide Carpi 29.06.2016 04:32:00, Wuxen 29.06.2016 10:42:00
#8 Опубликовано: 29.06.2016 00:21:12
Jean Giraud

Jean Giraud

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

Группа: User

... consider productive solving:

Forum Solve Tridiagonal.gif
#9 Опубликовано: 29.06.2016 01:22:56
Mike Kaganski

Mike Kaganski

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

Группа: User

Wrote

2016-06-29 02_47_09-SMath Studio Desktop - [Page1_].png



Hi Davide,
unfortunately, your sanity check isn't good, because the result f(a,b )=[0;0] says the opposite: it's the result of logical expressions "is 3*a-4*b equal to 24? No (0)!" and "is 5*a+2*b equal to -3? No (0)!"

The error is small though, less that 4*10^-14.
С уважением, Михаил Каганский
2 пользователям понравился этот пост
Davide Carpi 29.06.2016 04:25:00, sergio 29.06.2016 05:24:00
#10 Опубликовано: 29.06.2016 01:56:14
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Hi. To handle this needs a complete set of instructions, and a new system variable:

$MaxExtraPrecision is used implicitly in various exact numerical computations, including equality tests, comparisons, and functions such as Round and Sign.


See Possible issues under https://reference.wolfram.com/language/ref/Equal.html

Best regards.

Alvaro.
#11 Опубликовано: 29.06.2016 04:28:44
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Wrote

2016-06-29 02_47_09-SMath Studio Desktop - [Page1_].png



Hi Davide,
unfortunately, your sanity check isn't good, because the result f(a,b )=[0;0] says the opposite: it's the result of logical expressions "is 3*a-4*b equal to 24? No (0)!" and "is 5*a+2*b equal to -3? No (0)!"

The error is small though, less that 4*10^-14.



Busted! Thank you Mike

(screenshot fixed)

2016-06-29 09_27_49-SMath Studio Desktop - [roots.sm_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#12 Опубликовано: 29.06.2016 09:37:59
Jean Giraud

Jean Giraud

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

Группа: User

NO Davide: not so much "busted". Even -3.00000000000004 is caused by
the machine ULP in the sanity reverse computation. Nothng to worry about.

Jean

Forum Solve Sanity.gif

Solve SANITY.sm (11 КиБ) скачан 34 раз(а).

#13 Опубликовано: 29.06.2016 11:02:03
Jean Giraud

Jean Giraud

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

Группа: User

... naturally: Mathcad sanity check itself exactly,
not so exactly in Smath [molecular inexactitude !!!]

Forum Solve Sanity Float 21.gif
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений