acer

32333 Reputation

29 Badges

19 years, 320 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

What matters more is how you process and display the results in the second worksheet, rather than how they are returned from the worksheet which computes them.

Let's suppose that your first worksheet does,

   return [matrix(G), matrix(A), matrix(DR), figplot]

do that it returns a list of the items.

Let's suppose that your are making a call like,

   RunWorksheet(...);

in the second worksheet. You could try making that instead be, say,

   results := RunWorksheet(...):
   map(print, results):

That will print each of the results separately, so that the plot renders with its proper size and the matrices don't interfere with each others lines.

Notice that the command above are termined with full colons.

note: Why use lowercase matrix (instead of modern Matrix) which has been deprecated for 20 years?

note: Plots render small when you print them as part of an expression sequence.

note: A fancier way to do all this would be to use Embedded Components in the second worksheet, or Tabulate. But I guess you don't want to change it all.

There is no point-probe functionality provided by the GUI for 3D plots.

If you want the results to be subsequently accessible as integers then you could cast the result from Statistics:-Sample to a hardware datatype integer Array. (I used integer[8] below because my Maple is 64bit, and that provides for a wide range.)

[edit] On my machine this is just over 4 times faster than Carl's code to apply the trunc command after converting to a list.

It also keeps the Sample output as an rtable (in case the code otherwise expected that). Adjustments would be easy if you wanted it to preserve the rtable subtype, eg. keep Vector[row] as Vector[row], etc.

restart;

Probs := [0.10, 0.30, 0.20, 0.25, 0.15];
Bins  := <50, 60, 70, 80, 90>:

[.10, .30, .20, .25, .15]

fCarl:= (Bins, P::list(realcons), N::posint)->
    (trunc~@[seq]@Statistics:-Sample)(
        Statistics:-RandomVariable(
            'EmpiricalDistribution'(Bins, 'probabilities'= P)
        ),
        N
    )    
:

fCarl(Bins, Probs, 4);

[80, 90, 60, 90]

fac:=proc(Bins, P::list(realcons), N::posint)
  uses Statistics;
  Array(Sample(
    RandomVariable(':-EmpiricalDistribution'(Bins,':-probabilities'=P)),
    N),'datatype'=':-integer[8]');
end proc:

fac(Bins, Probs, 4);

Vector[row](4, {(1) = 80, (2) = 50, (3) = 60, (4) = 70})

n := 10^6:

S3:= CodeTools:-Usage(fCarl(Bins, Probs, n)):

memory used=83.95MiB, alloc change=18.89MiB, cpu time=499.00ms, real time=415.00ms, gc time=173.85ms

S4 := CodeTools:-Usage(fac(Bins, Probs, n)):

memory used=22.90MiB, alloc change=7.63MiB, cpu time=129.00ms, real time=93.00ms, gc time=73.72ms

((u->map(uu->evalf[3](rhs(uu)/n),u))@Statistics:-Tally)~([S||(3..4)]);

[[0.997e-1, .300, .200, .150, .250], [.100, .300, .200, .151, .250]]

 

Download int_sample.mw

(It might be nice if the in-place calling sequence for Sample allowed for such an Array as its second argument. That might save on the extra rtable construction/collection.)

It is not very helpful to show us a mere picture of your code instead of uploading and attaching your actual worksheet to your Question.

Yes, the old (and now deprecated) table-based array and matrix are somewhat more awkward to print in your scenario.

Note that assigning to the names u1, etc, only after creation of the structures that reference them doesn't alter the structures themselves. But you can also access entries, or compute with them, and get the evaluation (resolution).

If you want to get a new structure that both contains as well as prints with the entries fully evaluated then you can map the eval command over the earlier made structure.

Here are some examples to consider, using both matrix and Matrix.

restart;

with(linalg):

ROD:=(cos(phi))*matrix([[1,0,0],[0,1,0],[0,0,1]])
      +((1-cos(phi))*matrix(3,1,[u1,u2,u3])
        &* transpose(matrix(3,1,[u1,u2,u3]))
      +sin(phi)*matrix([[0,-u3,u2],[u3,0,-u1],[-u2,u1,0]]));

