acer

32385 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

As a workaround you could utilize the is command.

restart;

kernelopts(version);

`Maple 2022.0, X86 64 LINUX, Mar 8 2022, Build ID 1599809`

with(Units:-Simple):

alpha := 45*Unit(arcdeg);

45*Units:-Unit(arcdeg)

if is( alpha > 0 ) then ok; else other; end if;

ok

Download unitsineq_is.mw

Here is another way to accomplish the same results, using eval instead of assign.

# Bernard W. Taylor, Quantitative Analysis for Management, 13th edition

# Chapter 6, transportation example 1

restart;

with(Optimization):

X:=Matrix(1..3,1..3,symbol=x);

Matrix(3, 3, {(1, 1) = x[1, 1], (1, 2) = x[1, 2], (1, 3) = x[1, 3], (2, 1) = x[2, 1], (2, 2) = x[2, 2], (2, 3) = x[2, 3], (3, 1) = x[3, 1], (3, 2) = x[3, 2], (3, 3) = x[3, 3]})

Cost:=Matrix(3,3,[6,8,10,7,11,11,4,5,12]);

Matrix(3, 3, {(1, 1) = 6, (1, 2) = 8, (1, 3) = 10, (2, 1) = 7, (2, 2) = 11, (2, 3) = 11, (3, 1) = 4, (3, 2) = 5, (3, 3) = 12})

TotalCost:=add(add(Cost[i,j]*x[i,j],i=1..3),j=1..3);

6*x[1, 1]+7*x[2, 1]+4*x[3, 1]+8*x[1, 2]+11*x[2, 2]+5*x[3, 2]+10*x[1, 3]+11*x[2, 3]+12*x[3, 3]

Demand :=<200,100,300>;

Vector(3, {(1) = 200, (2) = 100, (3) = 300})

DemandGuidelines:= seq(add(x[i,j],i=1..3) =Demand[j], j=1..3);

x[1, 1]+x[2, 1]+x[3, 1] = 200, x[1, 2]+x[2, 2]+x[3, 2] = 100, x[1, 3]+x[2, 3]+x[3, 3] = 300

Production :=<150,175,275>;

Vector(3, {(1) = 150, (2) = 175, (3) = 275})

ProductionGuidelines:= seq(add(x[i,j],j=1..3) = Production[i], i=1..3);

x[1, 1]+x[1, 2]+x[1, 3] = 150, x[2, 1]+x[2, 2]+x[2, 3] = 175, x[3, 1]+x[3, 2]+x[3, 3] = 275

Ans := LPSolve(TotalCost, [DemandGuidelines,ProductionGuidelines], assume={nonnegative, integer});

[4525, [x[1, 1] = 0, x[1, 2] = 0, x[1, 3] = 150, x[2, 1] = 25, x[2, 2] = 0, x[2, 3] = 150, x[3, 1] = 175, x[3, 2] = 100, x[3, 3] = 0]]

eval(X,Ans[2]);

Matrix(3, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 150, (2, 1) = 25, (2, 2) = 0, (2, 3) = 150, (3, 1) = 175, (3, 2) = 100, (3, 3) = 0})

Ans[1],eval(TotalCost,Ans[2]);

4525, 4525

 

Download Q20220416_ac.mw

It is quite often a better way, IMO, especially if you need to continue to use the unassigned names x[i] (or those Cost/TotatCost formulas, etc) symbolically in further computations.

In the above I used a Matrix instead of the deprecated lowercase array structure. If you really insist on using that deprecated array data structure then you can still accomplish the goals using eval instead of assign.  Q20220416_acm.mw

restart;

kernelopts(version)

`Maple 2022.0, X86 64 LINUX, Mar 8 2022, Build ID 1599809`

with(LinearAlgebra):

w := (2*Pi)/14;

(1/7)*Pi

v := Vector([1, sin(w*t), cos(w*t)]);

