djc

571 Reputation

12 Badges

17 years, 283 days
Technical professional in industry or government
Budapest, Hungary

MaplePrimes Activity


These are replies submitted by djc


Thanks for the idea. I have a lot of library path definitons in my maple.ini, After deleting them the example works.

I don't know which is the problematic.

 

You can try it with piecewise and undefined:

f :=  (m, n) -> piecewise(And(And(m::integer, n::integer), (m+n)::nonnegint), m+n, undefined);

f(3, 2);

f(2, -3);

p := seq(seq([x, y, f(x, y)], x = -10 .. 10), y = -10 .. 10):

with(plots):

pointplot3d([p], axes = normal, color = red);

 

 

You can try it with piecewise and undefined:

f :=  (m, n) -> piecewise(And(And(m::integer, n::integer), (m+n)::nonnegint), m+n, undefined);

f(3, 2);

f(2, -3);

p := seq(seq([x, y, f(x, y)], x = -10 .. 10), y = -10 .. 10):

with(plots):

pointplot3d([p], axes = normal, color = red);

 

 Thanks, it was helpful. 

IntegrationTools[Change] with third argument: it was new for me.

 

Here is  another solution to my second problem:

restart;
a1:=Int(1/(2*A),x=-A..A);
constants:=constants,K;
IntegrationTools[Change](a1,x=K*log[10](u))  assuming 1 < K;

 

 Thanks, it was helpful. 

IntegrationTools[Change] with third argument: it was new for me.

 

Here is  another solution to my second problem:

restart;
a1:=Int(1/(2*A),x=-A..A);
constants:=constants,K;
IntegrationTools[Change](a1,x=K*log[10](u))  assuming 1 < K;

 

 

Thanks for your answer. It works perfectly. I have checked the used and the other methods for the numerical integration in the help. I will check the referenced link on J0 too.

Later, I realized, that I used incorrect values for Lo and Wo. Instead of  Lo:=29.379;Wo:=34.477 the correct values are Lo:=29.379E-3;Wo:=34.477E-3  ( I forgot about the mm - > m conversion).

With the corrected Lo, Wo Maple can integrate my original function with the default method fast.


ko:=2*Pi/v*f;v:=2.998*10^8;f:=2.525*10^9;Lo:=29.379E-3;Wo:=34.477E-3;

evalf(eval(1/(120*Pi^2)*Int((sin(ko*W/2*cos(theta))/cos(theta))^2*sin(theta)^3*BesselJ(0,ko*L*sin(theta)),theta=0..Pi),[L=Lo,W=Wo]));

 

djc

 

 

Thanks for your answer. It works perfectly. I have checked the used and the other methods for the numerical integration in the help. I will check the referenced link on J0 too.

Later, I realized, that I used incorrect values for Lo and Wo. Instead of  Lo:=29.379;Wo:=34.477 the correct values are Lo:=29.379E-3;Wo:=34.477E-3  ( I forgot about the mm - > m conversion).

With the corrected Lo, Wo Maple can integrate my original function with the default method fast.


ko:=2*Pi/v*f;v:=2.998*10^8;f:=2.525*10^9;Lo:=29.379E-3;Wo:=34.477E-3;

evalf(eval(1/(120*Pi^2)*Int((sin(ko*W/2*cos(theta))/cos(theta))^2*sin(theta)^3*BesselJ(0,ko*L*sin(theta)),theta=0..Pi),[L=Lo,W=Wo]));

 

djc

 

 

sqrt(a+I*b); evalc(%);

 

sqrt(a+I*b); evalc(%);

Just  a little improvement : displaying piecewises instead of min:

f3:=unapply(piecewise(f1(x)<f2(x),f1(x),f2(x)),x);

Try this:

restart;

f1:=x->piecewise(x>0,x,1);

f2:=x->piecewise(x>0,x+1,-1);

f3:=unapply(combine(min(f1(x),f2(x))),x); # it displays the minimum function of f1 and f2 correctly.
 

with(plots):p1:=plot(f1,color=red):
p2:=plot(f2,color=green):
p3:=plot(f3,color=blue,symbol=circle,style=point):
display(p1,p2,p3);

 

Alec is correct, I don't use RealDomains here, I just wanted to say that mysqrt works on real numbers correctly.

 

 

 

 

You can try this ( in real domain):

restart;

# Defining a new sqrt funtion in real domain:

mysqrt:=x->piecewise(x>=0,sqrt(x),undefined);

# Your function:

f:=x->mysqrt(4 - x^2);

limit(f(x),x=-2,left);

limit(f(x),x=-2,right);

limit(f(x),x=-2);

limit(f(x),x=2,left);

limit(f(x),x=2,right);

limit(f(x),x=2);

plot(f(x),x=-3..3);

 

 The input symbol a originally can be also complex extendend number or extended real.
I 'd like to check if a is finite and nonzero (abs(a)<infinity,a<>0).
I am just playing with writing procedures for safe basic arithmetic operations ( i.e. dealing corrrectly with symbol infinity and undefined ...)
My original example is a simplified part of my procedure.

 The input symbol a originally can be also complex extendend number or extended real.
I 'd like to check if a is finite and nonzero (abs(a)<infinity,a<>0).
I am just playing with writing procedures for safe basic arithmetic operations ( i.e. dealing corrrectly with symbol infinity and undefined ...)
My original example is a simplified part of my procedure.

3 4 5 6 7 8 Page 5 of 8