tomleslie

13876 Reputation

20 Badges

15 years, 164 days

MaplePrimes Activity


These are answers submitted by tomleslie

I can solve the reverse problem, with a couple of extra assumptions - this may (or may not!) be of some help


 

  restart;
  f := beta/(2*sigma*GAMMA(1/beta))*exp(-(abs(x-mu)/sigma)^beta);
  assume(mu::real, beta > 0, sigma > 0);
  F := int(f, x=-infinity..s);

(1/2)*beta*exp(-(abs(-x+mu)/sigma)^beta)/(sigma*GAMMA(1/beta))

 

int((1/2)*beta*exp(-(abs(-x+mu)/sigma)^beta)/(sigma*GAMMA(1/beta)), x = -infinity .. s)

(1)

assume(mu>0, x>0): # unjustified assumptions
F := 1/2+signum(x-mu)/(2*GAMMA(1/beta))*(GAMMA(1/beta)-GAMMA(1/beta, abs((x-mu)/sigma)^beta));
diff(F, x);
ans:=simplify(%, symbolic);
is(ans=f);

1/2-(1/2)*signum(-x~~+mu~~~)*(GAMMA(1/beta)-GAMMA(1/beta, (abs(-x~~+mu~~~)/sigma)^beta))/GAMMA(1/beta)

 

-(1/2)*signum(1, -x~~+mu~~~)*(GAMMA(1/beta)-GAMMA(1/beta, (abs(-x~~+mu~~~)/sigma)^beta))/GAMMA(1/beta)+(1/2)*signum(-x~~+mu~~~)^2*(abs(-x~~+mu~~~)/sigma)^beta*beta*((abs(-x~~+mu~~~)/sigma)^beta)^(1/beta-1)*exp(-(abs(-x~~+mu~~~)/sigma)^beta)/(GAMMA(1/beta)*abs(-x~~+mu~~~))

 

(1/2)*beta*exp(-abs(-x~~+mu~~~)^beta*sigma^(-beta))/(sigma*GAMMA(1/beta))

 

true

(2)

 


 

Download manip.mw

  1. in the definition of your pde, you use psi(x), but 'psi' is an expression, not a function - so I have corrected this.
  2. in the definition of psi, two conditions apply when x=l/2, since both evaluate to the same thing this probably isn't too important, but you really shouldn't do this.
  3. when solving the wave equation it is always a good idea to provide the pdsolve() command with the 'hint=TWS' option
  4. I have inserted the assumption that l>0. Without this assumption, Maple provides three solutions, one for l<0, one for l=0, and one for l>0. The first two of these are not very interesting/useful

The attached returns an explicit solution in the form which you want (and it is simpler!)