Vector(3, {(1) = 1, (2) = sin((1/7)*Pi*t), (3) = cos((1/7)*Pi*t)})

ee := simplify(sum(v . (Transpose(v)), t = k .. k + 13));

Matrix(3, 3, {(1, 1) = 14, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 7-cos((2/7)*Pi*k)-cos((2/7)*Pi*(1+k))+sin((1/14)*Pi*(4*k+1))+sin((1/14)*Pi*(4*k+5))+cos((1/7)*Pi*(2*k+1))+cos((1/7)*Pi*(2*k+3))-sin((1/14)*Pi*(4*k+3)), (2, 3) = sin((2/7)*Pi*k)-sin((1/7)*Pi*(2*k+1))+cos((1/14)*Pi*(4*k+5))-cos((1/14)*Pi*(4*k+3))+sin((2/7)*Pi*(1+k))+cos((1/14)*Pi*(4*k+1))-sin((1/7)*Pi*(2*k+3)), (3, 1) = 0, (3, 2) = sin((2/7)*Pi*k)-sin((1/7)*Pi*(2*k+1))+cos((1/14)*Pi*(4*k+5))-cos((1/14)*Pi*(4*k+3))+sin((2/7)*Pi*(1+k))+cos((1/14)*Pi*(4*k+1))-sin((1/7)*Pi*(2*k+3)), (3, 3) = cos((2/7)*Pi*k)+7+cos((2/7)*Pi*(1+k))-sin((1/14)*Pi*(4*k+1))-sin((1/14)*Pi*(4*k+5))-cos((1/7)*Pi*(2*k+1))-cos((1/7)*Pi*(2*k+3))+sin((1/14)*Pi*(4*k+3))})

evala(expand~(convert~(ee,exp)));

Matrix(3, 3, {(1, 1) = 14, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 7, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 7})

Download simp_ex.mw

I will submit a bug report (SCR), that the simplify command itself does not attain this simplification.

Hardware floating-point precision real and complex linear-algebra is mainly accomplished using the Intel MKL, with parallelized BLAS and LAPACK.

That affects many packages, including LinearAlgebra as well as some commands in other packages (ArrayTools, Statistics, Optimization, etc).

You can disable this parallelization with the follow setting of this environment variable in the shell (Operating System shell) in which Maple is launched:

    OMP_NUM_THREADS=1

Similarly, you can restrict that paralellization, eg. setting 8 as its value.

The first example below is to address the OP's requirement, "I want them to appear as vectors when I type them". That is, the over-arrow appears on the input as well as output.

The point of the 2nd example is that the symbol is bold in both input and output.

The 2nd and 3rd examples look more bold in the actual Maple GUI than they do with the worksheet inlined in this forum.

 

For this first example I used the item having Right arrow over as its tooltip, in the Accents palette.

 

`#mover(mi("A"),mo("&rarr;"))`

`#mover(mi("A"),mo("&rarr;"))`

 

For this next example I used the main menubar to make the input bold. Then I selected the character with the mouse-pointer, and then I used the context action from the right-click menu:
    2-D Math -> Convert To -> Atomic Variable

 

`#mi("G",fontweight = "bold")`

`#mi("G",fontweight = "bold")`

 

For this next example I combined both methods above

 

`#mover(mi("H",fontweight = "bold"),mo("&rarr;",fontweight = "bold"))`

`#mover(mi("H",fontweight = "bold"),mo("&rarr;",fontweight = "bold"))`

Download accents_bold_atomic_var.mw

Your computation can be done more quickly using the Quantile command. The purely numeric approach (first below) doesn't quite match to all digits.

restart;

with(Statistics):

Digits := 30:

alpha := 10:

beta := 100000:

CodeTools:-Usage(Quantile(BetaDistribution(alpha, beta), 0.1));

memory used=9.04MiB, alloc change=33.00MiB, cpu time=93.00ms, real time=93.00ms, gc time=4.95ms

