Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;
f := proc (x) options operator, arrow; exp(-x)*sin(x) end proc
intvx := 0 .. 3

 

And this one below ( i prefer this one ) , but got in worksheet now the one above
Probably a option issue ?

 

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;

proc (x) options operator, arrow; exp(-x)*sin(x) end proc


 

2 determinants equal, solve for the unknowns in one determinant/Linear Algebra

Hi guys, thank you for reading my question.

A is one determinant "Matrix(2, 3, [[1, 2, 3], [3, 1, 2]])".B is" Matrix(2, 3, [[1, x, 3], [y, 1, z]])"

I wrote 2 matrice in the maple

As I try to solve the unknowns,I wrote:

A:= B, solve(x, y, z) It doesn't work

I switch another phrase,

A = B;solve(B:x,y,z)    It doesn't work as well

Could you help me with it ?

Thank you

 

 

Dear All.

Please kindly help to correct the attached code on discretization of fourth order PDE using method of line.
Thank you and kind regards.

restart

``

``

Discretization of parabolic equation with method of line

diff(u(x, t), t) = -2*(diff(diff(u(x, t), x), x))-(diff(diff(diff(diff(u(x, t), x), x), x), x))-u(x, t)*(diff(u(x, t), x))

u(x, t)

u(x, t)

u(x, 0) = 0.3e-1*sin(x)

8

``

``

``

Convert the BC to finite difference

(1/2)*(u[m+1](t)-u[m-1](t))/h

(u[m-1](t)-2*u[m](t)+u[m+1](t))/h^2

(u[m-2](t)-4*u[m-1](t)+6*u[m](t)-4*u[m+1](t)+u[m+2](t))/h^4

````

Convert the governing equation to finite difference form

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: LinearAlgebra:-GenerateMatrix expects its 1st argument, eqns, to be of type ({list, set})({`=`, algebraic}), but received eqs

A

``


 

Download Discretization_of_PDE_Order_4.mw

restart;

ii := 50;

seq(ii, ii = 0 .. 5);

evalf(int(ii, ii = 0 .. 5))

 

For sequence the syntax is correct i.e the output is 0,1,2,3,4,5. is ii inside sequence command takes the value 5 assigned it then changes when ii ranges from 0 to 5?

restart;

ii:=50:
seq(ii)

output: 50

restart;

ii:=50:

seq(seq(ii),ii=1..5)

expected answer: 50,50,50,50,50

obtained: 1,2,3,4,5

please explain how seq command works

 

