## 235 Reputation

11 years, 38 days
Beijing, China

## How to split a square Matrix...

Maple 2015

Hi!

I hope everyone is fine. I have a square matrix like the following form
A := Matrix([[10, -1, 2, 0], [-1, 11, -1, 3], [2, -1, 10, -1], [0, 3, -1, 8]]);
How to split A into three matrices D, L and U as:

D:= Matrix([[10, 0, 0, 0], [0, 11, 0, 0], [0, 0, 10, 0], [0, 0, 0, 8]]);
L := Matrix([[0, 0, 0, 0], [-1, 0, 0, 0], [2, -1, 0, 0], [0, 3, -1, 0]]);
U := Matrix([[0, -1, 2, 0], [0, 0, -1, 3], [0, 0, 0, -1], [0, 0, 0, 0]]);

## Find t at which the limit of a function ...

Maple 2015

Hi dear Users!

I hope everyone here is fine. I have a function like

f := exp(-t)*(x^2-5*x^3+10*x^5+x+3+.5*x^4)+(1/2)*x^2*(x-1)+2*sin(x);

I have to find the value of t at which the behavior of this function is constant for 6 decimal places against x from 0..1. This is my effort

restart;
N := 20; TOL := 10^(-6); Points := 100000;
f := exp(-t)*(x^2-5*x^3+10*x^5+x+3+.5*x^4)+(1/2)*x^2*(x-1)+2*sin(x);
for j from 0 while j <= 10 do print("\nWhen x = ", j/(10.));
for i from 0 while i <= Points do
g[i, j] := evalf(eval(f, [x = (1/10)*j, t = N*i/Points]));
if `and`(i >= 1, abs(g[i, j]-g[i-1, j]) < TOL) then print("Value of t = ", evalf(N*i/Points)); print("Value of f = ", g[i, j]); break else
end if end do end do;

The same value is then verified by making graphs

plot([eval(f, t = 1), eval(f, t = 2), eval(f, t = 3), eval(f, t = 4), eval(f, t = 5), eval(f, t = 6), eval(f, t = 7)], x = 0 .. 1, color = [red, green, blue, cyan, yellow, black, purple]);
plot(eval(f, x = .8), t = 0.1e-1 .. N);

Here I want to know if is there any more effective maple command to find the value of t rather than using procedures (highlighted by red) or a graphical way.

## Formate plotting in 2D...

Maple 2015

Hi Users!

I hope everyone is fine. I want to plot any function say
f := exp(cos(x)+sin(x)) for x=a..b for any n say 12 so that h := (b-a)/n.

For a=0, b=3 and n=12 I got h=1/4 and plot of f is:

But I want the plotting as given bellow where the value of f(x) is mentioned and girds line.

## Problem in print command...

Maple 2015

Dear Users!

I hope everyone is fine here. I wrote the following statements with the print command:

restart; NN := [4, 6, 8]; a := 0; b := 2; n := 4;
h := evalf((b-a)/n); print("The domain of intergation is [a,b] = ", [a, b]);
f := exp(x); print("The given function is ", f);
Exact := evalf(int(f, x = a .. b)); print("The exact integration in [a,b] is ", Exact);
print("The value of h to divide the domain [a,b] into n subintervals is ", h);
print("Numerical integration in [a,b] is going to perform when h via RECTANGULAR METHOD for n = ", n);

The output is:

0.5000000000
"The domain of integration is [a,b] = ", [0, 2]
"The given function is ", exp(x)
"The exact integration in [a,b] is ", 6.389056099
"The value of h to divide the domain [a,b] into n subintervals is ", 0.5000000000
"Numerical integration in [a,b] is going to perform when h via RECTANGULAR METHOD for n = ", 4

I want the actual values of a,b, n and h highlighted in above as:

0.5000000000
"The domain of integration is [a,b] = ", [0, 2]
"The given function is ", exp(x)
"The exact integration in [0,2] is ", 6.389056099
"The value of h to divide the domain [0,2] into 4 subintervals is ", 0.5000000000
"Numerical integration in [0,2] is going to perform when 0.5 via RECTANGULAR METHOD for n = ", 4

## Select some terms from an expression...

Maple 2015

Dear users!

I hope everyone is fine here. I have the following expression:

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]:

What is the procedure to select some terms in the above expression for example for N=2 I just want the following terms:

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2];

and for N=3 I just want the following terms:

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3];

and for N=4 I want:

(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3];

and so on,

in the descending order in first suffices and ascending order in second suffices (like term having y[0,0],  y[0,1], y[-1,2], y[-1,3], y[-2,4]). I am waiting for your response. Thanks.

 1 2 3 4 5 6 7 Last Page 3 of 37
﻿