(I'm not sure why this website is displaying Maple output in such an untidy way! I think something on this site is "broken")

  restart;
  assume( l>0 ):
  interface(showassumed=0):
# set the PDE, ic(initial conds) and bc (boundary conds)

  pde := diff(u(x, t), t, t) = a^2*diff(u(x, t), x, x);
  ic := u(x, 0) = 0, D[2](u)(x, 0) = psi;
  bc := u(0, t) = 0, u(l, t) = 0;
#
# OP's original definition of psi had a typo
#
  psi := piecewise( 0 <= x  and x <= l/2, x,
                    l/2 < x and x <= l, l - x
                  );

  res := pdsolve([pde,ic,bc], HINT = TWS);

pde := diff(u(x, t), t, t) = a^2*(diff(u(x, t), x, x))

 

ic := u(x, 0) = 0, (D[2](u))(x, 0) = psi

 

bc := u(0, t) = 0, u(l, t) = 0

 

piecewise(0 <= x and x <= (1/2)*l, x, (1/2)*l < x and x <= l, l-x)

 

u(x, t) = Sum(4*l^2*sin((1/2)*n*Pi)*sin(n*Pi*x/l)*sin(a*n*Pi*t/l)/(Pi^3*n^3*a), n = 1 .. infinity)

(1)

 

Download waveEq.mw

  1. The command is dsolve() not desolve()
  2. I don't think dsolve() handles expressions with units so I converted you initial condition to be unit-ffree
  3. No value is specified for Pb so I (arbitrarily) chose 1.0

and everything in the attached now seems to "work"

restart

NULL

with(Units); with(ThermophysicalData)

Automatically loading the Units[Simple] subpackage
 

 

Variables

 

Physical parameters

 

d := 0.38e-1*Unit('cm')

0.38e-1*Units:-Unit(cm)

(1.1.1)

phi := .620

.620

(1.1.2)

`&varphi;` := .789

.789

(1.1.3)

Void__f := .41241

.41241

(1.1.4)

Bloodpath := 10.2*Unit('cm')

10.2*Units:-Unit(cm)

(1.1.5)

A__f := 21.55*Unit('cm'^2)

21.55*Units:-Unit(cm^2)

(1.1.6)

NULL

Variables

 

P__baro := 765*Unit('mmHg')

765*Units:-Unit(mmHg)

(1.2.1)

FiO2 := .45

.45

(1.2.2)

Q__blood := 4990*Unit('mL'/'min')

4990*Units:-Unit(mL/min)

(1.2.3)

T__art := 32.5*Unit('Celsius')

32.5*Units:-Unit(`&deg;C`)

(1.2.4)

Hgb := 101*Unit('g'/'L')

101*Units:-Unit(g/L)

(1.2.5)

Hct := .301

.301

(1.2.6)

PvO2 := 45.2*Unit('mmHg')

45.2*Units:-Unit(mmHg)

(1.2.7)

NULLNULL

NULL

Calculate water vapor

 

The formula used below comes from Huang 2018 "A Simple Accurate Formula for Calculating Saturation Vapor Pressure of Water and Ice"

 

T__b := convert(T__art, unit_free)

32.5

(2.1)

"`P__s`(T):=(exp(34.494-4924.99/((T+237.1))))/((T+105)^(1.57))"

proc (T) options operator, arrow, function_assign; Units:-Simple:-`*`(Units:-Simple:-exp(Units:-Simple:-`+`(34.494, Units:-Simple:-`-`(Units:-Simple:-`/`(4924.99, Units:-Simple:-`+`(T, 237.1))))), Units:-Simple:-`/`(Units:-Simple:-`^`(Units:-Simple:-`+`(T, 105), 1.57))) end proc

(2.2)

P__s(T__b)*Unit('Pa')

4895.850995*Units:-Unit(Pa)

(2.3)

P__baroCor := (P__baro-P__s(T__b)*Unit('Pa'))*FiO2

43693.09236*Units:-Unit(Pa)

(2.4)

Temperature conversion PO2

 

pH__a := 7.37

7.37

(3.1)

pH__v := 7.342

7.342

(3.2)

n := 2.7

2.7

(3.3)

T__bloodgasMachine := 37*Unit('Celsius')

37*Units:-Unit(`&deg;C`)

(3.4)

"P_50(pH):=(26.6*10^((0.48*(7.4-pH))))"

proc (pH) options operator, arrow, function_assign; Units:-Simple:-`*`(26.6, Units:-Simple:-`^`(10, Units:-Simple:-`*`(.48, Units:-Simple:-`+`(7.4, Units:-Simple:-`-`(pH))))) end proc

(3.5)

"P50(pH,T):=(P_50(pH)*10^(-(0.024*(37-convert(T,unit_free)))))&lobrk;mmHg&robrk;"

proc (pH, T) options operator, arrow, function_assign; Units:-Simple:-`*`(Units:-Simple:-`*`(P_50(pH), Units:-Simple:-`^`(10, Units:-Simple:-`-`(Units:-Simple:-`*`(0.24e-1, Units:-Simple:-`+`(37, Units:-Simple:-`-`(convert(T, unit_free))))))), Units:-Unit('mmHg')) end proc

(3.6)

P50__a := P50(pH__a, T__bloodgasMachine)

27.49676718*Units:-Unit(mmHg)

(3.7)

P50__v := P50(pH__v, T__bloodgasMachine)

28.36100632*Units:-Unit(mmHg)

(3.8)

"S(PO2,P50):=(((PO2/(P50))^(n))/(1+(PO2/(P50))^(n)))"

proc (PO2, P50) options operator, arrow, function_assign; Units:-Simple:-`*`(Units:-Simple:-`^`(Units:-Simple:-`*`(PO2, Units:-Simple:-`/`(P50)), n), Units:-Simple:-`/`(Units:-Simple:-`+`(1, Units:-Simple:-`^`(Units:-Simple:-`*`(PO2, Units:-Simple:-`/`(P50)), n)))) end proc

(3.9)

S__v := S(PvO2, P50__v)

.7787541952

(3.10)

P50__ac := P50(pH__a, T__art)

21.44280699*Units:-Unit(mmHg)

(3.11)

P50__vc := P50(pH__v, T__art)

22.11676669*Units:-Unit(mmHg)

(3.12)

P50__c := (P50__ac+P50__vc)*(1/2)

21.77978684*Units:-Unit(mmHg)

(3.13)

"`PO2__c`(S,P50):=(exp((ln((-S)/((S-1))))/(n))*P50)"

proc (S, P50) options operator, arrow, function_assign; Units:-Simple:-`*`(Units:-Simple:-exp(Units:-Simple:-`*`(Units:-Simple:-ln(Units:-Simple:-`*`(Units:-Simple:-`-`(S), Units:-Simple:-`/`(Units:-Simple:-`+`(S, -1)))), Units:-Simple:-`/`(n))), P50) end proc

(3.14)

PvO2__c := PO2__c(S__v, P50__vc)

35.24832098*Units:-Unit(mmHg)

(3.15)

S__vc := S(PvO2__c, P50__vc)

.7787541952

(3.16)

NULL

Calculation Mass Transfer

 

NULL

Solubility

 

k__c := 4.658*10^(-5)*1.01^(37-T__b)*Unit('mL'/'mmHg'*(1/'mL'))

0.4871308857e-4*Units:-Unit(1/mmHg)

(4.1.1)

k__p := 2.855*10^(-5)*1.01^(37-T__b)*Unit('mL'/'mmHg'*(1/'mL'))

0.2985742118e-4*Units:-Unit(1/mmHg)

(4.1.2)

k := k__c*Hct+k__p*(1-Hct)

0.3553297706e-4*Units:-Unit(1/mmHg)

(4.1.3)

"lambda(`PvO2__c`):=(1.34/(convert(k,unit_free))*convert(Hgb,unit_free) *(n/(convert(`P50__c`,unit_free)))*((convert(`PvO2__c`,unit_free))/(convert(`P50__c`,unit_free)))^((n-1))*(1/((1+((convert(`PvO2__c`, unit_free))/(convert(`P50__c`,unit_free)))^(n))^(2))))/(1000)"

proc (PvO2__c) options operator, arrow, function_assign; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`/`(1.34, convert(k, unit_free)), convert(Hgb, unit_free)), Units:-Simple:-`*`(n, Units:-Simple:-`/`(convert(P50__c, unit_free)))), Units:-Simple:-`^`(Units:-Simple:-`*`(convert(PvO2__c, unit_free), Units:-Simple:-`/`(convert(P50__c, unit_free))), Units:-Simple:-`+`(n, -1))), Units:-Simple:-`/`(Units:-Simple:-`^`(Units:-Simple:-`+`(1, Units:-Simple:-`^`(Units:-Simple:-`*`(convert(PvO2__c, unit_free), Units:-Simple:-`/`(convert(P50__c, unit_free))), n)), 2))), Units:-Simple:-`/`(1000)) end proc

