Items tagged with define

Feed

how will i go about solving this problem, i want to return somthing like this (this anwser is from another function that did not contain sin, and therefor did not gave me problems).

thx in advance
 

Hi

Hope a nice day for all

restart;

#  *%   define the product of between two operators, and q real number
a*%b = q*b*%a+1;

# First I would like to give a simple for

 a^n*%b;
# and                                    
a*%b^n;

them deduce a general for                                      

b^n*%a^k*%b^N*%a^K-q^(k*N-n*K)*b^N*%a^K*%b^n*%a^k;

 where n, k and k greater than 1 and  n geater than k

Simplification.mw

 

Thanks for your help


 


Hello

I have a subscripts error, or it seems to be an error.

As you can see on the picture, then I have defined the varible I__K, but when I need it again I get another result or It seems to be another result that looks like this I[K]. I use the esc buttom to recall the varible.

Are there anybody that has a solution to this? I have been looking at other treads, but there seems not to be a solution that works or maybe I'm looking the wrong places.

Regards

Heide

 

 

This one really has me baffled.

What the proc does is not important. This is just about as simple an example as I could write. Maple 2015 is complaining anytime I try to declare a local variable. The second example shows that the local declaration is needed - Maple even introduces it into the procedure that it defines.

restart;
test := proc(  )
local a;
a := 3
end proc;
Error, unexpected `local` declaration in procedure body
test := proc(  )
# local a;
a := 3
end proc;
Warning, `a` is implicitly declared local to procedure `test`
test := proc(x) local a; a := x end proc

Here's the version information for my current Maple.

interface( version );
Standard Worksheet Interface, Maple 2015.0, Windows 7, February 17 2015 Build ID 1022128

Can someone explain what is happening, and why I'm just now seeing this?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Hello,

I have a two variable function d(a,b) which i don't want to substitute for the result. How can I make this product distributive,e.g. d(a+b,c)=d(a,c)+d(b,c) with independece of the variables I introduce in the function?

Thank you for the help!

 

I am trying to use the Define() funtion for the tetrad form of the Ricci Tensor. I use the Setup() function to define the tetradmetric and the tetrad labels. However, the function continues do some strange things with the d_ . It should be just a simple sum over the repeated indices, but I am getting imaginary terms.

 

  restart; with(Physics); with(Tetrads)

0, "%1 is not a command in the %2 package", Tetrads, Physics

(1)

Physics:-Setup(coordinatesystems = {X}, spacetimeindices = greek, tetradindices = lowercaselatin, tetradmetric = Matrix([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], shape = symmetric), mathematicalnotation = true)

[coordinatesystems = {X}, mathematicalnotation = true, spacetimeindices = greek, tetradindices = lowercaselatin, tetradmetric = {(1, 2) = 1, (3, 4) = 1}]

(2)

Physics:-Define(GammaT[a, b, c], RicciT[b, c] = -%d_[c](GammaT[`~a`, b, a])+%d_[a](GammaT[`~a`, b, c])-Physics:-`*`(GammaT[`~m`, b, a], GammaT[`~a`, m, c])+Physics:-`*`(GammaT[`~m`, b, c], GammaT[`~a`, m, a])-Physics:-`*`(GammaT[`~a`, b, m], GammaT[`~m`, c, a]-GammaT[`~m`, a, c]))

