MaplePrimes Questions

Hi,
I face a problem using Tolerances:-NominalValue and Tolerances:-ToleranceValue on a quantity constructed from add.

Example

restart:
with(Tolerances):
x := 10 &+-1:
y := 20 &+- 2:
z := 3*x+2*y;
NominalValue(z);     
# returns 70 as expected
ToleranceValue(z);   # returns 7 as expected


Now I define another quantity Z this way:

Z := add([3, 2] *~ [x, y]);
(or equivalently add(ListOfCoeffs[k]*ListOfVars[k], k=1..K) where ListOfCoeffs and ListOfVars are previously defined adhoc lists)

Both NominalValue(Z) and ToleranceValue(Z) return an error.
PS: already (and this probably explains that) Z does not appear as 70 +/- 7 but as 3*Interval(...)+2*Interval(...) (lprint confirmed)

How can I obtain NominalValue(Z) and ToleranceValue(Z) when Z comes from 'add' constructor?

Hellow

 

I want to create a function that sort an array with a parametric variable alpha[k]. But Maple ignores the sort command, so the array never gets sorted. Please see attached url to creen capture of the problem:

 

https://www.dropbox.com/s/gjy5zbm4gjwmwdv/sort.png?dl=0

Thnaks

 

Hi everyone, my question is how do I get maple to process these commands. It is currently not evaluating them, and output is also similar to the image above. This occurs when I open a workbook from my Professor, all the math commands that are already inserted into the worksheet output this when I try to execute them.

I have found a workaround, I simply copy and paste the code in a new command line but this is tedious and I was wondering if anyone knew how to fix this.

Thanks!

         Fract := proc(P::posint, Q::posint)  
         local p,q:
         for p from 1 to P-1 do
            for q from 1 to Q-1 do
              if (P-p)*q-P*(Q-q)=1 the return (p/q,(P-p)/(Q-q): fi:
          od:od:  
       end;
        debug(Fract);
        Fract(5, 13);
        Fract(77, 200);

 

How can type 

[
 

"seq('op'('S['i'])',i=1..5)"

op(S[1]), op(S[2]), op(S[3]), op(S[4]), op(S[5])

(1)

into

into

(2)

op(S[1]), op(S[2]), op(S[3]), op(S[4]), op(S[5])

``

(3)

``


 

Download op_seq.mw

seq('op'('S['i'])',i=1..5)]

export

[op(S[1]), op(S[2],op(S[3],op(S[4])]

Please help me

I need to plot 2 surfaces (f, g) and a plane (Op) (two surfaces and the osculating plane to their complete intersection curve). When I use

f := x*w - z
g := -z^2-w+x+2*z-1
Op := 5*x-4-4*z+3*w
implicitplot3d({f, g, Op}, x = 0 .. 2, z = 0 .. 2, w = 0 .. 2, grid = [50, 50, 50])

it is very difficult to differentiate between them, so I would like to plot f, g and Op using different color schemes or something. Any ideas on how to do this?

Hello everyone!

I am confronted with a problem that seems to result from different definition of spherical coordinates in Maple and in Student[VectorCalculus] package.

I want to visualize a vector field defined in spherical coordinates (r,theta,phi).

A simple exampe is < 0, theta, 0 >. If I want to see just one slice of the field in OXY plane, I type:

fieldplot3d(<0, theta, 0>, r = 0 .. 1, theta = 0 .. 2*Pi, phi = 0 .. Pi, coords = spherical, grid = [10, 20, 3], color = black, fieldstrength = fixed(1), arrows = THICK)

And get:

which looks OK more or less but I don't like the nonuniform distribution of arrows. But since the field is defined in spherical coordinates there seems to be no way to produce a uniform distribution with fieldplot3d command.

However VectorField command in Student[VectorCalculus] package seems to do just what I want. But a similar call to it:

SetCoordinates('spherical'[r, theta, phi])

VectorField(<0, theta, 0>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]])  produces quite a different result:

which means that the second argument 'theta' is not the azimuthal angle but the angle from the Z axis, and amounts to Pi/2 since we look at the OXY plane.

The result of: VectorField(<0, 0, theta>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]])  looks better:

but is not correct since the magnitude of the field does not change with the azimutal angle. Finally, 

VectorField(<0, 0, phi>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]]) produces almost what I want:

but it's quite different from what you get with fieldplot3d command. Apparently, not only azimuthal angle is now the third argument but it varies from -Pi to Pi, not from 0 to 2Pi as it does in fieldplot3d. I hoped to use both fieldplot3d and VectorField  with my vector fields but I cannot since they are not consistent in the definition of spherical coordinates.

My questions therefore are:

1) Is there a way to redifine spherical coordinates in VectorField command to make them consistent with the rest of Maple?

2) Can I produce a uniform 3D distribution of arrows for a field in spherical coordinates without VectorField command?

Many thanks for your help in advance!

Figure;
                             Figure
restart;
A[0] := 0;
                               0
A[1] := sqrt(2*(k[1]^2-w[1]^2))/sqrt(lambda);
                                       (1/2)
                    /      2         2\     
                    \2 k[1]  - 2 w[1] /     
                    ------------------------
                                (1/2)       
                          lambda            