ROD := Typesetting[delayDotProduct](cos(phi), Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1}), true)+`&*`(Typesetting[delayDotProduct](1-cos(phi), Matrix(3, 1, {(1, 1) = u1, (2, 1) = u2, (3, 1) = u3}), true), Matrix(1, 3, {(1, 1) = u1, (1, 2) = u2, (1, 3) = u3}))+Typesetting[delayDotProduct](sin(phi), Matrix(3, 3, {(1, 1) = 0, (1, 2) = -u3, (1, 3) = u2, (2, 1) = u3, (2, 2) = 0, (2, 3) = -u1, (3, 1) = -u2, (3, 2) = u1, (3, 3) = 0}), true)

ROD:=evalm(ROD);

ROD := Matrix(3, 3, {(1, 1) = cos(phi)+(1-cos(phi))*u1^2, (1, 2) = (1-cos(phi))*u1*u2-sin(phi)*u3, (1, 3) = (1-cos(phi))*u1*u3+sin(phi)*u2, (2, 1) = (1-cos(phi))*u1*u2+sin(phi)*u3, (2, 2) = cos(phi)+(1-cos(phi))*u2^2, (2, 3) = (1-cos(phi))*u2*u3-sin(phi)*u1, (3, 1) = (1-cos(phi))*u1*u3-sin(phi)*u2, (3, 2) = (1-cos(phi))*u2*u3+sin(phi)*u1, (3, 3) = cos(phi)+(1-cos(phi))*u3^2})

phi:=Pi/4; u1:=1/sqrt(3); u2:=1/sqrt(3); u3:=1/sqrt(3);

(1/4)*Pi

(1/3)*3^(1/2)

(1/3)*3^(1/2)

(1/3)*3^(1/2)

evalm(ROD);

Matrix(3, 3, {(1, 1) = cos(phi)+(1-cos(phi))*u1^2, (1, 2) = (1-cos(phi))*u1*u2-sin(phi)*u3, (1, 3) = (1-cos(phi))*u1*u3+sin(phi)*u2, (2, 1) = (1-cos(phi))*u1*u2+sin(phi)*u3, (2, 2) = cos(phi)+(1-cos(phi))*u2^2, (2, 3) = (1-cos(phi))*u2*u3-sin(phi)*u1, (3, 1) = (1-cos(phi))*u1*u3-sin(phi)*u2, (3, 2) = (1-cos(phi))*u2*u3+sin(phi)*u1, (3, 3) = cos(phi)+(1-cos(phi))*u3^2})

eval(ROD[1,1],1);

cos(phi)+(1-cos(phi))*u1^2

ROD[1,1];

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

