MaplePrimes Questions

Hi,

I am trying to solve a set of ode which depends on some parameters like A0,0,  A1,0, A1,1, B0,0,  B1,0, B1,1, C0,0 and so on. Here is some part of my code:

 

restart;

sigma := 1; X := proc (m) if m <= 1 then 0 elif 2 <= m then 1 end if end proc;

lambda := proc (m, k) if k <= m and 0 <= k then 1 else 0 end if end proc;

Typesetting:-Settings(functionassign = false);

for m from 0  to 4 do    

for k  from 4 by -1 to 0 do  

A[m,k](r) :=diff(f[m,k](r),r$2)+((k+1)*(k+2))/(r^(2))*(lambda(m,k+2)*f[m,k+2](r)-f[m,k](r)):  

T[m,k]:=(k+1)*(lambda(m,k+1)*A[m,k+1](r) -lambda(m,k-1)*A[m,k-1](r)):      

S[m,k]:=(k+1)*(lambda(m,k+1)*f[m,k+1]( r)-lambda(m,k-1)*f[m,k-1](r)):               # There are also C[m,k], B[m,k] and E[m,k] definitions similar to A[m,k],T[m,k] and S[m,k]

Q[m, k] := r^(4-sigma)*E[m, k]-2*lambda(m, k+2)*(k+1)*(k+2)*(r^2*(diff(f[m, k+2](r), `$`(r, 2)))-2*r*(diff(f[m, k+2](r), r)))-(k+1)*(k+2)*(k+4)*((k+3)*lambda(m, k+4)*f[m, k+4](r)-(2*(k+1))*lambda(m, k+2)*f[m, k+2](r));

ode[m, k] := r^4*(diff(f[m, k](r), `$`(r, 4)))-(k+1)*(k+2)*(2*r^2*(diff(f[m, k](r), `$`(r, 2)))-4*r*(diff(f[m, k](r), r))-(k-1)*(k+4)*f[m, k](r)) = Q[m, k];

soln[m, k] := rhs(dsolve(ode[m, k], f[m, k](r)))

 

After obtaining the solution, there are some additional parts in my code to find the coefficients of odes. The code is just working fine until m=3. When m=3, I am getting this error:

Error, (in solve) cannot solve expressions with Int(-(1/282240)*r*(3*(h . R)^2*(Int((6720*ln(r)*h*r^6-22176*ln(r)*h*r^5-50400*ln(r)*r^6-2814*h*r^6+33600*r^7+18144*ln(r)*h*r^4+90720*ln(r)*r^5+8238*h*r^5-95520*r^6+2352*h*ln(r)*r^3-7974*h*r^4+57780*r^5-2880*ln(r)*h*r^2-14400*ln(r)*r^3-2443*h*r^3+2100*r^4+6108*h*r^2+5340*r^3-1115*h-3300*r)/r^6, r))-4480*_C1), r) for _C1

I think the problem is due to declaration of f[m,k](r) values for the set of odes. For example, before solving ode[3,3], the code declares a value for f[3,3](r) which includes some integral definition in ode[3,3] although i want to find the solution for f[3,3](r). 

To illustrate,

ode[1,1]=r^4*(diff(f[1, 1](r), r, r, r, r))-12*r^2*(diff(f[1, 1](r), r, r))+24*r*(diff(f[1, 1](r), r)) = -Typesetting[delayDotProduct](r, h . R, true)*((2*(diff(f[0, 0](r), r))-4*f[0, 0](r)/r)*(diff(f[0, 0](r), r, r)-2*f[0, 0](r)/r^2)-(2*(-3/4-1/(4*r^2)+r))*A[0, 0]+(2*(diff(f[0, 0](r), r, r, r)+4*f[0, 0](r)/r^3-2*(diff(f[0, 0](r), r))/r^2))*f[0, 0](r))

soln[m, k] := rhs(dsolve(ode[m, k], f[m, k](r)))

 