{Physics:-Dgamma[mu], GammaT[a, b, c], Physics:-Psigma[mu], RicciT[b, c], Physics:-d_[mu], Physics:-Tetrads:-eta_[a, b], Physics:-g_[mu, nu], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-m_[mu], Physics:-Tetrads:-mb_[mu], Physics:-Tetrads:-n_[mu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(3)

RicciT[1, 2]

-%d_[2](GammaT[`~1`, 1, 1]+GammaT[`~2`, 1, 2]+GammaT[`~3`, 1, 3]+GammaT[`~4`, 1, 4])-GammaT[`~1`, 1, 3]*GammaT[`~3`, 2, 1]-GammaT[`~3`, 1, 3]*GammaT[`~3`, 2, 3]-GammaT[`~4`, 1, 3]*GammaT[`~3`, 2, 4]+GammaT[`~4`, 1, 2]*GammaT[`~1`, 4, 1]+GammaT[`~4`, 1, 2]*GammaT[`~3`, 4, 3]+GammaT[`~4`, 1, 2]*GammaT[`~4`, 4, 4]+GammaT[`~1`, 1, 2]*GammaT[`~3`, 1, 3]+GammaT[`~1`, 1, 2]*GammaT[`~4`, 1, 4]+GammaT[`~2`, 1, 2]*GammaT[`~1`, 2, 1]+GammaT[`~2`, 1, 2]*GammaT[`~3`, 2, 3]+GammaT[`~2`, 1, 2]*GammaT[`~4`, 2, 4]+GammaT[`~3`, 1, 2]*GammaT[`~1`, 3, 1]+GammaT[`~3`, 1, 2]*GammaT[`~3`, 3, 3]+GammaT[`~3`, 1, 2]*GammaT[`~4`, 3, 4]-GammaT[`~1`, 1, 4]*GammaT[`~4`, 2, 1]-GammaT[`~3`, 1, 4]*GammaT[`~4`, 2, 3]-GammaT[`~4`, 1, 4]*GammaT[`~4`, 2, 4]-GammaT[`~1`, 1, 1]*GammaT[`~1`, 2, 1]-GammaT[`~3`, 1, 1]*GammaT[`~1`, 2, 3]-GammaT[`~4`, 1, 1]*GammaT[`~1`, 2, 4]-GammaT[`~1`, 1, 2]*GammaT[`~2`, 2, 1]-GammaT[`~3`, 1, 2]*GammaT[`~2`, 2, 3]-GammaT[`~4`, 1, 2]*GammaT[`~2`, 2, 4]-(1/2)*2^(1/2)*%d_[3](GammaT[`~2`, 1, 2])+(1/2)*2^(1/2)*%d_[3](GammaT[`~1`, 1, 2])+GammaT[`~2`, 3, 2]*GammaT[`~3`, 1, 2]+GammaT[`~2`, 4, 2]*GammaT[`~4`, 1, 2]+GammaT[`~1`, 1, 1]*GammaT[`~1`, 1, 2]+GammaT[`~1`, 1, 2]*GammaT[`~2`, 1, 2]-GammaT[`~1`, 2, 2]*GammaT[`~2`, 1, 1]-GammaT[`~2`, 1, 3]*GammaT[`~3`, 2, 2]-GammaT[`~2`, 1, 4]*GammaT[`~4`, 2, 2]+((1/2)*I)*2^(1/2)*%d_[1](GammaT[`~4`, 1, 2])-((1/2)*I)*2^(1/2)*%d_[4](GammaT[`~4`, 1, 2])+((1/2)*I)*2^(1/2)*%d_[1](GammaT[`~3`, 1, 2])+((1/2)*I)*2^(1/2)*%d_[4](GammaT[`~3`, 1, 2])+((1/2)*I)*2^(1/2)*%d_[2](GammaT[`~2`, 1, 2])+((1/2)*I)*2^(1/2)*%d_[2](GammaT[`~1`, 1, 2])

(4)

 

``

 

Download Problem_with_Defined_Tetrad_Function.mw

 

restart; with(Physics); with(Tetrads)

0, "%1 is not a command in the %2 package", Tetrads, Physics

(1)

Physics:-Setup(coordinatesystems = {X}, mathematicalnotation = true)

[coordinatesystems = {X}, mathematicalnotation = true]

(2)

Physics:-Define(Ybar[a], Y[a], GammaT[a, b, c], RicciT[b, c] = %d_[c](GammaT[`~a`, b, a])-%d_[a](GammaT[`~a`, b, c])+Physics:-`*`(GammaT[`~m`, b, a], GammaT[`~a`, m, c])-Physics:-`*`(GammaT[`~m`, b, c], GammaT[`~a`, m, a])+Physics:-`*`(GammaT[`~a`, b, m], GammaT[`~m`, c, a]-GammaT[`~m`, a, c]), RiemannT[k, l, m, n] = %d_[k](GammaT[m, n, l])-%d_[l](GammaT[m, n, k])+Physics:-`*`(GammaT[`~a`, m, l], GammaT[a, n, k])-Physics:-`*`(GammaT[`~a`, m, k], GammaT[a, n, l])+Physics:-`*`(GammaT[m, n, a], GammaT[`~a`, k, l]-GammaT[`~a`, l, k]))

RicciT[1, 3]

%d_[3](GammaT[`~1`, 1, 1]+GammaT[`~2`, 1, 2]+GammaT[`~3`, 1, 3]+GammaT[`~4`, 1, 4])+GammaT[`~4`, 1, 2]*GammaT[`~2`, 3, 4]+GammaT[`~1`, 1, 3]*GammaT[`~3`, 3, 1]+GammaT[`~2`, 1, 3]*GammaT[`~3`, 3, 2]+GammaT[`~4`, 1, 3]*GammaT[`~3`, 3, 4]-GammaT[`~2`, 1, 3]*GammaT[`~1`, 2, 1]-GammaT[`~2`, 1, 3]*GammaT[`~2`, 2, 2]-GammaT[`~2`, 1, 3]*GammaT[`~4`, 2, 4]-GammaT[`~3`, 1, 3]*GammaT[`~1`, 3, 1]-GammaT[`~3`, 1, 3]*GammaT[`~2`, 3, 2]-GammaT[`~3`, 1, 3]*GammaT[`~4`, 3, 4]-GammaT[`~4`, 1, 3]*GammaT[`~1`, 4, 1]-GammaT[`~4`, 1, 3]*GammaT[`~2`, 4, 2]-GammaT[`~4`, 1, 3]*GammaT[`~4`, 4, 4]-GammaT[`~1`, 1, 3]*GammaT[`~2`, 1, 2]-GammaT[`~1`, 1, 3]*GammaT[`~4`, 1, 4]+GammaT[`~1`, 1, 4]*GammaT[`~4`, 3, 1]+GammaT[`~2`, 1, 4]*GammaT[`~4`, 3, 2]+GammaT[`~4`, 1, 4]*GammaT[`~4`, 3, 4]+GammaT[`~1`, 1, 1]*GammaT[`~1`, 3, 1]+GammaT[`~2`, 1, 1]*GammaT[`~1`, 3, 2]+GammaT[`~4`, 1, 1]*GammaT[`~1`, 3, 4]+GammaT[`~1`, 1, 2]*GammaT[`~2`, 3, 1]+GammaT[`~2`, 1, 2]*GammaT[`~2`, 3, 2]+GammaT[`~1`, 3, 3]*GammaT[`~3`, 1, 1]+GammaT[`~2`, 3, 3]*GammaT[`~3`, 1, 2]+GammaT[`~3`, 1, 4]*GammaT[`~4`, 3, 3]-GammaT[`~3`, 4, 3]*GammaT[`~4`, 1, 3]-GammaT[`~1`, 1, 1]*GammaT[`~1`, 1, 3]-GammaT[`~1`, 1, 3]*GammaT[`~3`, 1, 3]-GammaT[`~2`, 1, 3]*GammaT[`~3`, 2, 3]-%d_[4](GammaT[`~4`, 1, 3])+%d_[1](GammaT[`~1`, 1, 3])+%d_[3](GammaT[`~3`, 1, 3])+%d_[2](GammaT[`~2`, 1, 3])

(3)

for a to 4 do for b to 4 do RicciT[a, b] end do end do

Error, (in index/PhysicsTensor) expected summation indices of type symbol, received: 1

 

 

Now, if I type the RicciT from (3) it displays the same result. However,......

 

RicciT[1, 3]

%d_[3](GammaT[`~1`, 1, 1]+GammaT[`~2`, 1, 2]+GammaT[`~3`, 1, 3]+GammaT[`~4`, 1, 4])+GammaT[`~4`, 1, 2]*GammaT[`~2`, 3, 4]+GammaT[`~1`, 1, 3]*GammaT[`~3`, 3, 1]+GammaT[`~2`, 1, 3]*GammaT[`~3`, 3, 2]+GammaT[`~4`, 1, 3]*GammaT[`~3`, 3, 4]-GammaT[`~2`, 1, 3]*GammaT[`~1`, 2, 1]-GammaT[`~2`, 1, 3]*GammaT[`~2`, 2, 2]-GammaT[`~2`, 1, 3]*GammaT[`~4`, 2, 4]-GammaT[`~3`, 1, 3]*GammaT[`~1`, 3, 1]-GammaT[`~3`, 1, 3]*GammaT[`~2`, 3, 2]-GammaT[`~3`, 1, 3]*GammaT[`~4`, 3, 4]-GammaT[`~4`, 1, 3]*GammaT[`~1`, 4, 1]-GammaT[`~4`, 1, 3]*GammaT[`~2`, 4, 2]-GammaT[`~4`, 1, 3]*GammaT[`~4`, 4, 4]-GammaT[`~1`, 1, 3]*GammaT[`~2`, 1, 2]-GammaT[`~1`, 1, 3]*GammaT[`~4`, 1, 4]+GammaT[`~1`, 1, 4]*GammaT[`~4`, 3, 1]+GammaT[`~2`, 1, 4]*GammaT[`~4`, 3, 2]+GammaT[`~4`, 1, 4]*GammaT[`~4`, 3, 4]+GammaT[`~1`, 1, 1]*GammaT[`~1`, 3, 1]+GammaT[`~2`, 1, 1]*GammaT[`~1`, 3, 2]+GammaT[`~4`, 1, 1]*GammaT[`~1`, 3, 4]+GammaT[`~1`, 1, 2]*GammaT[`~2`, 3, 1]+GammaT[`~2`, 1, 2]*GammaT[`~2`, 3, 2]+GammaT[`~1`, 3, 3]*GammaT[`~3`, 1, 1]+GammaT[`~2`, 3, 3]*GammaT[`~3`, 1, 2]+GammaT[`~3`, 1, 4]*GammaT[`~4`, 3, 3]-GammaT[`~3`, 4, 3]*GammaT[`~4`, 1, 3]-GammaT[`~1`, 1, 1]*GammaT[`~1`, 1, 3]-GammaT[`~1`, 1, 3]*GammaT[`~3`, 1, 3]-GammaT[`~2`, 1, 3]*GammaT[`~3`, 2, 3]-%d_[4](GammaT[`~4`, 1, 3])+%d_[1](GammaT[`~1`, 1, 3])+%d_[3](GammaT[`~3`, 1, 3])+%d_[2](GammaT[`~2`, 1, 3])

(4)

 

If I type a different RicciT, then ...

 

RicciT[2, 3]

Error, (in index/PhysicsTensor) expected summation indices of type symbol, received: 1

 

 

The for loop is changing the tetrad definition of RicciT.

 

NULL

 

Download Question_about_tetrads_in_for_loop.mw

I know how we can add a member to a mathematical set ,for example :

C := NULL;

C := C, V, B, X;

print(C)

V, B, X

but, my problem is that how we can subtract a member from the defined set ?

 

 

Thanks,

 

Hello, i got the following problem. I have a function, say u(h,e) whith multiple exponents ((u(h,e))^(1/a))^a. As long as Maple does not know that u(h,e) is positiv it won't make the simplification and return u(h,e) as expected. From my view i have two possibilites to solve this problem:

1) Define u(h,e) to be positive. Sounds intuitive, but i didn't manage to find the right definition

2) Give maple the function e.g. u:=e+h^2 and simplify the epression in uneval quotes with assumption positive for e and h.

