## 40 Reputation

8 years, 351 days

## Problem using boolean operators...

Maple

Hello

i was stuck with some simple problem. I tried using if condition in program that involves a truth condition. If maple cannot determine the condition is true or false i want to assign o to a particular varable. I  show a similar program.

restart;

h[1] := -1;

for i from 1 by 1 while(i<150 and h[i]<0) do

p1[i] := .989347189582843*x^2-0.139423979061219e-1*x-1.82559474469870*10^8*x^15+1.30761381361453*10^8*x^16-6.88520063191821*10^7*x^17+2.51079317463498*10^7*x^18-5.66094206949155*10^6*x^19+5.94129446612678*10^5*x^20-6812.74182685426*x^5+59230.0931084044*x^6-3.83520584559500*10^5*x^7+1.90126822307036*10^6*x^8-7.34991883857609*10^6*x^9+2.24203561757434*10^7*x^10-5.43284775909785*10^7*x^11+1.04806113793011*10^8*x^12-1.60600324339222*10^8*x^13+1.94090536353833*10^8*x^14+559.557918804679*x^4-30.6576714427729*x^3-3.93727537464007*10^(-15)-i^2-i; fsolve(p1[i]-0.312e-1, x, -1 .. 1);

if fsolve(p1[i]-0.312e-1, x, -.2 .. 0) < 0 then h[i+1] := fsolve(p1[i]-0.312e-1, x, -.2 .. 0) elif FAIL then h[i+1] := 0 end if;

print(i, h[i])

end do;

i got an error message

Error, cannot determine if this expression is true or false: () < 0

how can i get a value of 0 for h[i] if the error comes.

Thanks.

## Area under implicitly defined curve...

Maple

Hi,

I have a small problem. I want to findout area under a curve. I got the plot from solving a partial differential equation. I want to find out area under the curve with out using interpolation. Are there any methods to find this.

here i enclose the method i have done.

Es := 0.117108e12:
Ef := 0.78125e11:
l := 0.150e-6:
s := 0.500000e-3:
f := 0.5898334197e-6:
o := 0.9e-5:
d := 0.10e-17:
cb := 0.1e7/(19.9):
c := l*f/(d*cb):

PDE := diff(u(x, t), t)-(diff(u(x, t), x, x)) = 0:

with(plots):
with(plottools):
ys := -0.4245333333e-1:
IBC1 := {u(x, 0) = 0, (D[1](u))(0, t) = 0, (D[1](u))(1, t) = c}:
S1 := pdsolve(PDE, IBC1, numeric, time = t, timestep = 0.1e-2);

p2 := S1:-plot(t = .2525);

p3 := getdata(p2);

p3[3]:
co:=CurveFitting[PolynomialInterpolation](p3[3], x):
Area := int(co, x = x[1] .. x[2]):

So this is the procedure i used to find out, but can there be any other procedure to findout area directly from hte solution of PDE.

Thanks.

## error in solving diffusion equation...

Maple

Hi,

I have a problem with maple solving diffusion equation. I solved the equation as follows

Es := 0.117108e12;
Ef := 0.78125e11;
l := 0.150e-6;
s := 0.500000e-3;
f := 0.5898334197e-6;
o := 0.9e-5;
d := 0.10e-17;
cb := 0.1e7/(19.9);
c := l*f/(d*cb);
PDE := diff(u(x, t), t)-(diff(u(x, t), x, x)) = 0;
IBC1 := {u(x, 0) = 0, (D[1](u))(0, t) = 0, (D[1](u))(1, t) = c};
S1 := pdsolve(PDE, IBC1, numeric, time = t);
S1:-plot(t = 0.6e-2);

i am plotting cincentration along the thickness of the material. i want to know why the concentration is negative. It should not be negative because constant flux 'c' is present at x=1. and flux at x=0 is 0, and also the initial concentration is 0.

Thanks

## Hfloat error in solving partial differen...

Maple

with(PDEtools);
Es := 0.117108e12;
Ef := 0.78125e11;
l := 0.150e-6;
s := 0.500000e-3;
f := 0.5898334197e-6;
o := 0.9e-5;
d := 0.10e-17;
cb := 0.1e7/(19.9);
R := 8.3144621;
T := 298;

PDE := diff(u(x, t), t)-(diff(u(x, t)+o^2*Es*cb*u(x, t)^2/(9*R*T), x, x)) = 0;
IBC := {u(1, t) = 1, u(x, 0) = 0, (D[1](u))(1, t) = l*f/(d*cb)};
S := pdsolve(PDE, IBC, numeric, time = t, range = 0 .. 1, timestep = 0.1e-4, spacestep = 0.1e-6);
p1 := S:-plot(t = .1, numpoints = 100);
Error, (in pdsolve/numeric/plot) unable to compute solution for t>HFloat(0.0):
matrix is singular
p2 := S:-plot(t = .2, numpoints = 50, color = green);
Error, (in pdsolve/numeric/plot) unable to compute solution for t>HFloat(0.0):
matrix is singular
p3 := S:-plot(t = .3, numpoints = 50, color = blue);
Error, (in pdsolve/numeric/plot) unable to compute solution for t>HFloat(0.0):
matrix is singular
plots[display]({p1, p2, p3});
Error, (in plots:-display) expecting plot structures but received: {p1, p2, p3}

 Page 1 of 1
﻿