where I already know the definition of f[0,0](r)=-(3/4)*r+1/(4*r)+(1/2)*r^2   and A[0,0]=1/(2*r^3)+1+(2*((3/4)*r-1/(4*r)-(1/2)*r^2))/r^2 

So, ode[1,1] can be solved with respect to f[1,1](r).

I would be glad for any comments. 

Here is my code.

 test.mw

Int(exp(t), t= 0 ..x) +1 is just a way to write exp(x), use value(%).

ff:= x -> evalf(Int(exp(t), t= 0 .. x, method = _d01ajc) + 1) does
the same, but in a numerical way.

Now consider that as a differential equation, to be solved numerically:

de:=D(f)(x) = f(x);
dsolve({%, f(0)=1});
                         f(x) = exp(x)


ff:= x -> evalf(Int(exp(t), t= 0 .. x, method = _d01ajc) + 1);

D(f)(x) = ff(x);
sol:=dsolve({%, f(0)=1}, numeric);

  Warning, The use of global variables in numerical ODE problems is deprecated,
  and will be removed in a future release. Use the 'parameters' argument instead
  (see ?dsolve,numeric,parameters)

sol(1);

  Error, (in sol) parameter 't' must be assigned a numeric value before
  obtaining a solution

Question: how to write it down correctly?

I have been here before...  My head is full of cotton, as usual.

 

f := proc (t) 2*t^3+9*t^2-60*t+1 end proc;
deq:=diff(f(t),t);
df := t->deq;  ## this is most likely one of my problems.
plot(df(t),t=-10..10);
isneg := x -> if is(df(x) < 0) then df(x) else 0 end if;  ## and, another??
plot(isneg(t),t=-10..10);
Plt1:=plot(isneg(t),t=-10..10);
plots:-display(Plt1);
isneg(0.12017234);

The if statement is not fully evauated.

I am missing something.  What?

Tom Dean

Hi dear friends

How do I improve my ability to manipulate code?

Thanks

_________________________________________________________________________________________

 

restart:

Digits := 30: m := 20: p0 := 8.: g := -0.3: nu := 0.3: a := 1:


w := sum(b[n]*r^(1.02*n), n = 1 .. m):


ODE := r^3*(g*r+a)^3*(diff(w, r, r, r, r))+2*(diff(w, r, r, r))*r^2*(4*g*r+a)*(g*r+a)^2+(diff(w, r, r))*r*(3*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2+11*g^3*r^3+3*a^2*g*nu*r+15*a*g^2*r^2+3*a^2*g*r-a^3)+(diff(w, r))*(6*g^3*nu*r^3+P*a^3*r^2+6*a*g^2*nu*r^2-2*g^3*r^3-3*a*g^2*r^2+a^3):


for P from p0 by 0.1e-1 to p0+1 do
W := simplify(subs(solve({seq(evalf(subs(r = j/(m+2), ODE)), j = 2 .. m-1), subs(r = 1, diff(w, r))}, {seq(b[j], j = 1 .. m)}), w/b[m])):
F := (int(((diff(W, `$`(r, 2))+(diff(W, r))/r)^2-(2*(1-nu))*(diff(W, `$`(r, 2)))*(diff(W, r))/r)*r*(1+g*r/a)^3, r = 0 .. a))/(int((diff(W, r))^2*r, r = 0 .. a)):
delta[trunc(100*(P-p0))] := abs(F-P) end do:


plot(W, r = 0 .. a);


Min := min(seq(delta[j], j = 0 .. 100)):


for j from 0 to 100 do if delta[j] = Min then print(p0+j/(100.)) else  end if end do;

Hi all,

I have this matrix for example:

A := <<1,2>|<3,4>>;

How to determine: 2^A

Thank you

plz help me, how do i solve singular ODEs of lane Emden type equation for homotopy analysis method in maple? there is arising an arror, invalid fraction

Hi everyone! Please help me..