Whereas I have solution 2, the problem is that i would need excessive amounts of uneval quotes '' at the start of my worksheet, not to run out of them.

 

I definitly need my epressions in unevaluated forms and would be happy to hear any ideas.

Greetings, Fabian

 

Hello,

I'm trying to define a matrix that will have all the possible game results in a 9 team competition in one round. The results are a column in the form [game 1 home team, game 1 away team, game 2 home team, ... , game 9 away team]

This should give me a matrix with 18 rows, and 512 columns, where each column is a possible game result.

In essense, to continue the pattern of this matrix on for all 512 columns.

I've fiddled with for statements, but it ends up getting very messy given the number of nests that are required.

Thoughts? Any help would be much appreciated,

Thanks, Alex, Australia.

 

 

 

 

 

 

Let a be som expression like
a:=t^2

Now how do I define a function using a.

f:=t->a
doesnt work

Hey!

I have this MATLAB script, but as I work in Maple, I'll need to translate it to Maple. 
I know how to define symbols and functions, but I don't know which Maple commands to use, of if it needs to be done in another way, so the problem is translating from " dZ = [dx; dy; ax; ay; dm];" and down.

Any help would truly be greatly appreciated! Thank you!  



This is the script:

function dZ = meteor_step(~, Z)

  P = 1.2; % initial atmospheric pressure
  H = 1.39E-4; % scale height of atm pressure
  E = 8.11131859E6; % evaporation energy
  D = 1; % drag constant
  G = 9.814; % acceleration due to gravity
  PM = 3.3E3; % density of the meteor
  
  S = 3.986E14; % standard gravitational parameter of Earth (G*M)
  R = 6.3674447E6; % radius of the Earth (meters)

  x = Z(1);  
  y = Z(2);
  dx = Z(3);
  dy = Z(4);
  m = Z(5);
  
  atm = P*exp(-y*H);

  v = sqrt(dx^2+dy^2);

  area = pi * ( (3*m)/(4*PM) )^(2/3);

  dist = sqrt(x^2+y^2);
  Gv = -9.8;

  accel = -(D*atm*area)/m*v;
  ax = accel * dx;
  ay = accel * dy + Gv;
  

  dm = -(atm*v^3*area)/(2*E);
  
  dZ = [dx; dy; ax; ay; dm];
  
