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

I realize that this is your first time. In the future please upload a worksheet instead of using a screen shot. The people who answer questions here generally do not take kindly to having to retype your formulas from a screen shot.

There might be a difference between Maple 13 and 17 at issue here. I did not get the warning, and I got values for Z. It's just a cubic equation. Here are three techniques to solve for Z. Almost surely, at least one of these will work for you.

restart:
Digits:= 10:
P:= [beta= 0.08711686224, q= 4.446850237, epsilon= 1-sqrt(2), sigma= 1+sqrt(2)]:
EC1:= Z=1+beta-(q*beta*(Z-beta)/(Z+epsilon*beta)/(Z+sigma*beta));

Three solution techniques:
1. Solve symbolically first, then substitute parameters:
evalf(eval([solve(EC1, Z)], P));
         [0.6906702280, 0.1111064548 + 0.1567590067 I,
           0.1111064548 - 0.1567590067 I]


2. Substitute parameters first, then solve. This is what you were trying.
solve(eval(EC1, P), Z);
         0.6906702273, 0.1111064551 + 0.1567590075 I,
           0.1111064551 - 0.1567590075 I


3. Use numeric solver fsolve:
fsolve(eval(EC1, P), Z);
                          0.6906702273


The package name is Orbitals, not "orbital". Does the folder C:\MapleLibs contain the files Orbitals.lib, Orbitals.hdb, and Oribitals.ind?

To send the output to a file, include the filename option:

codegen[fortran](A, filename= "myfortranfile.txt");

Try to convert your code to use the newer CodeGeneration:-Fortran, as the older one is deprecated. In that case, to get file output use

CodeGeneration:-Fortran(A, output= "myfortranfile.txt");

I told you in my Answer to your previous Question that functions should be defined via f:= (x,y)-> ...and not via f(x,y):= .... Maple will often let you "get away with" using the latter form, but this time it didn't. I can't explain why it didn't work this time, nor can I explain why Maple seems to totally ignore the command (that seems totally strange). But I do know that if you change it to

pathZ:= (r,theta)-> ...

then it will work.

Just change your command from x=0 to h=0:

taylor(y(x+h), h=0);

To have matrix and vector computations done in single precision, create the Matrices and Vectors with the option datatype= float[4].

Example:

V:= Vector(1000, n-> 1/n^3, datatype= float[4]);
V.V;

                     1.01734306201200031

Compare with the result obtained using datatype= float[8], which is double precision.

                     1.01734306198444679

Note that the results begin to differ at the 9th decimal place.

You're right. I don't think that there's any way to get it to accept infinity. Here's a workaround: Use gamma instead of infinity. When the tutor is done, give the command:

limit(subs(gamma= x, %), x= infinity);

For example,

count:= 0:
for i from 1 to 9 do
     for j from 1 to i do
          count:= count+1
     end do
end do;
count;
                                              45

Of course, this example is trivial, and there are much more efficient ways to perform this particular computation.

interface(showassumed= 0):
assume(nu::real, m>0, k>0, T>0):
Int(nu*4*Pi*(m/2/Pi/k/T)^(3/2)*nu^2*exp(-m*nu^2/2/k/T), nu= 0..infinity);

value(%);

Whenever a symbol is redefined by a package, the original value of the symbol can be accessed by prefixing the symbol with :-. So in this case you'd use :-``.

with(Physics):
``(3)*``(2);
Error, (in GetDifferentiationVariables) differentiation variables for dAlembertian, d_ and D_ are not defined; either use Setup(differentiationvariables =  ...) to set them, or indicate the differentiation variables as a second argument to dAlembertian

:-``(3)*:-``(2);
                            (3) (2)

There is a policy stated in the 6th paragraph at ?name : 

Names that start with an underscore (with the exception of _Env) are used as global variable names by Maple and are effectively reserved for use by library code. Do not use a symbol beginning with an underscore. The empty name `` must never be assigned a value.

It seems that Physics violates this.

 

For the constraints to DirectSearch, you could generate all pairs of the variables like this:

