Quantcast
Channel: MaplePrimes - Questions and Posts tagged with solve
Viewing all articles
Browse latest Browse all 1089

how to find instance that solve these two equations?

$
0
0

Does Maple have any faciltiy to find any solution to two equations in  3 variables subject to constraint that each equation is not zero?

Here is an example. I like to find any values of t1,t2,t3 such that alpha and beta are not zero. Any choice of such t's will do. But not all can be zero ofcourse. All the t's are linear.

restart;
eq1:= alpha = -2*t1 - 4*t2 - 2*t3;
eq2:= beta = t1 + 2*t2 + t3;

By inspection we see that choice t2=0,t3=0,t1=1 works since

subs([t2=0,t3=0,t1=1],[eq1,eq2])

There are many other choices (infinite). I just need to find one combination of t_i in the integers.

I could write a loop and keep trying different values of t1,t2,t3 until I find such choise ofcourse. But I was wondering if there is better way to do this in Maple. Solve does not work on this ofcourse.

solve([eq1,eq2,eq3],[t1,t2,t3]) assuming alpha<>0,beta<>0

And setting up Ax=b does not work

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([alpha,beta]);
LinearAlgebra:-LinearSolve(A,b)

Error, (in LinearAlgebra:-LinearSolve) inconsistent system
 

However, one thing I could do, is pick random alpha,beta values, and then solve for t_i, as in

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([-2,1]);
LinearAlgebra:-LinearSolve(A,b)

And now I am able to find a solution I want. The problem with this method, is that if I pick wrong values of alpha,beta, I can also get no solution. For example, if I guessed alpha=1,beta=1 I get

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([1,1]);
LinearAlgebra:-LinearSolve(A,b)

Error, (in LinearAlgebra:-LinearSolve) inconsistent system
 

So one option I could try, is pick random values of alpha,beta, and call LinearSolve until I get a choice which works?  i.e. one which does not give inconsistent system.

Thanks for any better suggestions.


Viewing all articles
Browse latest Browse all 1089

Trending Articles