Trebuchet, Phase I, 2020-05-27 Ki restart; with(RealDomain); with(SolveTools); assume(h < r1); additionally(h < r2); [Im, Re, ^, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, eval, exp, expand, limit, ln, log, sec, sech, signum, simplify, sin, sinh, solve, sqrt, surd, tan, tanh ] [AbstractRootOfSolution, Basis, CancelInverses, Combine, Complexity, Engine, GreaterComplexity, Identity, Inequality, Linear, Parametric, Polynomial, PolynomialSystem, RationalCoefficients, SemiAlgebraic, SortByComplexity] hz1 := g*(r3*m3*cos(phi1(t))-r1*m2*sin(phi2(t))/sin(phi2(t)-phi1(t)))/theta3; whattype(phi1(t)); whattype(phi2(t)); / r1 m2 sin(phi2(t)) \ g |r3 m3 cos(phi1(t)) + -----------------------| \ sin(-phi2(t) + phi1(t))/ hz1 := ------------------------------------------------ theta3 function function hz2 := phi1(t)+arcsin((h+r1*sin(phi1(t)))/r2); /h + r1 sin(phi1(t))\ hz2 := phi1(t) + arcsin|-------------------| \ r2 / subs(phi2 = hz2, hz1); / / | | 1 | | ------ |g |r3 m3 cos(phi1(t)) theta3 | | | | \ \ // /h + r1 sin(phi1(t))\\ \ \\ r1 m2 sin||phi1(t) + arcsin|-------------------||(t)| || \\ \ r2 // / || + ----------------------------------------------------------|| / / /h + r1 sin(phi1(t))\\ \|| sin|-|phi1(t) + arcsin|-------------------||(t) + phi1(t)||| \ \ \ r2 // /// deq := diff(phi1(t), t, t)-% = 0; / / / 2 \ | | | d | 1 | | deq := |---- phi1(t)| - ------ |g |r3 m3 cos(phi1(t)) | 2 | theta3 | | \ dt / | | \ \ / /h + r1 sin(phi1(t))\ \ \ r1 m2 sin|phi1(t)(t) + arcsin|-------------------|(t)| | \ \ r2 / / | + -----------------------------------------------------------| / /h + r1 sin(phi1(t))\ \| sin|-phi1(t)(t) - arcsin|-------------------|(t) + phi1(t)|| \ \ r2 / // \ | | | = 0 | | / ics := phi1(0) = -arcsin(h/r1), (D(phi1))(0) = 0; /h \ ics := phi1(0) = -arcsin|--|, D(phi1)(0) = 0 \r1/ dsolve({deq, ics}, phi1(t)); dsolve(deq); deq_numeric := subs(r1 = 8, r2 = 8, r3 = 1, h = 5, m2 = 1, m3 = 20, theta3 = 20, deq); / | / d / d \\ 1 | |--- |--- phi1(t)|| - -- g |20 cos(phi1(t)) \ dt \ dt // 20 | | \ / /5 \ \ \ 8 sin|phi1(t)(t) + arcsin|- + sin(phi1(t))|(t)| | \ \8 / / | + --------------------------------------------------------| = 0 / /5 \ \| sin|-phi1(t)(t) - arcsin|- + sin(phi1(t))|(t) + phi1(t)|| \ \8 / // ics_numeric := phi1(0) = 0, (D(phi1))(0) = -.63; ics_numeric := phi1(0) = 0, D(phi1)(0) = -0.63 hz1 := dsolve({ics, deq_numeric}, phi1(t), numeric); Error, (in dsolve/numeric/process_input) unknown arcsin(5/8+sin(phi1(t))) present in ODE system is not a specified dependent variable or evaluatable procedure sin(-phi1(t)-arcsin((h+r1*sin(phi1(t)))/r2)); / /h + r1 sin(phi1(t))\\ -sin|phi1(t) + arcsin|-------------------|| \ \ r2 //

How to convert expression below to LaTex:  $\lim _{x \rightarrow 2} \frac{2}{x+3}$

And How to convert expression below to LaTex:  $\int_{2}^{3} \frac{1}{x^{2}+2} d x$

file test: newLaTex.mw

ode3 := diff(P(t), t) = 0.2*P(t) - 300;
                        d                       
              

ICs := [[0, 1300], [0, 1800]];
DEplot(ode3, p(t), p = -50 .. 2000, t = 0 .. 2000, ICs, arrows = LINE, color = RED, linecolor = BLUE, title = "Solution Curves ode3");
Error, (in DEtools/DEplot) invalid variable in specification of independent variable range
 

I want to plot y=sec(x) and x=-pi/4, x= pi/4. I also want the bounded region shaded. I have been able to graph sec(x) but I can't figure out how to get the two vertical lines and the bounded region shaded.

Hi there!

Essentially, sum(sqrt(-2),x=2..1) is, as it should be, 0. My issue is, that e.g. sum(sqrt(-2),x=2..0) or sum(sqrt(-2),x=2..-1)  are declared by Maple as -I*sqrt(2) and -(2*I)*sqrt(2), which, to my knowledge, is not true, and should be 0 as well. I need those results for a rather complicated algorithm to be 0, otherwise it doesn't work.

NEUZMinus:= proc(Unten, Oben, f,G,Liste,n)::real;
  #Unten:= Untere Intervallgrenze; Oben:= Obere Intervallgrenze; g:= zu integrierende Funktion;
  #G:= Gewicht; n:= Hinzuzufügende Knoten;
 
  Basenwechsel:=proc(Dividend, m);
 
  print(Anfang,Dividend,p[m]);
  Koeffizient:=quo(Dividend, p[m],x);

  Rest:=rem(Dividend, p[m],x);
 
  if m=0 then
    Basenwechsel:=[Koeffizient];
  else

    Basenwechsel:=[Koeffizient,op(Basenwechsel(Rest,m-1))];
   
  end if;
 
  end proc;