map(`<>`@op, combinat:-choose({a,b,c,d}, 2));

You can use VolumeOfRevolution and exchange the roles of x and y:

Student:-Calculus1:-VolumeOfRevolution(
      2*t^3-t^4, t= 0..2,
      axis= vertical, distancefromaxis = -2,
      output= plot, labels= [y,x,z], caption= ``
);

I believe that this is the same surface as Preben plotted.

Is that what you were expecting?

You need to remove the definition of POWER.

restart:
ee:=u^2+v^2-w^2:
applyrule(a::algebraic^b::nonunit(algebraic) = POWER(a,b), ee);

            POWER(u, 2) + POWER(v, 2) - POWER(w, 2)

Note also the presence of the modifier nonunit. This is necessary to prevent an infinite loop (where it treats everything as itself to the power 1).

Another way:

subsindets(ee, `^`, x-> POWER(op(x)));


(**)

f:= x-> ((x^2-x-3)/(x^2+1))*(x^2+x+1);

proc (x) options operator, arrow; (x^2-x-3)*(x^2+x+1)/(x^2+1) end proc

(**)

D(f)(x);

(2*x-1)*(x^2+x+1)/(x^2+1)-2*(x^2-x-3)*(x^2+x+1)*x/(x^2+1)^2+(x^2-x-3)*(2*x+1)/(x^2+1)

(**)

simplify(%);

2*(x^5+2*x^3+2*x^2-2)/(x^2+1)^2

(**)

 


Download diff.mw

You simply need to use the two-argument eval command.


(**)

eqns:=[
    S     = (1-alpha)*((1-beta)*A*g*k^(g-1)-beta*(k+b)*A*(g-1)*g*k^(g-2)),
    c_3   = (1-alpha)*A*(1-g)*k^g,
    c_4   = (1-alpha)*(1-beta)*A*g*k^(g-1),
    c_5   = -(1-alpha)*b*(A*g*k^(g-1)-1),
    cv    = c_3*sigma/(sqrt(1+c_4)*sqrt(c_3+c_5)),
    phi_3 = sigma/(sqrt(1+c_4)*sqrt(c_3+c_5))-(1/2)*cv/(c_3+c_5),
    c_3k  = -(1-alpha)*k*A*(g-1)*g*k^(g-2),
    phi_4 = -(1/2)*cv/(1+c_4),
    c_4k  = (1-alpha)*(1-beta)*A*(g-1)*g*k^(g-2),
    phi_5 = -(1/2)*cv/(c_3+c_5),
    c_5k  = -(1-alpha)*b*A*(g-1)*g*k^(g-2),
    c_5b  = (1-alpha)*(1-A*g*k^(g-1)),
    G     = c_3k*phi_3+c_4k*phi_4+c_5k*phi_5,
    B     = -(1+(1-alpha)*(beta*A*g*k^(g-1)-1))/
            (1-(1-alpha)*((1-beta)*A*g*k^(g-1)-beta*(k+b)*A*(g-1)*g*k^(g-2)))
]:

(**)

vals:= [alpha= 0.3, beta= 0.3, g= 0.3, sigma=1, b= 0.85, k= 0.83]:

(**)

eval(eqns, vals);

[S = .269178523926482*A, c_3 = .463361032316227*A, c_4 = .167479891198636*A, c_5 = -.203368439312629*A+.595, cv = c_3/((1+c_4)^(1/2)*(c_3+c_5)^(1/2)), phi_3 = 1/((1+c_4)^(1/2)*(c_3+c_5)^(1/2))-(1/2)*cv/(c_3+c_5), c_3k = .167479891198637*A, phi_4 = -(1/2)*cv/(1+c_4), c_4k = -.141248101010898*A, phi_5 = -(1/2)*cv/(c_3+c_5), c_5k = .171515551227519*A, c_5b = .7-.239256987426622*A, G = c_3k*phi_3+c_4k*phi_4+c_5k*phi_5, B = -(.3+0.717770962279868e-1*A)/(1-.269178523926482*A)]

(**)

 


Download eval.mw

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