0.622083116140586301765952331883e-4

restart;

with(Statistics):

Digits := 30:

alpha := 10:

beta := 100000:

CodeTools:-Usage(simplify(evalf(Quantile(BetaDistribution(alpha, beta), 1/10)),zero));

memory used=19.95MiB, alloc change=35.01MiB, cpu time=221.00ms, real time=222.00ms, gc time=25.92ms

0.622083116140586301765952177817e-4

Download test_fsolve_integ_ac22.mw

As for computing it by numerically integrating the PDF, here is one way to adjust your original, using the inert Int(...) instead of the active int(...) as you had it, along with operator form calling sequences.

It's important to not use the active int and let it attempt int(f(x),x=0..y) for symbolic name y.

restart

Digits := 30

30

with(plots)with(Statistics)

NULL

say the f(x) is a Beta with parameters alpha and beta

 

alpha := 10

10

beta := 100000

100000

"f(x):=PDF(BetaDistribution(alpha,beta),x)"

proc (x) options operator, arrow, function_assign; Statistics:-PDF(BetaDistribution(alpha, beta), x) end proc

f(x)

piecewise(x < 0, 0, x < 1, x^9*(1-x)^99999/Beta(10, 100000), 0)

NULL

semilogplot(f(x), x = 0 .. 1)

fsolve(proc (y) options operator, arrow; Int(f, 0 .. y)-.1 end proc, 0 .. 0.1e-3)

0.622083116140586301765952177817e-4

plot(Int(f, 0 .. y, epsilon = 0.1e-5)-.1, y = 0 .. 0.1e-2, size = [500, 200])

NULL

Download test_fsolve_integ_ac.mw

That is reasonably quick, but even this can be done quicker, by unapplying the explicit symbolic PDF result, so that it doesn't have to call PDF for each point, while integrating. (Interestingly adding the numeric option to an unevaluated PDF call doesn't seem to help here.) Ie,

restart;

with(Statistics):

Digits := 30:

alpha := 10:

beta := 100000:

f := unapply(PDF(BetaDistribution(alpha, beta), x), x);

proc (x) options operator, arrow; piecewise(x < 0, 0, x < 1, x^9*(1-x)^99999/Beta(10, 100000), 0) end proc

CodeTools:-Usage(fsolve(y -> Int(f, 0 .. y) - 0.1, 0. .. 0.0001))

memory used=306.13MiB, alloc change=68.00MiB, cpu time=2.47s, real time=2.39s, gc time=291.03ms

0.622083116140586301765952177817e-4

Download test_fsolve_integ_ac2.mw

The numeric integration of the PDF can also be done using the CDF command.

restart;

with(Statistics):

Digits := 30:

alpha := 10:

beta := 100000:

CodeTools:-Usage(fsolve(y -> CDF(BetaDistribution(alpha, beta), y) - 0.1, 0. .. 0.0001))

memory used=13.15MiB, alloc change=35.01MiB, cpu time=102.00ms, real time=103.00ms, gc time=6.93ms

0.622083116140586301765952177817e-4

Download test_fsolve_integ_ac3.mw

This regression in behavior is a bug, I think. (I will submit a report.) It is a problematic change in one aspect of the behavior of the Histogram command.

Here is a very simple solution to handle your example, requiring only a wrapping call to plots:-display.

with(Statistics):
X := RandomVariable(Normal(1, 2)):
w := Sample(X, 1000):
plots:-display(Histogram(w), legend = "data set 1");

Below I edit the Histogram procedure's parameter/option specification, to get the original legend functionality back, to cover this example more directly.

If the following works for you then you might consider temporarily adding the redefinition part to an initialization file. That would allow you to utilize Histogram directly and straightforwardly, as in Maple 2021, etc.

restart;

