## 454 Reputation

19 years, 165 days

## Suggestion....

I don't know if this is possible. However, you can create a procedure

intproc := proc (x, y, z)
int(1/(x-(y+z)*t), t)
end proc;

and then call it with desired parameters like

intproc(a,b,c);
ln((-b - c) t + a)
------------------
-b - c
intproc(a,b,-b);
t
-
a

You can also print it in a different way with:

Int(1/(a-(b+d)*t), t) = piecewise(seq(op(['d' = d, intproc(a, b, d)]), d in {c, -b}));

Using this way you have to know all the possible cases (that can happen).

Look at FAQ.

## Ctrl + =...

Another way is to use "Ctrl"+"=". Look e.g. here: Using Shortcuts in Maple.

## own sin function?...

I would try to define my own sin function, e.g.

dsin := proc(x) sin((1/180)*Pi*x) end proc;

and solve the ODE with dsin instead of sin.

## Partially yes....

Well, you can skip it, but only partially in the 2D input by using a space.

When you type

x y

then Maple takes it as x*y. Typing

xy # without a space

creates a name called xy. However, I would not recommend this since it doesn't work anytime and it's more likely to make errors (by forgetting to put a space there). One case where this syntax doesn't work is when you use a numeric value with a name (in the reversed order):

Error, missing operation

## Multiplication sign....

You don't have a multiplication sign there.

expand((x+1)*(x+2));
2
x  + 3 x + 2

## Help pages....

Look into help pages at ?LinearAlgebra[DotProduct]. The vectors, for which you compute the dot product, have the same orientation, so you're getting the conjugated elements (which really influence the following solution of pde). You can change this by e.g. transposing the first vector and computing the "classical" dot product or adding conjugate=false into your DotProduct calls.

2. The solution is not only equal to x1. The solution is an arbitrary function of x1, which is what Maple returns. Just look at how the equation looks like. You can also try to evalute it for different functions w(x1,x2,x3)=f(x1).

## Suggestion....

Let's denote the line as y=k*x+q. And the two points as A=[A[1],A[2]] and B=[B[1],B[2]]. Then the following has to hold:

A[2]=k*A[1]+q,
B[2]=k*B[1]+q.

You can solve this just with the solve command:

A:=[1,1]: B:=[m+1,-2*m+2]:
solve({A[2]=k*A[1]+q,B[2]=k*B[1]+q},{k,q}):
assign(%);
y=k*x+q;

Or if you have to use the LinearAlgebra package I would do something like:

A:=[1,1]: B:=[m+1,-2*m+2]:
M:=Matrix([[A[1],1],[B[1],1]]):
v:=Vector([A[2],B[2]]):
kq:=LinearAlgebra[LinearSolve](M,v):
y=kq[1]*x+kq[2];

## Error message....

The error message is saying that you use both u(x,y) and u(x,a) and Maple doesn't know which one of them is the dependent variable for which to solve the equation.

You can correct this with calling:

pds := pdsolve(sys, [u(x, y)]);

By the way, you differentiate only with respect to one independent variable, so the given equation is an ordinary one and you can get the result with dsolve as well.

## My way....

Since no one has responded yet, this is how I would do it:

1) You can also use a backslash there

x := 0.7569:
printf("The value of x is %.1f%\%", 100*x);
The value of x is 75.7%

but I don't know either if this is the best way.

2) Even here I don't know if there is something more simple, but I would write a ?procedure for it. It then depends on how exactly (and for which group of numbers) you want to group digits. This proc will separate every three digits from the dot to both sides.

with(StringTools):

number_form:=proc(num::numeric)
local n,s,snew,sf,sfnew;

if type(num,fraction) then return num; end if;

s:=Reverse(convert(floor(num),string)):
n:=ceil(length(s)/3):
snew:=cat(seq(op([s[3*i-2 .. 3*i], ","]), i = 1 .. n-1), s[3*n-2 .. 3*n]):

