Carl Love

Carl Love

28020 Reputation

25 Badges

12 years, 302 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

Assuming that you mean p is the conjugate of z, then

restart:
eq:= (2*z-3)*(-3*p+4) - (2*p-3)*(-3*z+4)=0:
solve(eval(eq, [z= x + I*y, p= x - I*y]));

Therefore z can be any real number.

Several pointers in general:

  1. "e" means nothing on input to Maple.The correct name is exp. You had e in one place and exp in another.
  2. Functions should be defined as f:= (x,y)-> ..., not as f(x,y):= ....
  3. If you want numeric integration, use Int, not int. The latter will try symbolic integration first, potentially taking a long time.

Specifically for this problem: I got 6 digits of precision on the integral in mere seconds by passing the optional argument digits= 6 to Int. There seems to be a threshold effect: At 7 digits, it starts to take a very long time. Since you have constants in your problem with only 4 digits, 6 should be enough.

Here's your worksheet with my corrections:

(**)

restart:

(**)

width:= 35:  gap:= 8.89:  B0:= 1.30615:  centralR:= 1.5322550941477154982:

(**)

 

(**)

z:= (x,y)-> sqrt((-0.012029242-0.05060297686 *x+0.2191855734* y)^2+(0.0521043725+0.2191855734* x-0.9493970231* y)^2);

(**)

 

(**)

perpDegradation:= (x,y)-> B0/(1+exp(-6.762031311+17.48081911 *z(x,y)+2.232089510* Pi-0.8171* (7.320276006* z(x,y)+0.9347108501 *Pi-2.936480740)^2+0.2 *(7.320276006 *z(x,y)+0.9347108501* Pi-2.936480740)^3));

(**)

 

(**)

extendedField:= (x,y)-> perpDegradation(x,y)*(Heaviside(-4.331475875*x+7.474536933-y)-Heaviside(-4.331475875*x+6.140092706-y))*Heaviside(-0.2308681911*x-0.05488154218+y);

(**)

 

(**)

By:= (r,theta)-> B0*(Heaviside(r-1.3822551)-Heaviside(r-1.6822551))*Heaviside(.2308681911*r*cos(theta)+0.5488154218e-1-r*sin(theta))/(1+exp(.25028469571727139024+2.388*(11.21653020*theta-2.936480740)+((-1)*.8171)*(11.21653020*theta-2.936480740)^2+.2*(11.21653020*theta-2.936480740)^3));

(**)

 

(**)

Byextended:= (r,theta)-> By(r,theta)+extendedField(r*cos(theta),r*sin(theta));

(**)

 

35

8.89

1.30615

1.5322550941477154982

proc (x, y) options operator, arrow; sqrt((-0.12029242e-1-0.5060297686e-1*x+.2191855734*y)^2+(0.521043725e-1+.2191855734*x-.9493970231*y)^2) end proc

proc (x, y) options operator, arrow; B0/(1+exp(-6.762031311+17.48081911*z(x, y)+2.232089510*Pi-.8171*((7.320276006*z(x, y)+.9347108501*Pi-2.936480740)^2)+.2*((7.320276006*z(x, y)+.9347108501*Pi-2.936480740)^3))) end proc

proc (x, y) options operator, arrow; perpDegradation(x, y)*(Heaviside(-4.331475875*x+7.474536933-y)-Heaviside(-4.331475875*x+6.140092706-y))*Heaviside(-.2308681911*x-0.5488154218e-1+y) end proc

proc (r, theta) options operator, arrow; B0*(Heaviside(r-1.3822551)-Heaviside(r-1.6822551))*Heaviside(.2308681911*r*cos(theta)+0.5488154218e-1-r*sin(theta))/(1+exp(.25028469571727139024+2.388*(11.21653020*theta-2.936480740)+(-1)*.8171*((11.21653020*theta-2.936480740)^2)+.2*((11.21653020*theta-2.936480740)^3))) end proc

proc (r, theta) options operator, arrow; By(r, theta)+extendedField(r*cos(theta), r*sin(theta)) end proc

(**)

evalf(Int(Byextended(centralR,theta), theta=0..Pi/6, digits= 6));

.348526

(**)

 


Download 6_digits.mw

 

It's tricky because Maple automatically distributes integer factors over sums. You can do this:

(**)

p:= 18*R*r - 3*s^2 + 9*r^2;

18*R*r+9*r^2-3*s^2

(**)

content(p)*``(primpart(p));

3*``(6*R*r+3*r^2-s^2)

(**)

 

Notice the special quote marks in my command. It's two single backquotes (the key under ESC on my keyboard) together with nothing in between them.

The expand command will put this back to its original form.

Download primpart.mw

 

By starting from the closed-form expression for the Fibonacci numbers, we can generate a one-line algebraic expression for "next Fibonacci".

 

A procedure for the "next Fibonacci" modeled on nextprime. Written by Carl Love 18 September 2013.

(**)

restart:

(**)

Fn:= rsolve({F(n+1) = F(n) + F(n-1), F(1)=1, F(2)=1}, F(n));

-(1/5)*5^(1/2)*(-(1/2)*5^(1/2)+1/2)^n+(1/5)*5^(1/2)*((1/2)*5^(1/2)+1/2)^n

(**)

evalf(%);

-.447213595499958*(-.618033988749900)^n+.447213595499958*1.61803398874990^n