(4.1.4)

lambda(PvO2__c)

49.10554938

(4.1.5)

NULL

Diffusivity

 

NULL

D__c := .76*10^(-5)*1.025^(T__b-25)

0.9146239783e-5

(4.2.1)

D__p := 1.62*10^(-5)*1.025^(T__b-25)

0.1949593217e-4

(4.2.2)

N := k__c/k__p

1.631523643

(4.2.3)

beta := (1/3)*(2/(1+(N*D__c/D__p-1)*(.283*(1/2)))+1/(1+(N*D__c/D__p-1)*(1-.283)))*(N*D__c/D__p-1)

-.2557766615

(4.2.4)

`&varkappa;` := -(N*D__c/D__p-1-N*D__c*beta/D__p)/(N*D__c/D__p-1-beta)

1.832656150

(4.2.5)

R := Hct*(N*D__c/D__p-1)/(N*D__c/D__p+`&varkappa;`)

-0.2717900481e-1

(4.2.6)

D__m := D__p*k__p*(R*`&varkappa;`+1)*Unit('cm'^2/'s')/(k*(1-R))

0.1515406448e-4*Units:-Unit(cm^2/s)

(4.2.7)

Deff := D__m/(1+lambda(PvO2__c))

0.3024428366e-6*Units:-Unit(cm^2/s)

(4.2.8)

NULL