end

 

 

 

 

[t, R] = ode45(@meteor_step, [0 250], [0, 100000, 100, -300, 25]);

x = R(:,1);
y = R(:,2);

dx = R(:,3);
dy = R(:,4);

v = (dx.^2+dy.^2).^(1/2);

m = R(:,5);

figure(1);
plot(t, y);
  title('Meteor Kinematics: Height vs Time');
  xlabel('Time elapsed (s)');
  ylabel('Height (m)');

figure(2);
plot(x, y);
  title('Meteor Kinematics: Horizontal vs Vertical Position');
  xlabel('Horizontal (m)');
  ylabel('Vertical (m)');

figure(3);
plot(t, v);
  title('Meteor Kinematics: Speed vs Time');
  xlabel('Time elapsed (s)');
  ylabel('Absolute speed (m/s)');

figure(4);
plot(t, m);
  title('Meteor Kinematics: Mass vs Time');
  xlabel('Time elapsed (s)');
  ylabel('Mass (kg)');

  
figure(5);
plot(t, dy);
  title('Vertical Velocity vs Time');
  xlabel('Time elapsed (s)');
  ylabel('Vertical velocity (m/s)');

temp = abs(y - 52900);
[~, index] = min(temp);
  
t(index)
dx(index)/1000
dy(index)/1000

Hi every Body?

I will define the function f(t) in maple,how?

f(t)=1-t for 0<t<10 and t for t>10

Hi everyone,

I have a question regarding the derivation of tensors/matrices.
Let's assume for simplicity, that I have a vector (6x1) s and a matrix A (6x6)defining Transpose(s)*Inverse(A)*s. From this function I want to calculate the derivative w.r.t. s. My approach would be

restartwith(Physics):
with(LinearAlgebra):
Define(s,A)

Diff(
Transpose(s)*Inverse(A)*s, s)

As a result I get

though I'd rather expect something like Inverse(A)*s + Transpose(s)*Inverse(A)

Now as I'm pretty new to Maple, I can imagine that my approach is wrong, but I don't know any better and can't seem to get any information out of the help documents.

Thanks in advance for any of your suggestions!

1 2 3 4 Page 1 of 4