sf:=convert(abs(op(1,frac(num))),string):
n:=ceil(length(sf)/3):
sfnew:=cat(seq(op([sf[3*i-2 .. 3*i], ","]), i = 1 .. n-1), sf[3*n-2 .. 3*n]):

return cat(Reverse(snew),".",sfnew);
end proc:

number_form(5);
"5.0"

number_form(1234.56789);
"1,234.567,89"

number_form(123456789);
"123,456,789.0"

number_form(1.23456789);
"1.234,567,89"

number_form(1234/56789);  # fractions are returned without changes
1234
-------
56789

Edit: Some negative numbers are not handled properly (can be corrected if desired, of course).

Edit2: You can also add this line

if type(num,integer) then return Reverse(snew); end if:

into the procedure before assigning to sf not to add the dot to integers. This results in:

number_form(5);

"5"

number_form(123456789);

"123,456,789"

## By output=listprocedure....

You can do it e.g. in this way:

F := dsolve({DGL1, init}, numeric, output = listprocedure):
f := eval(x(t), F):
plot(f(t)-S, t = 1.2 .. 2);

## Corrected worksheet....

I made some changes, so it works now. However, I don't know the whole problem.

Mistakes:

1) Be careful that Maple is case sensitive, so Expand is not the same as expand.

2) There were terms like "x*10^y*((....).c1)" in many places (The dot instead of the star before c[1]).

sort_poly2_new.mw

## dsolve, odeplot...

OK, here is how I would do it:

Xdot:=Vector(3,i->D(x[i])(t)):
A:=Matrix([[0,-1,-1],[1,0.2,0],[x[3](t),0,-2.4]]):
X:=Vector(3,i->x[i](t)):
B:=Vector([0,0,2]):
u:=1:

sys:=seq(Xdot[i]=(A.X+B.u)[i],i=1..3);

D(x[1])(t) = -x[2](t) - x[3](t),

D(x[2])(t) = x[1](t) + 0.2 x[2](t),

D(x[3])(t) = x[3](t) x[1](t) - 2.4 x[3](t) + 2

ic:=seq(x[i](0)=1,i=1..3);

x[1](0) = 1, x[2](0) = 1, x[3](0) = 1

sol := dsolve([sys, ic], numeric):

# plotting x[1] vs time
plots[odeplot](sol, [t, x[1](t)], t = 0 .. 10);

# plotting x[1] vs x[2]
plots[odeplot](sol, [x[1](t), x[2](t)], t = 0 .. 10);

and so on. There is also the equation y=CX+Du, but it's not needed here.

## Matrix....

You can do it like this (I changed your code a little):

with(RandomTools):
with(LinearAlgebra):
n := 4:
y := Vector([[1, 1, 1, 1, 1, 1, 1, 1]]):

results := Matrix(n, 3):

for i to n do

a1h := Generate ... # the "Generate" part

M := Matrix([[a1h, a1f, a1cl], [a2h, a2f, a2cl], [a3h, a3f, a3cl], [a4h, a4f, a4cl], [a5h, a5f, a5cl],
[a6h, a6f, a6cl], [a7h, a7f, a7cl], [a8h, a8f, a8cl]]);

m:=((M^(%T).M)^(-1)).(M^(%T).y);
results[i]:=m^(%T);
end do:

results;  # this matrix contains m-values in a row for each iteration

Edit: the y := Vector([[1, 1, 1, 1, 1, 1, 1, 1]]): command was added.

## Possible correction....

I made some corrections, but I don't know if it is now how you want it (especially the initial conditions). You forgot several brackets, argument of the function r(t) and the initial conditions were wrongly typed.

DifferentialSystem := {diff(r(t),t\$2)-r(t)*(diff(theta(t),t))^2=-1000/r(t)^2 ,
r(t)*(diff(theta(t),t\$2))+2*(diff(r(t),t))*(diff(theta(t),t))=0,
r(0)=sqrt(65), theta(0)=1.446,D(theta)(0)=-6/13,D(r)(0)=4*sqrt(65)/13};

Hope it will help.

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