if convert(kernelopts(':-version'),string)[1..13]="Maple 2022.0," then
  unprotect(Statistics:-Histogram):
  __foo := ToInert(eval(Statistics:-Histogram)):
  Statistics:-Histogram:=
  FromInert(subsop([1]=subs(_Inert_ASSIGN(_Inert_DCOLON(_Inert_NAME("legend"), _Inert_NAME("list", _Inert_ATTRIBUTE(_Inert_NAME("protected", _Inert_ATTRIBUTE(_Inert_NAME("protected")))))), _Inert_UNEVAL(_Inert_NAME("NoUserValue")))=
_Inert_ASSIGN(_Inert_DCOLON(_Inert_NAME("legend"), _Inert_NAME("anything", _Inert_ATTRIBUTE(_Inert_NAME("protected", _Inert_ATTRIBUTE(_Inert_NAME("protected")))))), _Inert_UNEVAL(_Inert_NAME("NoUserValue"))),op([1],__foo)),
       __foo)):
  protect(Statistics:-Histogram):
end if:

with(Statistics):

X := RandomVariable(Normal(1, 2)):

w := Sample(X, 1000):

Histogram(w, legend = "data set 1");

Download Histogram_legend_M2022.0_ac.mw

One kludgie approach is to use either the `caption` or `title` option instead of `legend`, but that doesn't automatically get the colored rectangle. It also doesn't merge properly if you display a few of them together. So IMO this is an inferior alternative for the behaviour you want. But the behavior you want is fully reasonable.

Are you allowed a wider range than your specified lw..up = 0.01..10 ?

After correcting the syntax problems with multiplication that Preben mentioned, I go the following.

Notice that these solutions all seem to be permutations involving the same numeric values -- with some entries lying outside your specified range 0.01..10 .

restart

Digits := 15

15

eq1 := C1*C2*C3*C4*(C1*R2*R3*R4+C2*R1*R3*R4+C3*R1*R2*R4+C4*R1*R2*R3) = 84

C1*C2*C3*C4*(C1*R2*R3*R4+C2*R1*R3*R4+C3*R1*R2*R4+C4*R1*R2*R3) = 84

eq2 := C1*C2*C3*C4*(C1*C2*R3*R4+C1*C3*R2*R4+C1*C4*R2*R3+C2*C3*R1*R4+C2*C4*R1*R3+C3*C4*R1*R2) = 126

eq3 := C1*C2*C3*C4*(C1*C2*C3*R4+C1*C2*C4*R3+C1*C3*C4*R2+C2*C3*C4*R1) = 36

C1*C2*C3*C4*(C1*C2*C3*R4+C1*C2*C4*R3+C1*C3*C4*R2+C2*C3*C4*R1) = 36

eq4 := -C1*C2*C3*C4*R1*R2*R3*R4*Rin+C1^2*C2^2*C3^2*C4^2 = 0

-C1*C2*C3*C4*R1*R2*R3*R4*Rin+C1^2*C2^2*C3^2*C4^2 = 0

eq5 := C1*C2*C3*C4*(C1*C2*C3*R4+C1*C2*C4*R3+C1*C3*C4*R2+C2*C3*C4*R1)-Rin*C1^2*C2*C3*C4*R2*R3*R4-C1*C2^2*C3*C4*R1*R3*R4*Rin-C1*C2*C3^2*C4*R1*R2*R4*Rin-C1*C2*C3*C4^2*R1*R2*R3*R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^2*R1*R2-C2^2*C3^2*C4*R1*R4-C2^2*C3*C4^2*R1*R3-C2*C3^2*C4^2*R1*R2 = 0

eq8 := -C1^2*C2^2*C3^2*C4^2*Rin+C1*C2*C3*C4*R1*R2*R3*R4-C1^2*C2^2*C3^2*R4-C1^2*C2^2*C4^2*R3-C1^2*C3^2*C4^2*R2-C2^2*C3^2*C4^2*R1 = 0