Density

 

`&rho;__c` := 1.090*Unit('kg'/'L')

1.090*Units:-Unit(kg/L)

(4.3.1)

`&rho;__p` := 1.035*Unit('kg'/'L')

1.035*Units:-Unit(kg/L)

(4.3.2)

rho := `&rho;__c`*Hct+`&rho;__p`*(1-Hct)

1.051555*Units:-Unit(kg/L)

(4.3.3)

``

Viscosity

 

T__visc := convert(T__b*Unit(Celsius, preserve), temperature, K)

305.6500000*Units:-Unit(K)

(4.4.1)

`&eta;__p` := exp(-5.64+1800/convert(T__visc, unit_free))*Unit('mPa'*'s')

1.282855980*Units:-Unit(mPa*s)

(4.4.2)

``

eta := `&eta;__p`*exp(2.31*Hct)

2.571267137*Units:-Unit(mPa*s)

(4.4.3)

nu := eta/rho

0.2445204613e-5*Units:-Unit(m^2/s)

(4.4.4)

````

Dimensionless Numbers

 

N__re := Q__blood*d/((1-Void__f)*A__f*nu)

10.20695064

(4.5.1)

N__sc := eta/(rho*D__m)

1613.563554

(4.5.2)

````

Differential Equation

 

Convert flow from mL/min to mL/s

Q__bc := convert(Q__blood, 'units', 'mL'/'s')

(499/6)*Units:-Unit(mL/s)

(4.6.1)

Convert η from mPa*s to g/cm*s

`&eta;__c` := convert(eta, 'units', 'g'/('cm'*'s'))

0.2571267137e-1*Units:-Unit(g/(cm*s))

(4.6.2)

a := 4*((1-Void__f)/convert(d, unit_free))^(1+`&varphi;`)*(convert(A__f, unit_free)*convert(`&eta;__c`, unit_free)/(convert(Q__bc, unit_free)*convert(rho, unit_free)))^`&varphi;`*phi/(Void__f*(nu/D__m)^(2/3))

.1081111001

(4.6.3)

ODE := diff(P(x), x) = a*(P__b-P(x))/(1+lambda(P(x))^(2/3))

diff(P(x), x) = .1081111001*(P__b-P(x))/(1+1.846187058*(P(x)^1.7/(1+0.2439243816e-3*P(x)^2.7)^2)^(2/3))

(4.6.4)

IC := P(0) = convert(PvO2__c, unit_free)

P(0) = 35.24832098

(4.6.5)

sol := dsolve(eval({IC, ODE}, P__b = 1.0), numeric); plots:-odeplot(sol, [x, P(x)], x = 0 .. 100)

 

NULL

NULL

Download odeProb.mw

Lists are not mutable containers so it is actually very inefficient to add elements one-by-one. Each time you add a new element you are actually creating a whole new list. As a purely practical matter, you probably won't notice this inefficiency until your list get really long. But it is a bad habit to get into!

On the other hand Arrays are mutable and can be grown (in-place) as desired by using "round-bracket" indexing. If necessary the end result can be converted to a list. See the attached

  restart;
  A:=Array():
  for j from 1 by 1 to 100 do
      A(j):=j^2;
      if   A[j]> 5000
      then break
      fi
  od:
  numelems(A);
  L:=convert(A, list);

71

 

[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 3844, 3969, 4096, 4225, 4356, 4489, 4624, 4761, 4900, 5041]

(1)

 


 

Download arrList.mw

 

of whihc the attached show only one.

This worksheet shows that

  1. if m=3, the roots of the expression are [3, 9]
  2. if m=-2, the roots of the expression are [-2, 4]

  restart;
#
# Assume the OP only wants real solutions
#
  with(RealDomain):
#
# Insert OP's expression and solve for 'x'
# in terms of 'm'
#
  expr:= x^2+2*m*x-6*x=m^3;
  sol:=  [ solve(expr, x) ];
#
# Find all values of 'm' in the above solutions
# where one root is the square of the other root
#
  mvals:=  { solve( sol[1]=sol[2]^2, m),
             solve( sol[2]=sol[1]^2, m)
           };
#
# Find the roots of the original expression for
# the values obtained for 'm' above
#
  rts1:=solve(eval(expr, m=mvals[1]), x);
  rts2:=solve(eval(expr, m=mvals[2]), x);
  

2*m*x+x^2-6*x = m^3

 