I want to do the procedure for the FirstReturn of a map. I think my procedure is not correct.
I want to write a procedure 
FirstReturn:=proc(F,x,p,q) where F is any map (function), x is the integer and the starting point, and p&q is the integer that form an interval [p,q].
If i start from the point x in [p,q], then after some iterations, there is Ft(x) in the interval [p,q].
I am interested with the the value of Ft(x) and the iteration, t when it comes back to the interval [p,q]  to be the output of the procedure.
What i did is shown below. But I dont have any idea to make it work!

Please help. Really appreciate your help.. 

FirstReturn := proc (F, x, p, q)
local t, z;
if p <= x and x <= q then F(x) := x end if;
for t while x < p and q < x or t = 1 do
x := z;
if p <= z and z <= q then
z;
end if;
end do;
return (z, t);
end proc;


M := 10^2; plot(exp(M), t);

When we execute the above code we get graph in output naturally. But when execute the following code  , there is no graph in output, why?

M := 10^3; plot(exp(M), t);

Thanks in advance for any suggestion.

To begin with my code is:

with(Statistics);

N:=RandomVariable(Normal(5,2))

 

for i from 1 by 1 to 100 do

OS[i]:=Sample(N,50)

end do

 

for i from 1 by 1 to 100 do

 print(i)

  from j from 1 by 1 to 1000 do

    BS[i,j]:=Bootstrap('Mean',OS[i],replications=1)

  end do

end do

 

My goal is to produce as an output in the software's screen the values of 1000 bootstrap means for each of 100 original samples in order to export the results to Excel. Based on my basic knowledge of programming I thought that I can do that through the use of the vectors. Unfortunately though when I trigger the operation the software seems to be evaluating (with the homonymous indication in the bottom left corner of the screen) it for an indefinite period of time, obliging me to stop it at some point. However, let me point out that when I do the same process for i and j 4 and 10 for example then I have results, therefore presumably my code is correct. I know that I can do the same operation in Excel and I have already created a respective macro, however I wanted to use Maple in order to take advantage of its fast operation of calculations, which is pointless in case that I have to wait more time for the results than I have already waited to be eventually produced.

Any thought and idea would be appreciated, thank you very much in advance!

after tried dsolve(sol, [a,b,c]) or dsolve(sol,t), still have errors

First equation

sol := a*(diff(M(a, b, c), a))+a*b*(diff(M(a, b, c), b))*c
dsolve(sol);
Error, (in ODEtools/info) Required a specification of the indeterminate function

Second Equation

sol := a(t)*(diff(a(t), t))+a(t)*b(t)*(diff(b(t), t))*c(t)
dsolve(sol);
Error, (in ODEtools/info) Required a specification of the indeterminate function

I am using QPSolve for a very large matrix. Before printing the answer, Maple gives me the following warning

"Warning, necessary conditions met but sufficient conditions not satisfied".

Does it mean that the solution is feasible, but not optimum?

Please_Help_for_a_better_presentation.mw
I have used conduction Fourier formula to find k or q or T. Each time i hAvE to run from restart and units. Can this duplication be eliminated?
How do i rewrite the codes?

Thanks for considering this worth answering.

Ramakrishnan Vaidyanathan

restart

with(Units[Standard])

with(Units)

UsingSystem()

SI

(1)

q := -k*(T__2-T__1)/t

-k*(T__2-T__1)/t

(2)

S := {T__1 = 550*Unit('K'), T__2 = 50*Unit(Unit('K')), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), t = 2*Unit('cm')}

{T__1 = 550*Units:-Unit(K), T__2 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), t = (1/50)*Units:-Unit(m)}

(3)

eval(q, S)

477.5000000*Units:-Unit(kW/m^2)

(4)

refresh

restart

with(Units[Standard])

with(Units)

UsingSystem()

 

 

t := -k*(T__2-T__1)/qNULL

 

-k*(T__2-T__1)/q

(5)

S := {T__1 = 550*Unit('K'), T__2 = 50*Unit(Unit('K')), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), q = 477.5*Unit('kW'/'m'^2)}