-C1^2*C2^2*C3^2*C4^2*Rin+C1*C2*C3*C4*R1*R2*R3*R4-C1^2*C2^2*C3^2*R4-C1^2*C2^2*C4^2*R3-C1^2*C3^2*C4^2*R2-C2^2*C3^2*C4^2*R1 = 0

eq9 := Rin = 1/9

Rin = 1/9

sols := RootFinding:-Isolate(map(lhs-rhs, eval({eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8}, Rin = 1/9)), [C1, C2, C3, C4, R1, R2, R3, R4])

[[C1 = 1.95937461672451, C2 = .172679482070816, C3 = -.220096341167652, C4 = -17.7202684308214, R1 = 32.2352049784925, R2 = 0.722281342524200e-1, R3 = -0.841327317752949e-1, R4 = -60.6292254933928], [C1 = 1.95937461672451, C2 = -.220096341167652, C3 = .172679482070816, C4 = -17.7202684308214, R1 = 32.2352049784925, R2 = -0.841327317752949e-1, R3 = 0.722281342524200e-1, R4 = -60.6292254933928], [C1 = .172679482070816, C2 = 1.95937461672451, C3 = -.220096341167652, C4 = -17.7202684308214, R1 = 0.722281342524200e-1, R2 = 32.2352049784925, R3 = -0.841327317752949e-1, R4 = -60.6292254933928], [C1 = -.220096341167652, C2 = 1.95937461672451, C3 = .172679482070816, C4 = -17.7202684308214, R1 = -0.841327317752949e-1, R2 = 32.2352049784925, R3 = 0.722281342524200e-1, R4 = -60.6292254933928], [C1 = .172679482070816, C2 = -.220096341167652, C3 = 1.95937461672451, C4 = -17.7202684308214, R1 = 0.722281342524200e-1, R2 = -0.841327317752949e-1, R3 = 32.2352049784925, R4 = -60.6292254933928], [C1 = -.220096341167652, C2 = .172679482070816, C3 = 1.95937461672451, C4 = -17.7202684308214, R1 = -0.841327317752949e-1, R2 = 0.722281342524200e-1, R3 = 32.2352049784925, R4 = -60.6292254933928], [C1 = 1.95937461672451, C2 = .172679482070816, C3 = -17.7202684308214, C4 = -.220096341167652, R1 = 32.2352049784925, R2 = 0.722281342524200e-1, R3 = -60.6292254933928, R4 = -0.841327317752949e-1], [C1 = 1.95937461672451, C2 = -.220096341167652, C3 = -17.7202684308214, C4 = .172679482070816, R1 = 32.2352049784925, R2 = -0.841327317752949e-1, R3 = -60.6292254933928, R4 = 0.722281342524200e-1], [C1 = .172679482070816, C2 = 1.95937461672451, C3 = -17.7202684308214, C4 = -.220096341167652, R1 = 0.722281342524200e-1, R2 = 32.2352049784925, R3 = -60.6292254933928, R4 = -0.841327317752949e-1], [C1 = -.220096341167652, C2 = 1.95937461672451, C3 = -17.7202684308214, C4 = .172679482070816, R1 = -0.841327317752949e-1, R2 = 32.2352049784925, R3 = -60.6292254933928, R4 = 0.722281342524200e-1], [C1 = 1.95937461672451, C2 = -17.7202684308214, C3 = .172679482070816, C4 = -.220096341167652, R1 = 32.2352049784925, R2 = -60.6292254933928, R3 = 0.722281342524200e-1, R4 = -0.841327317752949e-1], [C1 = 1.95937461672451, C2 = -17.7202684308214, C3 = -.220096341167652, C4 = .172679482070816, R1 = 32.2352049784925, R2 = -60.6292254933928, R3 = -0.841327317752949e-1, R4 = 0.722281342524200e-1], [C1 = -17.7202684308214, C2 = 1.95937461672451, C3 = .172679482070816, C4 = -.220096341167652, R1 = -60.6292254933928, R2 = 32.2352049784925, R3 = 0.722281342524200e-1, R4 = -0.841327317752949e-1], [C1 = -17.7202684308214, C2 = 1.95937461672451, C3 = -.220096341167652, C4 = .172679482070816, R1 = -60.6292254933928, R2 = 32.2352049784925, R3 = -0.841327317752949e-1, R4 = 0.722281342524200e-1], [C1 = .172679482070816, C2 = -17.7202684308214, C3 = 1.95937461672451, C4 = -.220096341167652, R1 = 0.722281342524200e-1, R2 = -60.6292254933928, R3 = 32.2352049784925, R4 = -0.841327317752949e-1], [C1 = -.220096341167652, C2 = -17.7202684308214, C3 = 1.95937461672451, C4 = .172679482070816, R1 = -0.841327317752949e-1, R2 = -60.6292254933928, R3 = 32.2352049784925, R4 = 0.722281342524200e-1], [C1 = .172679482070816, C2 = -.220096341167652, C3 = -17.7202684308214, C4 = 1.95937461672451, R1 = 0.722281342524200e-1, R2 = -0.841327317752949e-1, R3 = -60.6292254933928, R4 = 32.2352049784925], [C1 = -.220096341167652, C2 = .172679482070816, C3 = -17.7202684308214, C4 = 1.95937461672451, R1 = -0.841327317752949e-1, R2 = 0.722281342524200e-1, R3 = -60.6292254933928, R4 = 32.2352049784925], [C1 = -17.7202684308214, C2 = .172679482070816, C3 = 1.95937461672451, C4 = -.220096341167652, R1 = -60.6292254933928, R2 = 0.722281342524200e-1, R3 = 32.2352049784925, R4 = -0.841327317752949e-1], [C1 = -17.7202684308214, C2 = -.220096341167652, C3 = 1.95937461672451, C4 = .172679482070816, R1 = -60.6292254933928, R2 = -0.841327317752949e-1, R3 = 32.2352049784925, R4 = 0.722281342524200e-1], [C1 = .172679482070816, C2 = -17.7202684308214, C3 = -.220096341167652, C4 = 1.95937461672451, R1 = 0.722281342524200e-1, R2 = -60.6292254933928, R3 = -0.841327317752949e-1, R4 = 32.2352049784925], [C1 = -.220096341167652, C2 = -17.7202684308214, C3 = .172679482070816, C4 = 1.95937461672451, R1 = -0.841327317752949e-1, R2 = -60.6292254933928, R3 = 0.722281342524200e-1, R4 = 32.2352049784925], [C1 = -17.7202684308214, C2 = .172679482070816, C3 = -.220096341167652, C4 = 1.95937461672451, R1 = -60.6292254933928, R2 = 0.722281342524200e-1, R3 = -0.841327317752949e-1, R4 = 32.2352049784925], [C1 = -17.7202684308214, C2 = -.220096341167652, C3 = .172679482070816, C4 = 1.95937461672451, R1 = -60.6292254933928, R2 = -0.841327317752949e-1, R3 = 0.722281342524200e-1, R4 = 32.2352049784925]]