[-m+3+(m^3+m^2-6*m+9)^(1/2), -m+3-(m^3+m^2-6*m+9)^(1/2)]

 

{-3, 2}

 

3, 9

 

-2, 4

(1)

 

Download sqRoots.mw

I would have expected your code to "work", since (in general) a list of linestyles is an allowed plot option - however in the case of DEPlot(), as you have observed, this cuases an error. This may be a bug(ette).

One can "work around" the issue by creating each plot individually and then displaying them together, as in the attached.

On your second issue, the 'axes' option accepts a single value - so you are stuck with either "boxed" or "normal". It is possible using a combination of textplot() and line plots to create a "plot" which "looks" like axes. This could be included in the display() command in the attached.

Note that although "gridlines" appear on the plot when rendered on this site, they do not occur in the worksheet (honest!)

  restart;
  with(VectorCalculus):
  with(LinearAlgebra):
  with(DEtools):
  F0 := 0:
  zeta := .25:
  w := 1:
  Omega := 1:
  m := 1:

  ode1 := diff(x(t), t) = y(t):
  ode2 := diff(y(t), t) = F0*cos(Omega*t)/m-2*zeta*w*y(t)-w^2*x(t):
  
  inits:=[ [x(0) = 0, y(0) = 50],
           [x(0) = 9, y(0) = 25],
           [x(0) = 85, y(0) = 20],
           [x(0) = .25, y(0) = .5],
           [x(0) = 7, y(0) = 5]
         ]:
  ls:= [dash, dashdot, dot, longdash, spacedash]:
  cols:=  [red, green, black, navy, maroon]:
  p1:= [ seq
         (  DEplot
            ( [ode1, ode2],
              [x(t), y(t)],
              t = 0 .. 10,
              x = -100 .. 100,
              y = -100 .. 100,
              [ inits[k] ],
              linestyle=ls[k],
              linecolor =cols[k],
              thickness = 5,
              axes = normal,
              labels = [x(t), y(t)],
              arrows = small,
              color=cyan,
              stepsize = 0.1e-1,
              axes=boxed
           ),
           k=1..5
        )
      ]:
  plots:-display(p1);
           
   

 

 


Download dplt.mw

You state

Maple code available to solve the heat  two dimensional heat equations using Rk4 

Invoking RK4 mean that you want to solve this numerically rather than analytically - correct? However as the help page for pdsolve/numeric states (my emphasis)

The pdsolve(PDEsys,conditions,numeric,vars,options) command returns a module that can be used to compute numerical solutions for time-based PDE systems over a fixed finite 1-space interval.

So a numerical solation over 2D-space is not (generally?) possible

It is however possible to generate an analytic solution over 2D space (see the attached). How explicit this can be made depends very much on the initial/boundary conditins of your problem, since it depends on 5 initial/boundary condiotns and 2 variable separation constants

restart;
PDE1 := diff(u(x, y, t), t)-diff(u(x, y, t), x$2)-diff(u(x, y, t), y$2) = 0;
Sol := pdsolve(PDE1, explicit);

diff(u(x, y, t), t)-(diff(diff(u(x, y, t), x), x))-(diff(diff(u(x, y, t), y), y)) = 0

 

u(x, y, t) = exp(_c[1]^(1/2)*x)*exp(_c[2]^(1/2)*y)*_C5*exp(t*_c[1])*exp(t*_c[2])*_C1*_C3+exp(_c[2]^(1/2)*y)*_C5*exp(t*_c[1])*exp(t*_c[2])*_C2*_C3/exp(_c[1]^(1/2)*x)+exp(_c[1]^(1/2)*x)*_C5*exp(t*_c[1])*exp(t*_c[2])*_C1*_C4/exp(_c[2]^(1/2)*y)+_C5*exp(t*_c[1])*exp(t*_c[2])*_C2*_C4/(exp(_c[1]^(1/2)*x)*exp(_c[2]^(1/2)*y))

(1)

 

Download heat.mw

 

ie

