2 equations with 2 unknowns

2 equations with 2 unknowns - How to solve 2 equations with 2 unknowns - Messages

#1 Posted: 6/28/2016 3:42:01 PM
Wuxen

Wuxen

0 likes in 4 posts.

Group: 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 Posted: 6/28/2016 5:05:38 PM
Ernesto

Ernesto

13 likes in 74 posts.

Group: User

Why not use linear algebra?

Capture.PNG
#3 Posted: 6/28/2016 5:40:17 PM
Wuxen

Wuxen

0 likes in 4 posts.

Group: 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 Posted: 6/28/2016 8:31:29 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 KiB) downloaded 87 time(s).
#5 Posted: 6/28/2016 9:07:16 PM
Wuxen

Wuxen

0 likes in 4 posts.

Group: 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 Posted: 6/28/2016 9:51:09 PM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: 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 Posted: 6/28/2016 11:20:04 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: 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 users liked this post
Davide Carpi 6/29/2016 4:32:00 AM, Wuxen 6/29/2016 10:42:00 AM
#8 Posted: 6/29/2016 12:21:12 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... consider productive solving:

Forum Solve Tridiagonal.gif
#9 Posted: 6/29/2016 1:22:56 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: 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 users liked this post
Davide Carpi 6/29/2016 4:25:00 AM, sergio 6/29/2016 5:24:00 AM
#10 Posted: 6/29/2016 1:56:14 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: 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 Posted: 6/29/2016 4:28:44 AM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: 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 Posted: 6/29/2016 9:37:59 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

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

#13 Posted: 6/29/2016 11:02:03 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

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

Forum Solve Sanity Float 21.gif
  • New Posts New Posts
  • No New Posts No New Posts