map(proc (s) options operator, arrow; {map(rhs, s)[]} end proc, {sols[]})

{{-60.6292254933928, -17.7202684308214, -.220096341167652, -0.841327317752949e-1, 0.722281342524200e-1, .172679482070816, 1.95937461672451, 32.2352049784925}}

NULL

Download eqs_sys_iso.mw

You can wrap the result from seq in square brackets, in order to make a list from the sequence of numbers.

  L := [seq(a(n), n = 1 .. 100)];
  plots:-listplot(L);

 

Do you mean like this?

seq([seq([a[i,j],b[(j-1)*3+i]],i=1..3)], j=1..3);

   [[a[1, 1], b[1]], [a[2, 1], b[2]], [a[3, 1], b[3]]],

   [[a[1, 2], b[4]], [a[2, 2], b[5]], [a[3, 2], b[6]]],

   [[a[1, 3], b[7]], [a[2, 3], b[8]], [a[3, 3], b[9]]]

Or, if with slightly different bracketing,

seq(seq([a[i,j],b[(j-1)*3+i]],i=1..3), j=1..3);

   [a[1, 1], b[1]], [a[2, 1], b[2]], [a[3, 1], b[3]],
   [a[1, 2], b[4]], [a[2, 2], b[5]], [a[3, 2], b[6]],
   [a[1, 3], b[7]], [a[2, 3], b[8]], [a[3, 3], b[9]]