restart;
solve( { 0 = a_2*cos(7.5*b_2) + a_2, 250 = Pi*int((a_2*cos(b_2*x) + a_2)^2, x = 0 .. 7.5),
         750 = Pi*int((a_1*x^2 + b_1*x + sqrt(d_1*x) + 7.5)^2 - (a_2*cos(b_2*x) + a_2)^2, x = 0 .. x_2),
         2.5 = a_1*20^2 + 20*b_1 + sqrt(20*d_1) + 7.5,
         2*a_1*x_2 + b_1 + sqrt(d_1)/(2*sqrt(x_2)) = 0,
         (2*a_1)*20 + b_1 + sqrt(d_1)/(2*sqrt(20)) = 0
      },
      {a_1, a_2, b_1, b_2, d_1, x_2}
    )

It should be fairly obvious that

  1. the first three equations in the above do not contain x_2
  2. the last wo equations are identical - when x_2=20

The error message occurs because the integrand evaluates to a complex numbers for certain values of the integration variable 'x'. Some integration methods will handle complex integrands, but some won't

I'm not sure how meaningful it is, but if no integration method is specified, then Maple returns

A3 := Float(infinity) + 0.2486067977*I

see the attached

restart;
W := -16*(x - 1/2)*x*(t + 2*w)*(ln((m^2 + w*x*(-1 + x))/m^2)*ln(-1/(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)) + ln(-x*w^2*(-1 + x))*ln((x^2 - x)*w + m^2) + ln(1/m^2)*ln((t + w)*(-1 + x)) + ln(-1/(x*w))*ln(m^2) + dilog(x*w^2*(-1 + x)/(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)) - dilog(x*w*(-1 + x)*(t + w)/(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)))/t^3 + 8*(x - 1/2)*((t + w)*x - t/2)*(-t*(w*x^2 + m^2 - w*x)*(t + w)*ln((x^2 - x)*w + m^2) + w*(x*w*(-1 + x)*(t + w)*ln((t + w)/w) + m^2*t*ln(m^2)))*(2*w*x + t)/(w*(t + w)*(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)*t^3*x) + (16*x^2 - 8*x)/(t*w*(-1 + x)) + (2*t*x + 2*w*x - t - 2*w)*(2*w*x + t - 2*w)*(1 - 2*x)*ln((t*x + (-1 + x)*w)/((-1 + x)*w))/(((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)*t^2) + (-1 + 2*x)*(2*m^2 + w*x - w)*(2*w*x^2 + 2*m^2 - 3*w*x + w)*ln(m^2/(m^2 + w*x*(-1 + x)))/(w^2*(-1 + x)^2*((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)) + (-1 + 2*x)*(2*m^2 + w*x - w)*(2*w*x^2 + 2*m^2 - 3*w*x + w)*ln(m^2/(m^2 + w*x*(-1 + x)))/(w^2*(-1 + x)^2*(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)) + (2*w*x + t)*((t + w)*x - t/2)*(x - 1/2)*ln(w^4/(t + w)^4)/(t^2*(w*(t + w)*x^2 - w*(t + w)*x + m^2*t)) - 8*(x - 1/2)*((-2 + 2*x)*w + t)*((-1 + x)*w + (x - 1/2)*t)*((t*x + (-1 + x)*w)*w^2*(-1 + x)^2*ln((t*x + (-1 + x)*w)/((-1 + x)*w)) + (-(t*x + (-1 + x)*w)*((x^2 - x)*w + m^2)*ln((x^2 - x)*w + m^2) + ln(m^2)*m^2*w*(-1 + x))*t)/((t*x + (-1 + x)*w)*w*(-1 + x)*t^3*((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)) + 16*(x - 1/2)*(ln(1/m^2)*ln((t*x + (-1 + x)*w)*(-1 + x)*w/((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)) + ln((x^2 - x)*w + m^2)*ln(1/((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)) + ln((-1 + x)^2*w^2)*ln((x^2 - x)*w + m^2) - dilog((t*x + (-1 + x)*w)*(-1 + x)*w/((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)) + dilog((-1 + x)^2*w^2/((-1 + x)^2*w^2 + w*t*x*(-1 + x) + m^2*t)))*(t*x + 2*(-1 + x)*w)/t^3:

f3 := (mm, ss, tt, ww) -> Int(eval(W, [s = ss, t = tt, w = ww, m = mm]), x = 0 .. 1):
A3 := evalf(f3(1, 3, -2, -1));

Float(infinity)+.2486067977*I

(1)

 


Download compInt.mw

 

for the basic equation in kinetics relating initial velocity, acceleration, time, and final velociy - in other words v=u+a*t, the simplest way is probably that shown in the attached

  restart;
  with(Units):
#
# The most basic equation in kinetics is probably
#
#     v=u*a*t
#
# So the initial velocity 'u' with a unit is
#
  initVel:=u*Unit(m/s);
#
# The acceleration with a unit is
#
  accel:=a*Unit(m/s/s);
#
# the time for whihc the acceleration is applied
# with  unit is
#
  tim:= t*Unit(s);
#
# So what is the final velocity (with units)
#
  finalVel:=initVel+accel*tim;
#
# And with numeric values......
#
  eval( finalVel, [u=2, a=3, t=4]);

Automatically loading the Units[Simple] subpackage
 

 

u*Units:-Unit(m/s)

 

a*Units:-Unit(m/s^2)

 

t*Units:-Unit(s)

 

(a*t+u)*Units:-Unit(m/s)

 

14*Units:-Unit(m/s)

(1)

 


 

Download simpU.mw

 

you can use the showstat() command.

However Maple commands come in two "flavours", those implemented in the kernel (also known as "builtin" commands) and those in the "library". You cannot view the code for any "builtin" command, but showstat() will display the code for library commands.

Unfortunately both taylor and laurent are "builtin" commands, so attempting showstat(taylor) or showstat(laurent) will hust return the error

Error, (in showstat) cannot debug built-in functions

You can contrast this with (for example) showstat(mtaylor) which will display the code implemented by the command.

Note that the code returned by showstat() may (probably will!) contain references of "builtin" commands

depending on where the data is coming from, any restrictions on the data etc, etc

One possibility for a "toy" example is shown in the attached.

Not sure why the resulting figure does not rendeer properly on this site - it does in the worksheet -honest!

  restart;
  with(plottools):
  with(plots):
  r:=rand(1..20):
  xvals:=[$i=1..20]:
  yvals:=[seq( r(), j=1..20)]:
  rects:=[seq( rectangle( [xvals[j]-1/2, 0], [xvals[j]+1/2, yvals[j]], color=blue), j=1..20)]:
  display(rects);

 

 

Download histo.mw

 

Your original worksheet appears to do more or less the same calculation multiple times (maybe with somewhat different parameters?)

The attached does only the first "loop" calculation and produces the attached Excel file.

You will have to change the filepath in the final ExcelTools:-Export() command to something appropriate for your installation

aCalc.mw

resMat.xlsx

  1. It is your responsibility to ensure that matrix dimensions are "compatible" for which ever matrix operation you are attempting to perform.
  2. There can be an "issue" over the interpretation of the '.' operation if you mix Vector() and Matrix() definitions. If you are performing "conventional" matrix operations, then it is probably safer to define everything as a Matrix(), even for 1xn or nx1 structures. If you use Vector() definitions then it is possible under certain circumstances that the '.' operator will be interpreted as a dot (ie scalar) product, and hence produce a scalar quantity, rather than a 1x1 matrix

Contemplate the difference between V1.V2 and V3.V4 in the attached!

  restart:
  V1:= Matrix(1, 3, [1, 2, 3]):
  V2:= Matrix(3, 1, [4, 5, 6]):
  V1.V2; # outputs a 1x1 Matrix
  V2.V1; # outputs a 3x3 Matrix
  V3:= Vector[row]([1, 2, 3]):
  V4:= Vector[column]([4, 5, 6]):
  V3.V4;  # performs the scalar (ie "dot") product so outputs a scalar
  V4.V3;  # outputs a 3x3 Matrix

Vector(1, {(1) = 32})

 

Matrix(3, 3, {(1, 1) = 4, (1, 2) = 8, (1, 3) = 12, (2, 1) = 5, (2, 2) = 10, (2, 3) = 15, (3, 1) = 6, (3, 2) = 12, (3, 3) = 18})

 

32

 

Matrix(%id = 36893488147955157220)

(1)

 

Download matVec.mw

 

 

see the attached

  restart;
  f := theta -> sin(x(theta));
  D(f)(t);
  convert(%, diff);

proc (theta) options operator, arrow; sin(x(theta)) end proc

 

(D(x))(t)*cos(x(t))

 

(diff(x(t), t))*cos(x(t))

(1)

  restart;
  f:=sin(x(t));
  diff(f, t);

sin(x(t))

 

(diff(x(t), t))*cos(x(t))

(2)

 

Download diffs.mw

First 39 40 41 42 43 44 45 Last Page 41 of 207