MaplePrimes Questions

Hello 

how can I write a loop of two variables (i,j )for this formula?

where m& n are fixed numbers.

looking forward to hearing from you.

Thanks

Strange (inconsistent) behavior of eval in piecewise

 

restart;#####################

a:=2:

p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < 2, 1/(-2+x), x = 2, 22, 33)

(1)

eval(p, x=a);

22

(2)

restart;#####################

a:=Pi:

p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi, 1/(-Pi+x), x = Pi, 22, 33)

(3)

eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero

 

restart;#####################

a:=Pi+ln(2):

p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi+ln(2), 1/(-Pi-ln(2)+x), x = Pi+ln(2), 22, 33)

(4)

eval(p, x=a);

22

(5)

restart;#####################

a:=Pi+1:

p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < Pi+1, 1/(-Pi-1+x), x = Pi+1, 22, 33)

(6)

eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero

 

restart;#####################

a:=gamma:

p:=piecewise(x<a, 1/(x-a), x=a, 22, 33);

p := piecewise(x < gamma, 1/(-gamma+x), x = gamma, 22, 33)

(7)

eval(p, x=a);

Error, (in eval/piecewise) numeric exception: division by zero

 

#######################

f:=x->piecewise(x<Pi, 1/(x-Pi), x=Pi, 22, 33);

f := proc (x) options operator, arrow; piecewise(x < Pi, 1/(x-Pi), x = Pi, 22, 33) end proc

(8)

f(Pi);

22

(9)

 


Download piecewise-strange.mw

how can save of resultes as matrix in file.dat?

 

I am trying to make a library, and therfore package that contains a bunch of objects that inherit from each other.

I understand how to create objects that inherit from one another and my code here works fine:

module ParentObject()
   option object;
end module;

module ChildObject()
   option object(ParentObject);
end module;

However when I put it all in a package with code below:

module Package()
   option package;
   export ParentObject, ChildObject;
   
   module ParentObject()
      option object;
   end module;

   module ChildObject()
      option object(ParentObject);
   end module;

end module;

I get the error "Error, argument of option object(ParentObject) refer to another object in module Package:-ChildObject".

Any sugguestions?

Near the top of the large loop at the bottom of the uploaded worksheet IntSect is copied to IntSectRoll.

IntSectRoll is then modified several times within the loop. However IntSect also changes content even though there are no commands within the loop to cause this.

To avoid this is the reason IntSect is recreated from previous data each time before it is copied.

Is this a bug in my worksheet or in Maple 2016?

Constant_Diameter.mw

The theory behind the worksheet is described, without attribution, in the book The Penguin Dictionary of Curious and Interesting Geometry by David G. Wells.

Does this theory have a name and a discoverer?

f(x)=sqrt(sin(x)); x over the intervall [0,T]

can anyone help me to find this integral ?

 

I might be doing something wrong since I expected Maple to be able to solve this. Could some Maple manage to make Maple solve the following beam PDE problem taken from a textbook?

 

This is what I tried.

restart;
pde:=diff(u(x,t),t$2)+diff(u(x,t),x$4)=0;
bc:=u(0,t)=-12*t^2,u(1,t)=1-12*t^2,D[1,1](u)(0,t)=0,D[1,1](u)(1,t)=12;
ic:=u(x,0)=x^4,D[2](u)(x,0)=0;
sol:=pdsolve({pde,ic,bc},u(x,t));

But Maple returns no solution.

I am using Maple 2017.3 on windows.

 

When I enter this code:

de3a := diff(x(t), t) = (x(t))(1-.5*x(t)-.5*y(t)); de3b := diff(y(t), t) = (y(t))(-.25+.5*x(t));
sys3 = {de3a, de3b};

window := x = -1 .. 3, y = -1 .. 3;
DEplot(sys3, [x(t), y(t)], t = 0 .. 14, window);

 

I get the error message "Error, (in DEtools/DEplot) system must have same number of dependent variables as DE's." What am I doing wrong? I'm just trying to create a plot on the phase plane.
 

 

Hi all, 

 

How could I be certain about the correctness of these answers? I am sure that the variation of the parameter, C1, must be monotonic; just in one dircetion... increasing or decreasing. As you could see from the last result in the first command, the data are false... However, by the second method, the answer is different from that of the first!!!? Both of them are derived by 'fsolve'
In the third way, the command dsolve, produced an array of resutls, C1 and Nu, and there is just one correct solution... It is confusing.