eval~(ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

map(eval,ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

evalm(ROD &* matrix([[1,0,0],[0,1,0],[0,0,1]]));

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

restart;

A:=array([u]);

A := Matrix(1, 1, {(1, 1) = u})

T:=table([1=u]);

table( [( 1 ) = u ] )

u:=17;;

17

evalm(A);

Matrix(1, 1, {(1, 1) = u})

map(eval,A);

Matrix(1, 1, {(1, 1) = 17})

eval(T);

table( [( 1 ) = u ] )

map(eval,eval(T));

table( [( 1 ) = 17 ] )

restart;

with(LinearAlgebra):

ROD:=(cos(phi))*Matrix([[1,0,0],[0,1,0],[0,0,1]])
      +((1-cos(phi))*Matrix(3,1,[u1,u2,u3])
        . Transpose(Matrix(3,1,[u1,u2,u3]))
      +sin(phi)*Matrix([[0,-u3,u2],[u3,0,-u1],[-u2,u1,0]]));

Matrix(3, 3, {(1, 1) = cos(phi)+(1-cos(phi))*u1^2, (1, 2) = (1-cos(phi))*u1*u2-sin(phi)*u3, (1, 3) = (1-cos(phi))*u1*u3+sin(phi)*u2, (2, 1) = (1-cos(phi))*u1*u2+sin(phi)*u3, (2, 2) = cos(phi)+(1-cos(phi))*u2^2, (2, 3) = (1-cos(phi))*u2*u3-sin(phi)*u1, (3, 1) = (1-cos(phi))*u1*u3-sin(phi)*u2, (3, 2) = (1-cos(phi))*u2*u3+sin(phi)*u1, (3, 3) = cos(phi)+(1-cos(phi))*u3^2})

phi:=Pi/4; u1:=1/sqrt(3); u2:=1/sqrt(3); u3:=1/sqrt(3);

(1/4)*Pi

(1/3)*3^(1/2)

(1/3)*3^(1/2)

(1/3)*3^(1/2)

ROD;

Matrix(3, 3, {(1, 1) = cos(phi)+(1-cos(phi))*u1^2, (1, 2) = (1-cos(phi))*u1*u2-sin(phi)*u3, (1, 3) = (1-cos(phi))*u1*u3+sin(phi)*u2, (2, 1) = (1-cos(phi))*u1*u2+sin(phi)*u3, (2, 2) = cos(phi)+(1-cos(phi))*u2^2, (2, 3) = (1-cos(phi))*u2*u3-sin(phi)*u1, (3, 1) = (1-cos(phi))*u1*u3-sin(phi)*u2, (3, 2) = (1-cos(phi))*u2*u3+sin(phi)*u1, (3, 3) = cos(phi)+(1-cos(phi))*u3^2})

rtable_eval(ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

eval(ROD[1,1],1);

cos(phi)+(1-cos(phi))*u1^2

ROD[1,1];

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

eval~(ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

map(eval,ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

copy(ROD);

Matrix(3, 3, {(1, 1) = (1/3)*sqrt(2)+1/3, (1, 2) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (1, 3) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 1) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (2, 2) = (1/3)*sqrt(2)+1/3, (2, 3) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 1) = 1/3-(1/6)*sqrt(2)-(1/6)*sqrt(2)*sqrt(3), (3, 2) = 1/3-(1/6)*sqrt(2)+(1/6)*sqrt(2)*sqrt(3), (3, 3) = (1/3)*sqrt(2)+1/3})

 

Download evalm_misc.mw

ps. Don't set Digits to 5. That is a bad idea, and can incur unnecessary roundoff and numeric error. Instead, either keep Digits=10 the default (or raise it) and utilize evalf[5] as a command to print results more tersely.

cos(Pi/4) is a constant.

You need your plotted expression to contain a dependent variable.

But we cannot know what you want... eg.

  cos(x*Pi/4)

  cos(x+Pi/4)

  cos(x/4)

  cos(x)

and so on.

You should try and find a way to test (at least one d value) of the data points for correctness without the integrand being an operator.

Also, I think that a log plot looks more meaningful for this example.

restart;

Omega:=0.01:no:=1:Delta:=0:tau0:=1:c:=0:gamma1:=0:
j:=1:k1:=0:t:=10:xr:=1:Gamma:=0.1:

k:=1:
for i from -20 to 20 do
d[i]:=i:
b:=-gamma1*tau0+I*tau0*Delta-2*a*(k-1)*xr:
a:=1+I*c;
c1:=sqrt(conjugate(a))/tau0:
c2:=0.5*((conjugate(b)/sqrt(conjugate(a)))):
lambda1[i]:=2*(Gamma-I*d[i])*(t-k1)/j+(Gamma-I*d[i])^2:
lambda2[i]:=t*(1-j)*k1/j+1/sqrt(2)*(Gamma-I*d[i]):
lambda3[i]:=c1*(t-k1)/j+c1*(Gamma-I*d[i])+c2:
J1:=sqrt(Pi)/sqrt(2)*(1-erf(lambda2[i])):
J1mod:=(Re(J1))^2+(Im(J1))^2:

g1:=0.5*sqrt(Pi)*tau0*exp(c2^2)
    *exp(-conjugate(a)*((k-1)*xr)^2)/(sqrt(conjugate(a)));

F2[i]:=(-sqrt(2)*Int(unapply(exp(-x^2)*erf(sqrt(2)*c1*x+lambda3[i]),x),
                     -lambda2[i]..100,epsilon=1e-5));

J2:=g1*J1+g1*F2[i];

J2mod:=abs(J2)^2:
f[d[i]]:=J2mod:
end do:

ptsN1 := CodeTools:-Usage(
           [seq([d[i], evalf(f[d[i]])], i = -30 .. 30)]
                         ):

memory used=1.02GiB, alloc change=4.00MiB, cpu time=7.86s, real time=7.87s, gc time=1.21s

plot(ptsN1, color = black, linestyle = solid, thickness = 2,
     color = black, axes = boxed, labelfont = ["HELVETICA", 14],
     axis[2]=[mode=log],
     labels = ["d", "S_M(d)"]);

 

Download MoJalal_ac.mw

The key thing for the speed is to make use operator form for the integrand (but that disables discontinuity checking, so it should be double-checked at at least one value of d).

(If I didn't mess it up, Carl's code could be treated similarly... Mo_Jalal_ac2.mw But check why the plot is not identical.)

You can use PrintToString, concatenate the missing piece, then write the string to a file, then fclose.

For example, with xml being assigned the representation of the XML in Maple (in function-call form),

str:=cat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
         XMLTools:-PrintToString(xml)):
FileTools:-Text:-WriteString("outfile.mw",str):
fclose("outfile.mw");

ps. You can also use fclose after PrintToFile, to handle (only) the closing aspect.

You can choose a file from a popup with Maplets, using the Maplets[Elements][FileDialogue] element.

 

Are you computing as evalf(Eigenvectors(?)) on a Matrix with exact integers. If so then much better would be to apply evalf to the Matrix first, and then call Eigenvectors.

Are you trying to estimate the numeric stability of the eigenvector computation using the ConditionNumber command? That relates to solving linear systems, rather than eigen-computations. Instead, see the EigenConditionNumbers command (and its output=conditionvectors option).

If I recall correctly, you can utilize the output of that EigenConditionNumbers command to estimate the error bounds. (See here and here for background. For "machine epsilon" you could use evalhf(DBL_EPSILON) in the hardware float case of Digits<=15 and 1.0*10^(-Digits) in the software float case.)

For your 18x18 example with random integer entries in -5..5 I am not seeing cases where the eigenvector condition numbers are being computed inaccurately at default Digits=15 (and so it seems to me that those can be used to compute error bounds). If that situation is rare then it's not clear to me what is the nature of your problem.

Why not show us your methodology explicitly, where you are seeing a need to raise working precision high in order to get a good estimate of conditioning? I find your Question to be quite unclear as to what commands you have used.

 

If all you want are results of numeric double-integration then you may not have to wait for a preliminary, partial and time-consuming symbolic integration.

Check that I re-entered the expressions correctly.

Note that I used inert Int instead of active int. You can tell because the integral symbol is gray not black, on the 2D Input. I entered it using command-completion, not the palettes. (I type Int and then the Escape key to get the template popup.)

It computed very quickly.

restart

NULL

Rm := 25*10^(-4)

1/400

Lm := 10^(-3)

1/1000

Ms := 107*10^4

1070000

ICMR := Ms*(Int((z(t)-Z)*((Rm^2+r(t)^2+(z(t)-Z)^2)*(Int(sqrt(1-4*r(t)*Rm*sin(phi)^2/((Rm+r(t))^2+(z(t)-Z)^2)), phi = 0 .. (1/2)*Pi))/((Rm-r(t))^2+(z(t)-Z)^2)-(Int(1/sqrt(1-4*r(t)*Rm*sin(phi)^2/((Rm+r(t))^2+(z(t)-Z)^2)), phi = 0 .. (1/2)*Pi)))/(sqrt((Rm+r(t))^2+(z(t)-Z)^2)*r(t)), Z = -Lm .. 0))/(2*Pi)

evalf(eval(ICMR, [r(t) = 0.24e-2, z(t) = 0.1e-2]))

93045.25340

ICMZ := Ms*(Int((Rm^2-r(t)^2-(z(t)-Z)^2)*(Int(sqrt(1-4*r(t)*Rm*sin(phi)^2/((Rm+r(t))^2+(z(t)-Z)^2)), phi = 0 .. (1/2)*Pi)+Int(1/sqrt(1-4*r(t)*Rm*sin(phi)^2/((Rm+r(t))^2+(z(t)-Z)^2)), phi = 0 .. (1/2)*Pi))/(sqrt((Rm+r(t))^2+(z(t)-Z)^2)*((Rm-r(t))^2+(z(t)-Z)^2)), Z = -Lm .. 0))/(2*Pi)

evalf(eval(ICMZ, [r(t) = 0.24e-2, z(t) = 0.1e-2]))

-93230.69510

 

Download integral_doubt_ac.mw

Here is some experiment on the smaller 12x12 system, with some simplification.

It might give you some ideas.

Problem_2_ac.mw

An important matter is what you intend on doing with the results. It's not clear why you need the large symbolic answers.

When working with such large expressions it's often a good idea to suppress ouput by terminating commands with a full colon. Checking expressions for a moderate size before displaying in the GUI is often a good idea in such situations.

There are other ways.

ps. What might help, if you have other such expressions or sums or products of such and you want a systematic and programmatic approach, is to provide more complicated examples.

restart;

eq1:= (-k*I + 2*I + m)*sqrt(3) - 3*I*m - 3*k;

(-I*k+2*I+m)*3^(1/2)-(3*I)*m-3*k

eq2:=eq1 / 2;

(1/2)*(-I*k+2*I+m)*3^(1/2)-((3/2)*I)*m-(3/2)*k

eq_given:= (-sqrt(3)*I/2 - 3/2)*(k + I*m) + sqrt(3)*I;

(-((1/2)*I)*3^(1/2)-3/2)*(k+I*m)+I*3^(1/2)

# one way, since eq2 is of type `+`

a,o:=selectremove(type,frontend(expand,[eq2]),constant):
`+`(a,`if`(not factor(o)::`*`, o,
           `*`(selectremove(type,factor(o),constant))));

(-((1/2)*I)*3^(1/2)-3/2)*(k+I*m)+I*3^(1/2)

 

Download manip3.mw

I don't think that you've made it clear how you want to characterize your rearrangement of the expression, which makes it tricky to supply an operation that will work for other (as yet unstated) examples.

restart;

eq := W__1 + W__2 = -sin(-beta + alpha)*((H^2 - h^2)*gamma
                    + h^2*psi)/(2*sin(beta)*sin(alpha))

W__1+W__2 = -(1/2)*sin(-beta+alpha)*((H^2-h^2)*gamma+h^2*psi)/(sin(beta)*sin(alpha))

W__1 + W__2 = -H^2*sin(-beta + alpha)*((1 - h^2/H^2)*gamma
              + h^2*psi/H^2)/(2*sin(beta)*sin(alpha));

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

lhs(eq)=collect(numer(rhs(eq)),[sin,gamma],
                u->expand(-u/H^2))/(-denom(rhs(eq))/H^2);

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

dg := degree(coeff(rhs(eq),gamma),H):
lhs(eq)=collect(numer(rhs(eq)),[sin,gamma],
                u->expand(-u/H^dg))/(-denom(rhs(eq))/H^dg);

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

 

Download manipulation.mw

You also need the option,

   adaptive =false

There are several other ways to get the same effect -- using Vectors of the desired length and plotting the data, etc. But you specifically asked about what you needed with the numpoints option for the plot command.

 

restart;

L := {m[4]+4*m[7]+m[10]+m[13]+m[16]+m[19]+m[22] = 2*sqrt(2)+7,
 m[15]+3*m[18]+11*m[21]+m[6]+9*m[12]+2*m[3]-2*sqrt(2)*m[18]+6*sqrt(2)*m[21]
 -4*sqrt(2)*m[12]+m[24] = 2*sqrt(2)+61, -4*sqrt(2)*m[14]+6*m[14]+m[17]
 +11*m[20]+m[2]+4*m[5]+18*m[8]+6*sqrt(2)*m[20]-8*sqrt(2)*m[8]+m[23]
 = 2*sqrt(2)+34, m[27]-2*sqrt(2)*m[19]+4*sqrt(2)*m[7]+2*sqrt(2)*m[13]
 -2*m[16]+m[17]-6*m[19]-4*m[4]+m[5]+m[20]-16*m[7]+4*m[8]+m[11]-4*m[13]
 +m[14] = 6*sqrt(2)-6, m[28]+2*sqrt(2)*m[19]-4*sqrt(2)*m[10]-2*sqrt(2)*m[16]
 +m[15]+2*m[16]+m[18]+2*m[4]+m[6]+6*m[19]+m[21]+4*m[9]+2*m[10]+m[12]-2*m[13]
  = 6*sqrt(2)+21, m[25]+6*sqrt(2)*m[19]-2*sqrt(2)*m[20]-8*sqrt(2)*m[7]
 +4*sqrt(2)*m[8]-4*sqrt(2)*m[13]+2*sqrt(2)*m[14]+6*m[13]-4*m[14]+m[16]
 -2*m[17]+m[1]+4*m[4]+11*m[19]-6*m[20]-4*m[5]+18*m[7]-16*m[8] = 6*sqrt(2)-33,
 m[26]+6*sqrt(2)*m[19]+2*sqrt(2)*m[21]-4*sqrt(2)*m[10]-4*sqrt(2)*m[12]
 -2*sqrt(2)*m[16]-2*sqrt(2)*m[18]+m[13]-2*m[15]+3*m[16]+2*m[18]+2*m[1]
 +11*m[19]+6*m[21]+m[4]+2*m[6]+9*m[10]+2*m[12] = 6*sqrt(2)-33, m[29]
 +2*sqrt(2)*m[18]+6*sqrt(2)*m[20]-12*sqrt(2)*m[21]-2*sqrt(2)*m[3]
 -4*sqrt(2)*m[11]-2*sqrt(2)*m[15]-2*sqrt(2)*m[17]+m[14]+4*m[15]+3*m[17]
 -2*m[18]+2*m[2]+11*m[20]-22*m[21]+m[5]-4*m[6]+9*m[11] = 6*sqrt(2)-6, m[30]
 -12*sqrt(2)*m[20]+6*sqrt(2)*m[21]-2*sqrt(2)*m[2]-8*sqrt(2)*m[9]
 -2*sqrt(2)*m[14]-4*sqrt(2)*m[15]+2*sqrt(2)*m[17]+4*m[14]+6*m[15]-2*m[17]
 +m[18]+m[3]-22*m[20]+11*m[21]-4*m[5]+4*m[6]+18*m[9] = 6*sqrt(2)+21,
 -4*m[4]+2*m[5]+2*m[17]-2*m[18]-22*m[19]+6*m[20]-6*m[21]-2*m[16]-4*m[15]
 +m[31]-4*m[6]-16*m[9]+2*m[11]+4*m[13]-2*m[14]-2*sqrt(2)*m[1]+4*sqrt(2)*m[9]
 -2*sqrt(2)*m[17]-4*sqrt(2)*m[11]+2*sqrt(2)*m[15]+2*sqrt(2)*m[16]
 -12*sqrt(2)*m[19]-2*sqrt(2)*m[13]+2*sqrt(2)*m[20]-2*sqrt(2)*m[21]
 = 12*sqrt(2)-120}:

S:=Optimization:-LPSolve(1,L,map(u->u=0..infinity,
                                 indets(L,And(name,Not(constant))))[])[2];

[m[1] = HFloat(0.0), m[2] = HFloat(0.0), m[3] = HFloat(8.587105682768538), m[4] = HFloat(0.0), m[5] = HFloat(0.0), m[6] = HFloat(0.0), m[7] = HFloat(0.4741422999028716), m[8] = HFloat(1.5038445620830123), m[9] = HFloat(11.133936308498138), m[10] = HFloat(7.931857925134723), m[11] = HFloat(0.0), m[12] = HFloat(13.955184500144961), m[13] = HFloat(0.0), m[14] = HFloat(0.0), m[15] = HFloat(0.0), m[16] = HFloat(0.0), m[17] = HFloat(0.0), m[18] = HFloat(0.0), m[19] = HFloat(0.0), m[20] = HFloat(1.3740260402828706), m[21] = HFloat(0.0), m[22] = HFloat(0.0), m[23] = HFloat(0.0), m[24] = HFloat(0.0), m[25] = HFloat(0.0), m[26] = HFloat(0.0), m[27] = HFloat(0.0), m[28] = HFloat(0.0), m[29] = HFloat(0.0), m[30] = HFloat(0.0), m[31] = HFloat(0.0)]

map(fnormal@abs@evalf[15],map(lhs-rhs,eval(L,S)));

{0.}

 

Download LPSolve_ex.mw

First 112 113 114 115 116 117 118 Last Page 114 of 336