p[-1]:=0;
p[0]:=1;
for i from 1 to max(n,numelems(Liste)) do
  p[i]:=x^i-add(int(x^i*p[j]*diff(G,x),x=Unten..Oben)*p[j]/int(p[j]^2*diff(G,x),x=Unten..Oben),j=0..i-1);
  print(p[i]);
c[i-1]:=lcoeff(p[i],x)/lcoeff(p[i-1],x);
d[i-1]:=coeff(p[i],x,(i-1))/coeff(p[i-1],x,(i-1));
if i <> 1 then
  e[i-1]:=coeff(p[i]-(c[i-1]*x+d[i-1])*p[i-1],x,i-2)/coeff(p[i-2],x,i-2);
else
  e[i-1]:=1;
end if;
end do;
print(Liste[1],numelems(Liste));
Hn:=mul(x-Liste[i],i=1..numelems(Liste));
print(Hn);
 Koeffizienten:=Basenwechsel(Hn,numelems(Liste));
print(Koeffizienten);
for j from 0 to numelems(Liste)-1 do
  a[s][j][j]:=1;
end do;
for s from 1 to numelems(Liste)-1 do
  a[s][0]:=[1];
  a[s][1]:=[-e[s]*c[0]/c[s],d[0]-d[s]*c[0]/c[s],c[0]/c[s]];
  for j from 2 to numelems(Liste)-1 do
    print(1);
    a[s][j][abs(s-j)]:=sum(-c[j-1]*e[i+1]*a[s][j-1][i+1]/c[i+1],i=abs(s-j)..min(abs(s-j),s+j-2));
    print(2);
    a[s][j][abs(s-j)+1]:=sum(d[j-1]-c[j-1]*d[i]/c[i])*a[s][j-1][i],i=abs(s-j)+1..min(abs(s-j)+1,s+j-1)+sum(-c[j-1]*e[i+1]*a[s][j-1][i+1]/c[i+1],         i=abs(s-j)+1..min(abs(s-j)+1,s+j-2));
    print(3);
    for i from abs(s-j)+2 to s+j-2 do
      a[s][j][i]:=c[j-1]*a[s][j-1][i-1]/c[i-1]+(d[j-1]-c[j-1]*d[i]/c[i])*a[s][j-1][i]-c[j-1]*e[i+1]*a[s][j-1][i+1]/c[i+1]+e[j-1]*a[s][j-2][i];

      print(4);
    end do;
    a[s][j][s+j-1]:=sum(c[j-1]*a[s][j-1][i-1]/c[i-1],i=max(s-j+2,s+j-1)..s+j-1)+sum((d[j-1]-c[j-1]*d[i]/c[i])*a[s][j-1][i],i=max(s-j+1,s+j-1));
    print(5);
    a[s][j][s+j]:=sum(c[j-1]*a[s][j-1][i-1]/c[i-1],i=max(s-j+2,s+j)..s+j);
    print(6);
  end do;
end do
 

end proc

 

In the case of

a[s][j][abs(s-j)+1]:=sum(d[j-1]-c[j-1]*d[i]/c[i])*a[s][j-1][i],i=abs(s-j)+1..min(abs(s-j)+1,s+j-1)+sum(-c[j-1]*e[i+1]*a[s][j-1][i+1]/c[i+1],         i=abs(s-j)+1..min(abs(s-j)+1,s+j-2));

 
 
for example, the
i=abs(s-j)+1..min(abs(s-j)+1,s+j-2) clause in the end checks, wether the term should be added or not. I basically just need a way to tell Maple wether to add a term or not, depending on wether abs(s-j)+1 is not greater than s+j-2 in this case, without using if-clauses if possible. The problem here is, that min(abs(s-j)+1,s+j-2) can become 0, Maple then tries to calculate something instead of returning 0, and then complains when something inside the term is not properly defined (c[j-1] can become c[-1] for example when j=0) and aborts the entire procedure. How can I tell it to just assign 0?
 
 
 
 
 