{T__1 = 550*Units:-Unit(K), T__2 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), q = 477500.0*Units:-Unit(kg/s^3)}

(6)

eval(t, S)

2.000000000*Units:-Unit(cm)

(7)

restart

clear

 

``NULL

NULL

 

  refresh

restart

with(Units[Standard])

with(Units)

UsingSystem()

NULL

T__2 := q*t/k+T__1

q*t/k+T__1

(8)

S := {T__1 = 50*Unit('K'), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), q = 477.5*Unit('kW'/'m'^2), t = 2*Unit('cm')}

{T__1 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), q = 477500.0*Units:-Unit(kg/s^3), t = (1/50)*Units:-Unit(m)}

(9)

eval(T__2, S)

550.0000000*Units:-Unit(K)

(10)

NULL

 

NULL

 

Download Please_Help_for_a_better_presentation.mw

restart

with(Units[Standard])

with(Units)

UsingSystem()

SI

(1)

q := -k*(T__2-T__1)/t

-k*(T__2-T__1)/t

(2)

S := {T__1 = 550*Unit('K'), T__2 = 50*Unit(Unit('K')), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), t = 2*Unit('cm')}

{T__1 = 550*Units:-Unit(K), T__2 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), t = (1/50)*Units:-Unit(m)}

(3)

eval(q, S)

477.5000000*Units:-Unit(kW/m^2)

(4)

refresh

restart

with(Units[Standard])

with(Units)

UsingSystem()

 

 

t := -k*(T__2-T__1)/qNULL

 

-k*(T__2-T__1)/q

(5)

S := {T__1 = 550*Unit('K'), T__2 = 50*Unit(Unit('K')), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), q = 477.5*Unit('kW'/'m'^2)}

{T__1 = 550*Units:-Unit(K), T__2 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), q = 477500.0*Units:-Unit(kg/s^3)}

(6)

eval(t, S)

2.000000000*Units:-Unit(cm)

(7)

restart

clear

 

``NULL

NULL

 

  refresh

restart

with(Units[Standard])

with(Units)

UsingSystem()

NULL

T__2 := q*t/k+T__1

q*t/k+T__1

(8)

S := {T__1 = 50*Unit('K'), k = 19.1*Unit('W')/(Unit('m')*Unit('K')), q = 477.5*Unit('kW'/'m'^2), t = 2*Unit('cm')}

{T__1 = 50*Units:-Unit(K), k = 19.1*Units:-Unit(m*kg/(s^3*K)), q = 477500.0*Units:-Unit(kg/s^3), t = (1/50)*Units:-Unit(m)}

(9)

eval(T__2, S)

550.0000000*Units:-Unit(K)

(10)

NULL

 

NULL

 

Download Please_Help_for_a_better_presentation.mw

Hello,

I would like to assume a matrix to have only real components.

I have seen that the function assume has some features to assume properties for matrix. But, I didn't find the one that I want : "assume a matrix to have only real components".

This assumation should allow me to suppress this kind of choice in my code :

if A::{complexcons, undefined} then
evalf(1/A);
elif A::rtable and ArrayTools:-NumElems(A) = 1 then
Vector([evalf(1/A(1))]);
else
evalf(LinearAlgebra:-MatrixInverse(A));
end if;

Do you have some ideas ?

P.S: The matrix should be also a square matrix. So, the first code line will probably be : assume(a, 'SquareMatrix')

Thanks a lot for your help.

As i  want to build a model of engine an want to supply compressed air for same ii prepared a engine model but now i am not geeting how to prepare model flow of compressed air and its expansion in enige and force crated on engine head.

Maple 15

eq:=1/2*x^(1/2) + 1/13*x^(1/3) + 1/26*x^(45/37);
evalf(eq);

The exponents are still fractions.  I want to have floating point exponents.


0.5*x^0.500000 + 0.07692307692*x^0.333333 + 0.03846153846*x^1.216216216

How do I do this?

 

Tom Dean

First 1246 1247 1248 1249 1250 1251 1252 Last Page 1248 of 2429