Zurück zum Inhaltsverzeichnis

Kapitel 13

> restart:

solve

> solve(x^2+3*x+2=0, x);

-1, -2

> solve(x^2+3*x+2);

-1, -2

> solve( a*x^2+b*x+c);

{c = -a*x^2-b*x, b = b, a = a, x = x}

> solve( a*x^2+b*x+c,x);

1/2*(-b+sqrt(b^2-4*a*c))/a, 1/2*(-b-sqrt(b^2-4*a*c)...

> f:=expand( (x-1)^2*(x+Pi)*(3*x-1/x) );

f := 3*x^4+2*x^2+3*x^3*Pi+2*x*Pi-6*x^3+2*x-6*x^2*Pi...

> solve(f);

1, -Pi, 1/3*sqrt(3), -1/3*sqrt(3)

symbolic versus numeric solution (see also fsolve)

> solve(x^3=8);

2, -1+I*sqrt(3), -1-I*sqrt(3)

> solve(x^3=8.0);

2., -1.+1.732050808*I, -1.-1.732050808*I

> fsolve(x^3=8);

2.

> fsolve(x^3=8, x, complex);

-1.-1.732050808*I, -1.+1.732050808*I, 2.

> solve(x^2=1.5+a,x);

1/2*sqrt(6+4*a), -1/2*sqrt(6+4*a)

> fsolve(x^2=1.5+a,x);

Error, (in fsolve) a is in the equation, and is not solved for

trigonometric equations, _EnvAllSolutions

> restart:

> solve(sin(x)=cos(x));

1/4*Pi

> _EnvAllSolutions:=true:

> solve(sin(x)=cos(x));

1/4*Pi+Pi*_Z1

> s:=solve(sin(x^2)=1/2);

s := 1/6*sqrt(6*Pi+24*Pi*_B1+72*Pi*_Z2), -1/6*sqrt(...

>

> about(_Z1);

_Z1:
nothing known about this object

>

>

Gleichungssysteme

> restart:

> eq:= {x+y+z-4, x-3*y+z, 2*x-y+z}:

Man muss alle Variablen angeben.

> solve( eq, x);

> solve( eq, {x,y,z});

{z = 5, y = 1, x = -2}

> eq:={exp(x)+exp(y)+exp(z)=1, sin(x)+sin(y)=1, y+z=1};

eq := {exp(x)+exp(y)+exp(z) = 1, sin(x)+sin(y) = 1,...

> solve(eq, {x,y,z});

{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...
{y = -arcsin(sin(RootOf(_Z-ln(-1-exp(arcsin(sin(_Z)...

> evalf(%);

{y = -1.000578839+1.314917616*I, x = 1.926433253+1....

> evalf(subs(%,eq));

{1.000000001+.2e-9*I = 1., 1.000000000+0.*I = 1., 1...

RootOf, allvalues

> s:=solve(x^6+x+1,x);

s := RootOf(_Z^6+_Z+1,index = 1), RootOf(_Z^6+_Z+1,...
s := RootOf(_Z^6+_Z+1,index = 1), RootOf(_Z^6+_Z+1,...

> evalf(s);

.9454023333+.6118366938*I, -.1547351445+1.038380754...
.9454023333+.6118366938*I, -.1547351445+1.038380754...

> eq:={x+y=5, x*y=7}:

> s:=solve( eq, {x,y});

s := {x = -RootOf(_Z^2-5*_Z+7,label = _L9)+5, y = R...

> dep:=allvalues(s);

dep := {y = 5/2+1/2*I*sqrt(3), x = 5/2-1/2*I*sqrt(3...

> seq( evalf((subs(i, eq))), i=dep);

{5. = 5., 7.000000000+0.*I = 7.}, {5. = 5., 7.00000...

> solve( {5*x^2 - 5*y^2 - 3*x + 9*y=0, 5*x^3+5*y^3-15*x^2-13*x*y-y^2=0}, {x,y});

{x = 0, y = 0}, {y = 2, x = 1}, {y = -1, x = 2}, {x...

fsolve

> fsolve(ln(1+x)+ln(3+x)+x=5);

2.192154954

> f:=2*x + cos(x) - 2*sin(2*x):plot(f,x=-2..5);

> fsolve(f);

[Maple Plot]

-1.074907239

> fsolve(f, x=-2..2);

-1.074907239

> fsolve(f, x=-2..-1);

-1.074907239

> fsolve( x^3+2*x-1);

.4533976515

> fsolve( x^3+2*x-1, x,complex);

-.2266988258-1.467711509*I, -.2266988258+1.46771150...

> fsolve({x+y=9/2, x*y=5}, {x,y});

{x = 2.500000000, y = 2.}

> solve({x+y=9/2, x*y=5}, {x,y}):
evalf( % );

{y = 2., x = 2.500000000}, {x = 2., y = 2.500000000...

> fsolve(x^2+5);

> fsolve(x^2+5,x, complex);

-2.236067977*I, 2.236067977*I

> f:=cos(x^2)-x/3:

> plot(f,x=-4..4);

[Maple Plot]

> fsolve( f );

1.094269232

> fsolve( f,x, x=2..2.5);

2.371500399

> fsolve(f, x, x=2.5..3);

2.607739533

> fsolve(f, x, x=-2.5..-1.5 );

-1.996097497

> fsolve(f, x, x=-1.9..-1.0 );

-1.439140143

> Digits:=40: f:=sinh(x)-cosh(x):

> lsg1:=fsolve(f);

lsg1 := 370.9460584024576331921177293763225157195

> plot( {sinh(x), cosh(x)}, x=-2..4);

[Maple Plot]

Jetzt mal ohne die unpassende Numerik:

> is(cosh(x)-sinh(x)>0);

FAIL

> assume(x,real):convert(cosh(x)-sinh(x),exp);

1/exp(x)

> is(%>0);

true

> limit(cosh(x)-sinh(x),x=infinity);

0

>

>

> restart:

manipulating the solution

subs, assign

> s:=solve( x^2-x-6 ,{x});

s := {x = 3}, {x = -2}

> eval(sin(1/(1+x^2)),s[1]);

sin(1/10)

> s:=solve( {x^2+y^2=5, x+y=3} );

s := {y = 1, x = 2}, {x = 1, y = 2}

> eval(3*x^2+5*y-x*y,s[2]);

11

> seq( eval(3*x^2+5*y-x*y,i), i=s);

15, 11

> assign( s[2] );
x,y;

1, 2

to clear x and y

> restart:

simplifying the solution

> _EnvAllSolutions:=true:

> s:=solve(sin(x)+cos(x)=1/sqrt(2));

s := arctan((1/4*sqrt(2)-1/4*sqrt(6))/(1/4*sqrt(2)+...

> simplify([s]);

[-arctan((-1+sqrt(3))/(1+sqrt(3)))+2*Pi*_Z1, -arcta...

> map(simplify,[s]);

[-arctan((-1+sqrt(3))/(1+sqrt(3)))+2*Pi*_Z1, -arcta...

verifying the solution

> _EnvAllSolutions:=false:
eq:=sin(x)^2+cos(x)=1/2: s:=solve( eq, x );

s := arctan(1/2*3^(1/4)*sqrt(2)/(-1/2*sqrt(3)+1/2))...
s := arctan(1/2*3^(1/4)*sqrt(2)/(-1/2*sqrt(3)+1/2))...

> seq(simplify(eval(eq,x=i)), i=s);

1/2 = 1/2, 1/2 = 1/2, 1/2 = 1/2, 1/2 = 1/2

> seq(evalf(subs(x=i, eq)), i=s);

.4999999992 = .5000000000, .5000000000 = .500000000...
.4999999992 = .5000000000, .5000000000 = .500000000...

plotting points

> s:=solve( sin(x)^2+cos(x)+3 );

s := arctan(1/2*sqrt(-14+2*sqrt(17)),1/2-1/2*sqrt(1...
s := arctan(1/2*sqrt(-14+2*sqrt(17)),1/2-1/2*sqrt(1...

> sf:=map(evalf,[s]);

sf := [3.141592654-1.015558753*I, 3.141592654+1.015...

> pts:=[seq( [Re(i),Im(i)], i=sf)];

pts := [[3.141592654, -1.015558753], [3.141592654, ...

> plot(pts, style=point, symbol=circle );

[Maple Plot]

> plots[complexplot]([s],style=point, symbol=circle);

[Maple Plot]

>

>

rsolve

> restart:

> lsg:=rsolve({f(n)=n+f(n-1),f(0)=0},f(n));

lsg := (n+1)*(1/2*n+1)-1-n

> nsum:=unapply(simplify(lsg),n);

nsum := proc (n) options operator, arrow; 1/2*n^2+1...

> nsum(10);

55

>

> lsg:= rsolve( {f(n)=f(n-1)+f(n-2), f(0)=0, f(1)=1}, f(n) );

lsg := (1/5*sqrt(5)-1)*(-2*1/(1-sqrt(5)))^n/(1-sqrt...

> fib:=unapply( radnormal(lsg), n);

fib := proc (n) options operator, arrow; 1/5*sqrt(5...

> fib(15);radnormal(%);

1/5*sqrt(5)*(32768*1/((-1+sqrt(5))^15)+32768/((1+sq...

610

pattern matching

> restart:

> match( x^2-1= (x-a)*(x-b), x, 'lsg');

true

> lsg;

{b = 1, a = -1}

> solve( identity( x^2-1=(x-a)*(x-b), x), {a,b} );

{b = 1, a = -1}, {b = -1, a = 1}

> match( 2*sin(3*x^4)= a*sin(n*x^k), x, 'lsg'); lsg;

true

{a = 2, n = 3, k = 4}

> solve( identity( 2*sin(3*x^4)= a*sin(n*x^k), x), {a,n,k} );

> match( x^2+3*x+5= a*(x+b)^2+c*x, x, 'lsg'); lsg;

true

{a = 1, b = RootOf(-5+_Z^2,label = _L3), c = -2*Roo...

> allvalues(%);

{a = 1, b = sqrt(5), c = -2*sqrt(5)+3}, {a = 1, b =...

> subs(%[1], a*(x+b)^2+c*x);

(x+sqrt(5))^2+(-2*sqrt(5)+3)*x

> match( sin(2*x)+sin(x) = cos(x+c)+cos(2*x+c), x, 'lsg');

false

> solve(identity(sin(2*x)+sin(x) = cos(x+c)+cos(2*x+c),x), {c});

special commands

Lösungsfunktionen

> restart:

> lsg:=solve( f(x)+f(x)^2=1+x^3, f);

lsg := proc (x) RootOf(_Z+_Z^2-1-x^3) end proc

> unapply(convert(lsg(x),radical), x);

proc (x) options operator, arrow; -1/2+1/2*sqrt(5+4...

> simplify( lsg(x)+lsg(x)^2 );

1+x^3

Ungleichungen, Simplex probleme

> solve( abs(x)<1);

RealRange(Open(-1),Open(1))

> solve(abs(x)<1, {x});

{x < 1, -1 < x}

> solve( x^2+x>2); solve( x^2+x>2, {x});

RealRange(-infinity,Open(-2)), RealRange(Open(1),in...

{x < -2}, {1 < x}

> solve( x^2+x<2); solve( x^2+x<2, {x});

RealRange(Open(-2),Open(1))

{x < 1, -2 < x}

> solve( abs(x)+abs(x+3)<10); solve( abs(x)+abs(x+3)<10, {x});

RealRange(Open(-13/2),Open(7/2))

{x < 7/2, -13/2 < x}

> solve( x^2+x>5, x ); solve( x^2+x>5, {x} );

RealRange(-infinity,Open(-1/2-1/2*sqrt(21))), RealR...

{x < -1/2-1/2*sqrt(21)}, {-1/2+1/2*sqrt(21) < x}

> solve( a*x^2+b*x+c>0,x);

> solve( sin(x)>1/2 );

> eq := {x+y>=5, x-y>=1, y-x/2<=1/2}:

> solve( eq, {x, y} );

{5-x-y <= 0, 1-x+y <= 0, y-1/2*x-1/2 <= 0, 3 <= x}

isolve

> isolve( x+2*y+3*z=10, {k,l} );

{y = k, x = 10-2*k-3*l, z = l}

>

Zurück zum Inhaltsverzeichnis