Note that the negative term gets smaller in magnitude rapidly (exponentially) with increasing n. Thus the value of the Fibonacci number can be determined by rounding the positive term to the nearest integer. I manually extract the positive term for this purpose:

(**)

FibOfIndex:= n-> ((1+sqrt(5))/2)^n/sqrt(5);

proc (n) options operator, arrow; (1/2+(1/2)*sqrt(5))^n/sqrt(5) end proc

Note that the above is continuous for any nonegative n. Below is simply the inverse of the above function. It returns the n for a given Fibonacci F. It also is continuous for positive F. That means that we can apply it to the numbers between the Fibonacci numbers!

(**)

IndexOfFib:= unapply(rhs(isolate(F=FibOfIndex(n), n)), F);

proc (F) options operator, arrow; ln(F*5^(1/2))/ln((1/2)*5^(1/2)+1/2) end proc

Now we see that we can make a single algebraic expression for the "next Fibonacci".

(**)

nextFibo:= proc(x)
     option remember;
     local r;
     r:= trunc(

          evalf[3+ilog10(x)](round(FibOfIndex(ceil(IndexOfFib(x)))))

     );
     `if`(r=x, thisproc(x+1), r)
end proc:

Hard code the "difficult" cases.

(**)

(nextFibo(0),nextFibo(1)):= (1,2):

 

Download next_fibonacci.mw

It isn't exactly an issue of global vs. local. The issue is that assuming doesn't work on variables in procedures, even if they are global; but assume does work on them. It seems as though assuming was designed this way--the documentation at ?assuming,details does mention this property:

The assuming command does not scan Maple programs regarding the potential presence of assumed variables. To compute taking into account assumptions on variables found in the bodies of programs, use assume....

Perhaps someone else can comment on why it was designed this way.

Example:

restart:
f:= proc() global a; a end proc:
is(f()>0) assuming a>0;
                             false
assume(a>0);
is(f()>0);
                              true

 

 

 

 

 

 

 

There is no nontrivial solution to your equation. Your A has first row all zero. Thus, for any P, the [1,1] entry of A.P + P.A^%T will be 0. Thus it cannot equal your C, unless the scale factor is 0.

There's atomicweight for elements and atomicmass for isotopes. They are presented in kg by default. You can convert to amu:

macro(SC= ScientificConstants):
convert(SC:-GetValue(SC:-Element(oxygen, atomicweight)), units, kg, amu);
                        15.9994000000000

IsPrime:= proc(n) option cache; isprime(n) end proc:
APSearch:= proc()
     local SP:= 2, AD:= 210, n:= 7, k, S;
     do
          SP:= nextprime(SP);
          S:= SP + k*AD $ k = 1..n-1;
          if andmap(IsPrime, [S]) then
               return [SP, S]
          end if
     end do
end proc:     
APSearch();
              [47, 257, 467, 677, 887, 1097, 1307]

I put your data into a Matrix M with three columns. Then I gave the plot command

plot(
     [M[.., [1,2]], M[.., [1,3]]],
     labels= [time, `error`], legend= [error1, error2]
);

This command indicates a plot of two curves, the first being column 1 vs column 2 and the second being column 1 vs. column 3.

First, read the help page ?LinearAlgebra,General,LinearSolveItr .

To use conjugate gradient (without a preconditioner) to solve AX = b, do

infolevel[LinearAlgebra]:= 5:

X:= LinearAlgebra:-LinearSolve(
     A, b, method= SparseIterative, methodoptions= [itermethod= CG, precon= false]

);

To do preconditioned conjugate gradient, do the same, but leave off the precon= false. There are a number of other options, discussed on the help page, that you can set.

You can use a third argument to seq, the step increment:

seq(a[i], i= 3..1, -1)

The package Student is divided into subpackages: Calculus1, NumericalAnalysis, etc. You need to also load the subpackage with with:

with(Student):
with(Calculus1):

DiffTutor(exp(x^2));

There are arbitrarily long (but not infinitely long) arithmetic progressions of primes. This is the Green-Tao theorem, proved in 2004. See the Wikipedia article "Primes in arithmetic progression". For a progression of length greater than 6, you'll need the gap to be a multiple of 210 = 7*5*3*2.

I believe that what they intended is this:

MyString:= "bd847EK&#BJWbs287*&":
(uppers,lowers,digits,others):= ""$4:
for c in MyString do
     if c >= "A" and c <= "Z" then
          uppers:= cat(uppers, c)
     elif c >= "a" and c <= "z" then
          lowers:= cat(lowers, c)
     elif c >= "0" and c <= "9" then
          digits:= cat(digits, c)
     else
          others:= cat(others, c)
     end if
end do;
uppers, lowers, digits, others;

But you are correct that there is a way to do this without a loop. Note, though, that MyString can be arbitrarily mixed up.

You could use your own procedure instead of TangentLine, like this

restart:
with(VectorCalculus):
SetCoordinates( 'cartesian'[x,y,z] ):
MyTangentLine:= (V, Pt::(name=algebraic))->
    eval(V,Pt)+eval(VectorCalculus:-TangentVector(V),Pt)*op(1,Pt)
:
MyTangentLine( <sin(t)-t*cos(t), cos(t)+t*sin(t), t^2>, t= Pi/2);

First 347 348 349 350 351 352 353 Last Page 349 of 395