A[2] := sqrt(2*(k[2]^2-w[2]^2))/sqrt(lambda);
                                       (1/2)
                    /      2         2\     
                    \2 k[2]  - 2 w[2] /     
                    ------------------------
                                (1/2)       
                          lambda            
c[1] := 1;
                               1
c[2] := 1;
                               1
c[3] := 1;
                               1
c[4] := 1;
                               1
c[5] := 1;
                               1
c[6] := 1;
                               1
k[1] := 10.5;
                              10.5
k[2] := 3.5;
                              3.5
w[1] := 5.05;
                              5.05
w[2] := .5;
                              0.5
m := 1.9;
                              1.9
lambda := 1.75;
                              1.75
xi[1] := -t*w[1]+x*k[1];
                        -5.05 t + 10.5 x
xi[2] := -t*w[2]+x*k[2];
                         -0.5 t + 3.5 x
a := m/sqrt(k[1]^2-w[1]^2);
                          0.2063907138
b := m/sqrt(k[2]^2-w[2]^2);
                          0.5484827558
g := a*(c[2]*cos(a*xi[1])-c[3]*sin(a*xi[1]));
0.2063907138 cos(2.167102495 x) - 0.2063907138 sin(2.167102495 x)
h := c[1]+c[2]*sin(a*xi[1])+c[3]*cos(a*xi[1]);
          1 + sin(2.167102495 x) + cos(2.167102495 x)
G := b*(c[5]*cos(b*xi[2])-c[6]*sin(b*xi[2]));
0.5484827558 cos(1.919689645 x) - 0.5484827558 sin(1.919689645 x)
H := c[4]+c[5]*sin(b*xi[2])+c[6]*cos(b*xi[2]);
          1 + sin(1.919689645 x) + cos(1.919689645 x)
u := A[0]+A[1]*[g/h]+A[2]*[G/H];
  [                     1                                   
  [------------------------------------------- (3.703280398 
  [1 + sin(1.919689645 x) + cos(1.919689645 x)              

    (0.5484827558 cos(1.919689645 x)

     - 0.5484827558 sin(1.919689645 x))) + 

                         1                                   
    ------------------------------------------- (9.841457496 
    1 + sin(2.167102495 x) + cos(2.167102495 x)              

    (0.2063907138 cos(2.167102495 x)

                                        ]
     - 0.2063907138 sin(2.167102495 x)))]
                                        ]
plot3d(Re(u), x = -20 .. .20, t = -20 .. .20);
Error, invalid input: `simpl/Re` expects its 1st argument, x, to be of type {boolean, algebraic}, but received [3.703280398*(.5484827558*cos(1.919689645*x)-.5484827558*sin(1.919689645*x))/(1+sin(1.919689645*x)+cos(1.919689645*x))+9.841457496*(.2063907138*cos(2.167102495*x)-.2063907138*sin(2.167102495*x))/(1+sin(2.167102495*x)+cos(2.167102495*x))]
t := 0;
                               0
plot(u, x = -15 .. 15);

I don't know how to simplify the expression A/B in the worksheet below.  I know that it should simplify to exp(I*Pi/3).  How do I lead Maple to discover that result without telling it the solution ahead of the time?  All variables other than A and B are real.

restart;

local gamma:

A := I*sqrt(3) + 2*c*exp(I*(gamma+(1/3)*Pi)) + 2*a*exp(I*alpha) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) - 1;

I*3^(1/2)+2*c*exp(I*(gamma+(1/3)*Pi))+2*a*exp(I*alpha)-2*a*exp(I*(alpha+(1/3)*Pi))-2*b*exp(I*beta)-1

B := I*sqrt(3) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) + 2*b*exp(I*(beta+(1/3)*Pi)) + 2*c*exp(I*gamma) + 1;

I*3^(1/2)-2*a*exp(I*(alpha+(1/3)*Pi))-2*b*exp(I*beta)+2*b*exp(I*(beta+(1/3)*Pi))+2*c*exp(I*gamma)+1

How to show that A/B = e^((1/3)*i*Pi)?

 

Download mw.mw

How to find the closed formula for the sum of this sequence:

sum = n + n/2 + n/4 + n/8 + ... + 1

If n is 2 in some power, then the sum should be 2*n - 1. How to get this answer using Maple?

can anyone explain to me the  meaning of this result ?trial.mw

Is possible to solve this differential equation by maple?

thaks...

Hello everyone!

I have a vector field defined in spherical coordinates and I want to plot a sphere colored according to the magnitude of the vector field on that sphere. Is there a simple way to do this?

Many thanks in advance!

 

Hello

I wonder how I could use Maple commands to do the following:

An irrational number, ir, (a huge symbolic expression as a result of iterating a discrete map) is converted to single precision (Real16) and then to hexadecimal as a string. Example: using matlab it will be something like single(ir)=0.25(float representation) =3e800000 (hexadecimal representation).

I am not sure if single precision is available in Maple 2017 but I guess Real32, Real64 and Real128 are.

Once the hexadecimal representation is acquired I need to convert it back to Real16, Real 32 and etc.

Your help is much appreciated.

Many thanks

Ed

I am trying element-wise addition of two arrays where one array is Cauchy distribution. but this calculation using much memory. Please help.

 

CAUCHY_DISTRIBUTION.mw

3 4 5 6 7 8 9 Last Page 5 of 1711