tomleslie

13876 Reputation

20 Badges

15 years, 163 days

MaplePrimes Activity


These are replies submitted by tomleslie

ebcause I cannot reproduce the problem

I am (still) running Win7 - which might(?) explain the issue.

Ouside chance that the Physics Updates version may be having an impact: I don't keep this completely up-to-date

see the attached

interface(version);
Physics:-Version();

`Standard Worksheet Interface, Maple 2021.1, Windows 7, May 19 2021 Build ID 1539851`

 

`The "Physics Updates" version in the MapleCloud is 1112. The version installed in this computer is 1069 created 2021, September 26, 10:58 hours Pacific Time, found in the directory C:\Users\TomLeslie\maple\toolbox\2021\Physics Updates\lib\`

(1)

restart;

integrand:=(((-3*x^2-18*x-27)*exp(2)^2+(30*x^3+330*x^2+1170*x+1350)*exp(2)-75*x^4-1200*x^3-7050*x^2-18000*x-16875)*ln(x)+(12*x^2+54*x+81)*exp(2)^2+(-120*x^3-1106*x^2-3510*x-4050)*exp(2)+225*x^4+3560*x^3+20990*x^2+54000*x+50625)/((3*x^4+18*x^3+27*x^2)*exp(2)^2+(-30*x^5-330*x^4-1170*x^3-1350*x^2)*exp(2)+75*x^6+1200*x^5+7050*x^4+18000*x^3+16875*x^2);

print("First time");
int(integrand,x);

print("second time");
int(integrand,x);
 

(((-3*x^2-18*x-27)*(exp(2))^2+(30*x^3+330*x^2+1170*x+1350)*exp(2)-75*x^4-1200*x^3-7050*x^2-18000*x-16875)*ln(x)+(12*x^2+54*x+81)*(exp(2))^2+(-120*x^3-1106*x^2-3510*x-4050)*exp(2)+225*x^4+3560*x^3+20990*x^2+54000*x+50625)/((3*x^4+18*x^3+27*x^2)*(exp(2))^2+(-30*x^5-330*x^4-1170*x^3-1350*x^2)*exp(2)+75*x^6+1200*x^5+7050*x^4+18000*x^3+16875*x^2)

 

"First time"

 

ln(x)/x+1/x+(15*x^2+(-4*exp(2)+356/3)*x-9*exp(2)+225)/(x*(x+3)*(exp(2)-5*x-25))

 

"second time"

 

ln(x)/x+1/x+(15*x^2+(-4*exp(2)+356/3)*x-9*exp(2)+225)/(x*(x+3)*(exp(2)-5*x-25))

(2)

 


 

Download intProb.mw

@vv 

and I can think of (at least) three possibilities

  1. Maple produces crap EPS (as well as crap pdf)
  2. GIMP cannot import "good" EPS (assuming Maple can produce it)
  3. GIMP cannot transform EPS to pdf

So where do you think the problem is?

 

@vv 

As I clearly stated I exported from Maple in Encapsulated Postscript and converted to PDF using GIMP.

Since this site will not display PDF content inline, I uploaded the pdf file as a link only.

I also converted this PDF to PNG, just for display on this site

@The function 

and I have to write some random crap here before this site will accept the answer

@Alex0099 

I have no idea what you mean by

It's clear, but I'm interested what how to analyze this psi(x) without maple, maybe you know some works of literature, references, i.e., you yourself should know how to get these coeffs?

I'm also not sure what you mean by

Do I understand correctly that this 4*l^2*sin(n*Pi/2) and  l^2((-1^n)-1) the same thing?

One can easily examine the first few terms in both of these summations - see the attached


 

  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):
  seq( op([2,1], res), n=1..8);

4*l^2*sin(Pi*x/l)*sin(a*Pi*t/l)/(Pi^3*a), 0, -(4/27)*l^2*sin(3*Pi*x/l)*sin(3*a*Pi*t/l)/(Pi^3*a), 0, (4/125)*l^2*sin(5*Pi*x/l)*sin(5*a*Pi*t/l)/(Pi^3*a), 0, -(4/343)*l^2*sin(7*Pi*x/l)*sin(7*a*Pi*t/l)/(Pi^3*a), 0

(1)

 

  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(-l/2, t) = 0, u(l/2, t) = 0: # change bcs to -l/2, l/2
#
# OP's original definition of psi had a typo
#
  psi := piecewise( -l/2 <= x  and x <= 0, x,
                    0 < x and x <= l/2, l - x
                  ): # change piecewise fumction to -l/2, l/2

  res := pdsolve([pde,ic,bc], HINT = TWS):
  seq( op([2,1], res), n=1..8);

l^2*sin(2*Pi*x/l)*sin(2*a*Pi*t/l)/(Pi^2*a), 0, (1/9)*l^2*sin(6*Pi*x/l)*sin(6*a*Pi*t/l)/(Pi^2*a), 0, (1/25)*l^2*sin(10*Pi*x/l)*sin(10*a*Pi*t/l)/(Pi^2*a), 0, (1/49)*l^2*sin(14*Pi*x/l)*sin(14*a*Pi*t/l)/(Pi^2*a), 0

(2)

 


 

Download waveEq4.mw

 

@Alex0099 

in my original worksheet - you just have to specify the boundary conditions at -l/2, l/2 as well as adjyst the piecewise definition, as shown in the attached

  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(-l/2, t) = 0, u(l/2, t) = 0; # change bcs to -l/2, l/2
#
# OP's original definition of psi had a typo
#
  psi := piecewise( -l/2 <= x  and x <= 0, x,
                    0 < x and x <= l/2, l - x
                  ); # change piecewise fumction to -l/2, l/2

  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(-(1/2)*l, t) = 0, u((1/2)*l, t) = 0

 

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

 

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

(1)

 


 

Download waveEq3.mw

@Alex0099 

why you want to do it the hard way - but since you do, maybe the attached will help

restart:
with(PDETools):

# 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:
psi := piecewise(0 <= x and x <= l/2, x, l/2 < x and x <= l, l - x):

# using Fourier method for solving (I require use this methods)
res := pdsolve(pde, HINT = T(t)*X(x)):

ode1 := op(1, op(1, op(2, res))):

ode2 := op(2, op(1, op(2, res))):               

ode2 := subs(_c[1] = -lambda, ode2):
              

# solve 2 ODE
# equation rely X(x)
dsolve({ode2, X(0) = 0}, X(x)):

sin(sqrt(lambda)*l) = 0:

solve(%, lambda, allsolutions):

lambda := (Pi*n/l)^2:

X := (x, n) -> sin(Pi*n*x/l):


# equation rely T(t)
ode1 := subs(_c[1] = -lambda, ode1):

dsolve({%, T(0) = 0}, T(t)):

T := (t, n) -> C1[n]*sin(Pi*n*a*t/l):

# write the general solutions


Un := (x, t, n) -> T(t, n)*X(x, n):

# Derivative of Un w.r.t t
DtUn := eval(diff(Un(x, t, n), t), t=0):

# Compute the Fourier coefficients

int(DtUn*sin(Pi*n*x/l), x=0..l) assuming l>0:
int(psi*sin(Pi*n*x/l), x=0..l) assuming l>0:
coeffVal:=simplify(isolate(%%=%, C1[n])) assuming n::nonnegint:
gensol:= sum( eval( T(t,n)*X(x,n),coeffVal), n=0..infinity);

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

(1)

 

 

Download waveEq2.mw

It seems to give the same answer as the "simple2 version I posted earlier

to my original worksheet which seems to handle your issues


 

restart

``

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)

``

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)

````

``

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)

``

Calculation Mass Transfer

 

``

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)

``

Diffusivity

 

``

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)

``

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)

NULL

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)

NULL

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)

NULLNULL

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)

NULLNULL

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); sol(convert(Bloodpath, unit_free)); eval(P(x), sol(convert(Bloodpath, unit_free))); plots:-odeplot(sol, [x, P(x)], x = 0 .. convert(Bloodpath, unit_free))

 

``

NULL

Download odeProb2.mw

Below is an uploaded worksheet, based on your original question. (upload using the big green up-arrow in the Mapleprimes toolbar

F := (a1, b1) -> int(1/sqrt(1 + (-1)*b1^2*sin(teta)*sin(teta)), teta = 0 .. a1);

proc (a1, b1) options operator, arrow; int(1/sqrt(1-b1^2*sin(teta)^2), teta = 0 .. a1) end proc

(1)

Phi(Pi/2, teta) = 2*(F((Pi/2 - teta_l)/2, sqrt(2/(1 - sin(teta_l)))) - F1(Pi/4, sqrt(2/(1 - sin(teta_L)))))/sqrt(sin(teta_l) - 1);

Phi((1/2)*Pi, teta) = 2*(-InverseJacobiAM(-(1/4)*Pi+(1/2)*teta_l, 2^(1/2)/(1-sin(teta_l))^(1/2))-F1((1/4)*Pi, 2^(1/2)*(1/(1-sin(teta_L)))^(1/2)))/(sin(teta_l)-1)^(1/2)

(2)

 

Download upl.mw

However this (and your original question) contains the function F1() which you have not defined - so no-one here can do much with the information you provide

The only reference you give is to an academic paper behind a paywall - realsitically do you think I'm going to pay to read this!?

@dearcia 
I have checked my original code all the way back to Maple 18 (released sometime in 2014) and it works

Which Maple version are you using?

Download the attached: do nothing except hit the !!! icon in the Maple toolbar, save the results and upload them here using the big green up-arrow in the Mapleprimes toolbar. That way I can see exactly what your particular Maple installation is doing with my code

dplt2.mw

@eslamelidy 

Once I fix a few typos (like the difference between epsilon and varepsilon!!), then the attached worksheet will produce the attached Excel file.

General advice - when exporting to Excel, it is usualy better if the data is organised as a Matris or a 2D table

In the attached worksheet you will have to change to filepath in the ExcelTools:-Export() command to something appropriate for your installation

XT.mw

data.xlsx

@Zeineb 

why don't you show a worksheet where you do it?

@Preben Alsholm 
you state

Obviously the real value is wrong since it must be larger than -2

\Well the value obtained is 'infinity' - which (the last time I checked) is larger than -2

@JAMET 

would be the code in the attached, although why you want to write your own taylor() command is a mystery

  restart;
  f:= t->sin(t):
  add( (D@@k)(f)(0)*t^k/k!, k=0..10);

t-(1/6)*t^3+(1/120)*t^5-(1/5040)*t^7+(1/362880)*t^9

(1)

 

Download myTayl.mw

 

@mmcdara 

Adjusting the Digits setting was unnecessary in Maple2015, Maple2016, Maple2017, Maple2018, but is (apparently?) required in Maple2019, Maple2020 and Maple2021.

Why?

First 27 28 29 30 31 32 33 Last Page 29 of 207