This runs in Maple 18.02 (since your Questions are usually restricted to that old version).

restart;

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

H := a__1*exp(I*(-Omega*t+k*x+z*k[1]))
     +a__2*exp(-I*(-Omega*t+k*x+z*k[1]));

a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))

expr := I*(diff(H, z))+diff(H, x, x)+diff(H, t, t)
        +R*(H+conjugate(H))+R^2*(H+conjugate(H))*H;

I*(I*a__1*k[1]*exp(I*(-Omega*t+k*x+z*k[1]))-I*a__2*k[1]*exp(-I*(-Omega*t+k*x+z*k[1])))-a__1*k^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*k^2*exp(-I*(-Omega*t+k*x+z*k[1]))-a__1*Omega^2*exp(I*(-Omega*t+k*x+z*k[1]))-a__2*Omega^2*exp(-I*(-Omega*t+k*x+z*k[1]))+R*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))+R^2*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))+conjugate(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1]))))*(a__1*exp(I*(-Omega*t+k*x+z*k[1]))+a__2*exp(-I*(-Omega*t+k*x+z*k[1])))

expr2 := subs(-Omega*t+k*x+z*k[1]=W(x),expr):

collect(simplify(convert(evalc(expr2),exp)),exp,u->simplify(u,size)):

subs(W(x)=-Omega*t+k*x+z*k[1],subsindets(%,specfunc(exp),expand)):
ans:=subsindets(%,And(specfunc(exp)^(integer),
                       satisfies(u->op(2,u)<0)),
                u->exp(-op([1,..],u))^abs(op(2,u)));

R^2*a__2*(a__1+a__2)*(exp(-I*(-Omega*t+k*x+z*k[1])))^2+((-Omega^2-k^2+R+k[1])*a__2+R*a__1)*exp(-I*(-Omega*t+k*x+z*k[1]))+((-Omega^2-k^2+R-k[1])*a__1+R*a__2)*exp(I*(-Omega*t+k*x+z*k[1]))+R^2*a__1*(a__1+a__2)*(exp(I*(-Omega*t+k*x+z*k[1])))^2+R^2*(a__1+a__2)^2

simplify(evalc(ans-expr));

0

Download collect_exp2_18.mw

In the above code the term
   exp(-I*(-Omega*t+k*x+z*k[1]))
is deliberately kept as you gave it, ie. not turned into
   exp(I*(Omega*t-k*x-z*k[1]))
or
   1/exp(I*(-Omega*t+k*x+z*k[1]))

And similarly for the other exp call.

Also, a term like
   exp(-I*(-Omega*t+k*x+z*k[1]))^2
is deliberately kept as is, and not turned into
   exp(-2*I*(-Omega*t+k*x+z*k[1]))

You have not informed us as to which variables are to be considered as purely real. So I am guessing that all the indeterminates can be taken as purely real. You originally omitted similar information in another of your recent Questions. This is not helpful.

You asked why your loop approach cannot be replaced with seq.

So I will show you how your seq attempt can be easily adjusted to work, using the prefix form of `+=`.

Using your N, V, and sumidx,