I'm having problems with Multiplying Complex Numbers in Maple 2019.

Thanks in Advance.

Example 2: Multiplying Complex Numbers

 

(2-i)(4+3*i)

(3+2*i)(3-2*i)

4*i(-1+5*i)

(3+2*i)^2

2-i(4+3*i)

 

3+2*i(3-2*i)

 

4*i(-1+5*i)

 

(3+2*i)^2

(1.1)

``


 

Download Multiplying_Complex_num.mw

How I can plot the answers obtained from solving two differential equations?

Thanks

SAL.mw
 

restart

e := 0.62e-2

0.62e-2

(1)

r := 0.15e-1

0.15e-1

(2)

DDo2 := .17*3600

612.00

(3)

DDco2 := .12*3600

432.00

(4)

NULL

N := 20

20

(5)

P1o2 := 3600*(1000*(27*10^(-13)*24.45)*100)/(10000*0.986923267e-2)

0.2408029155e-3

(6)

P1co2 := 3600*(1000*(99*10^(-13)*24.45)*100)/(10000*0.986923267e-2)

0.8829440235e-3

(7)

P2o2 := Pi*r^2*DDo2*N/(e+r)

408.1106684

(8)

P2co2 := Pi*r^2*DDco2*N/(e+r)

288.0781188

(9)

diff(y[o2](t), t) = ((P1o2+P2o2)*(21-y[o2](t))-100*(167*y[o2](t)/(1.6+y[o2](t))*.25))*(1/1300)

diff(y[o2](t), t) = 6.592560841-.3139314686*y[o2](t)-3.211538462*y[o2](t)/(1.6+y[o2](t))

(10)

diff(y[co2](t), t) = ((P1co2+P2co2)*(0.4e-1-y*y[co2](t))+.25*(.8*(167*y*y[co2](t)/(1.6+y*y[co2](t))))*100)*(1/1300)

diff(y[co2](t), t) = 0.8863969285e-2-.2215992321*y*y[co2](t)+2.569230769*y*y[co2](t)/(1.6+y*y[co2](t))

(11)

                 initial*conditional     @t=0     yO2=21 , yco2=0.04


 

Download SAL.mw

 

Dear, could you please help me with the following doubt?

If I have 2 procedures, 

P1:= proc() 

......

end proc;

P2:= proc()

.....

P1();

end proc;

and within P2 I invoke and run P1, do I have to declare P1 as a local/global variable when declaring variables in P2, or it is not necessary? 

Many thanks for your help. 

 

How can I see 8 1/2 x 11" page margins to write a simple letter size report?

Hello everyone,

first, I'd like to mention that I am relatively new to Maple and am therefore thankful for any advice you might have!

I am trying to integrate the term (k_1^2 * r) from a to infinity, see the picture below as well as the attached file. Maple seems to have some issues with that. However, if I break the integral down into more manageable parts it suddenly works! Why is that? How can I get Maple to solve this immeadiately?  I suspect the culprit lies in the term that contains (-Ei(-B*r)*r^(-1)) where Ei is the exponential integral as defined in Maple. The resulting  hypergeometric function seems suspicious.

The problem is that I have to evaluate 21 integrals of this type (k_x*k_y*r) and breaking them down manually becomes pretty cumbersome, especially as the number of terms in the expanded expressions increases. Is there a way to automate this procedure? I guess I would need to extract individual terms and automatically plug them into the integral expression. That should the last resort, however.

The specific problem (everything included for context, weird stuff happens after equation 15):

Maple_Problem.mw

As for the variables: E, t, and R are real positive numbers. a and B are already assumed as real and positive. A_0, C_0, A_2, and C_2 are real numbers (could be negative, I do not know yet since they must be determined later on). a_0 is definitely real, but it may be negative. r is the polar coordinate, so it is also real and positive, but adding this assumption did not yield a better result.

 

Thank you for your help!

 

How to use random variables for different parameters in Maple to find min and max value, like i have R1 min, nom and max value,

I have ratio of R1/R2, temperature coefficient for R1 for min and max value?

First 422 423 424 425 426 427 428 Last Page 424 of 2097