DeriveNu-T.mw

I am puzzled by the strange behaviour of the following exampleSectionaken directly from the Programming Guide section 8.6. When I copy the example from the help to a worksheet as follows, I get an error stating that module m does not evaluate to a module in the use statement. 

> m := module() export a, b; a := 2; b := 3; end module:
use m in a + b end use;

Error: `m` does not evaluateto a module.

However, after a restart, when I execute the two statements as separate statements (separate prompts), the module does evaluate properly.

My question is, what is the safe workaround in coding to avoid this situation.

I have attached the worksheet.moduleeval.mw

can you pls help with that

 

if 0 denotes the zero matrix,

then show that e^0 = I, the identity matrix 

A[k]:= x;
A:= table().

how to sort hashtable by key which is a list of matrix

after sort, is possible to group by key? and how?

I have two tensors, E_ and F_ below, that I believe should be equal. But they are not, and I cannot understand why. The problem does not appear in, say, Schwarschild spacetime, but it appears in Boyer-Lindquist spacetime, metric [5,29,1]; perhaps it appears only if the vierbein is nondiagonal?

The code: Loading the packages and the metric:

restart:
with(Physics):
with(Tetrads):
g_[[5,29,1]];   # The Boyer-Lindquist metric

Set up galilean and nongalilean Levi-Civita's, respectively, following the recipe given elsewhere:

Define(varepsilon[a,b,c,d] = Array((1..4)$4,rhs(LeviCivita[nonzero])),quiet):
Setup(levicivita = nongalilean):
# Checking that the Levi-Civita's are indeed different
varepsilon[1,2,3,4];   # The galilean case
LeviCivita[1,2,3,4];   # The nongalilean case

Define the two tensors E_ and F_, using mixed type Levi-Civita's for the latter:

Define(
   E_[~a,mu] = varepsilon[~a,~b,~c,~d]*LeviCivita[mu,nu,rho,sigma]*e_[b,~nu]*e_[c,~rho]*e_[d,~sigma],
   F_[~a,mu] = varepsilon[~a,b,c,d]*LeviCivita[mu,~nu,~rho,~sigma]*e_[~b,nu]*e_[~c,rho]*e_[~d,sigma]
,quiet):
E_[definition];
F_[definition];

Compare the two expressions, which should be equal, I believe.

expr := simplify(TensorArray(E_[~a,mu] - F_[~a,mu])) assuming a::real,theta > 0,theta < Pi;
eval(expr,{a = 1,m = 1,r = 2,theta = Pi/4});   # Just to make the difference completely obvious

[I have trouble copy-pasting the output from these two lines, so you will have to execute the worksheet provided below to see it.]

However, they are not equal. Why not?

Download worksheet: MixedTypeLeviCivitas.mw.

Hi all, I wish to solve in Maple 4 equations with 4 unknowns. I do exactly what is in the example, but Maple produces an error. Perhaps someone can see, where I make the mistake.

restart:
G1:=a*x^3 + b*x^2:
G2:=c*(x-1)^3 +d*(x-1)^2:
eq1:=subs(x=u, G1=G2):
eq2:=subs(x=u, diff(G2,x)-diff(G1,x)):
eq3:=subs(x=u, diff(G2,x$2)-diff(G1,x$2)):
eq4:=subs(x=u, diff(G2,x$3)-diff(G1,x$3)):
sol:=solve({eq1=0, eq2=0, eq3=0, eq4=1},{a,b,c,d});
Error, invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, algebraic, relation(algebraic), ({list, set})({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received {6*c-6*a = 1, 6*c*(u-1)+2*d-6*a*u-2*b = 0, 3*c*(u-1)^2+2*d*(u-1)-3*a*u^2-2*b*u = 0, (a*u^3+b*u^2 = c*(u-1)^3+d*(u-1)^2) = 0}

 

how do i solve the following expression in maple and how do i plot sigma wrt a?

sigma = 4*sigma[s](1/4-(int((BesselJ(1, y))^2/y(1+y(400*10^(-10)/a)^2+sqrt(1+y(400*10^(-10)/a)^2)), y = 0 .. 10^4)))

 

First 852 853 854 855 856 857 858 Last Page 854 of 2428