roll:=rand(1..9):
N := sort([seq(seq(10*(2+jdx)+roll(),jdx=1..5),idx=1..10)]):
V := 10*seq(roll()+10*trunc(N[idx]/10),idx=1..nops(N)):
sumidx := [seq(floor(N[idx]/10)-2,idx=1..nops(N))];

You can now proceed with,

S := 0 *~convert(convert(trunc~(N/10),set),list):
seq(`+=`(S[ sumidx[idx] ],V[idx]), idx=1..nops(N)):
S;

     [3420, 4570, 5480, 6620, 7320]

which agrees with your loop approach,

S := 0 *~convert(convert(trunc~(N/10),set),list):
for idx to nops(sumidx) do
    S[ sumidx[idx] ] += V[idx]:
end do:
S;

     [3420, 4570, 5480, 6620, 7320]

A slightly wider pair of ranges for the parameters (along with a restricted vertical view) can help avoid the impression that the two surfaces are equal along a certain direction.

You can also play around with the stylistic effects.

plot3d([exp(t^2+10*u-1), -121+22*t+10*u, [[11, -12, 1]]],
       t=8..12, u=-15..-6, view=-50..50,
       color=[grey,green,red], style=[patch,surface,point],
       symbol=solidcircle, symbolsize=10,
       lightmodel=Light2, transparency=[0.4,0.0,0.0]);

It can get tricky finding a decent view, since a wider range (ie. larger t) alongside the restricted view can cause the GUI's plot render to fail to show one of the surfaces.

Here is one way to avoid calls to TF from happening (prematurely), ie. unless its arguments are not all of type realcons.

restart;

TF := proc(x, x0, L, k, alpha_0, alpha_L)
  if not [args]::list(realcons) then
    return 'procname'(args);
  end if;
  if x0 <= x then
    (abs(cos(k*(x - L) - alpha_L)
    *cos(k*x0 + alpha_0)/(cos(alpha_L)*cos(k*x0 + alpha_0))));
  else
    (abs(cos(k*(x0 - L) - alpha_L)
    *cos(k*x + alpha_0)/(cos(alpha_L)*cos(k*x0 + alpha_0))));
  end if;
end proc:

Optimization:-Minimize(TF(x, 0, 0.03, 55.11566060, Pi/2, Pi/4), x = 0 .. 0.03);

[HFloat(4.281548719743726e-7), [x = HFloat(0.015749994509751696)]]

plot(TF(x, 0, 0.03, 55.11566060, Pi/2, Pi/4), x = 0 .. 0.03, size=[500,300]);

Download Min_ex.mw

Here are some ideas, which you should be able to adjust.

I find that for animations of compound plots it's useful to create a procedure (below, F) which can be used to quickly generate and test each frame -- calling it with only a value for the animating parameter. Eg,  F(0.5) etc.

Then you can more quickly adjust that procedure, as needed.

And then the call to plots:-animate is very simple as a last step.

restart;

f1 := x->a*x^2:
f2 := x->a*x^2 + 0.3:

expr1 := f1(x);
expr2 := f2(x);

a*x^2

a*x^2+.3

F := proc(A) local x1,x2,y1,y2;
  uses plots:
  x1,x2 := 1.0, A/2;
  y1 := eval(expr1,[a=A, x=x1]);
  y2 := eval(expr2,[a=A, x=x2]);
  display(
    plot(eval([expr1, expr2],a=A), x=-1 .. 1,
         'color'=["Green","Red"], 'thickness'=3),
    pointplot([[x1,y1], [x2,y2]],
              'symbolsize'=15, 'color'=["Green","Red"]),
    textplot([[x1, y1, sprintf("f1(1.0)=%.4f", y1)],
              [x2, y2, sprintf("f2(a/2)=%.4f", y2)]],
             'align'=[':-below',':-right']));
end proc:

 

plots:-animate(F, [a], a = 0.2 .. 1.2);

 

Download plotting_anim_textplot.mw

First 70 71 72 73 74 75 76 Last Page 72 of 336