acer

32747 Reputation

29 Badges

20 years, 112 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

There are lots of slight variations that can produce this. Here is another below, which happens to not require using op to yank out the first frame of the spacecurve animation.

You could also generate a 3D line-segment using just two end-points, rather than a spacecurve with its default number of data points.

You might be interested to know that the thickness=2 option you had in your second call to animate is eventually affecting most of the structures. It clobbers the thickness=3 you had on the spacecurve, and even affects the plane. This is because you have it as an option to the animate command itself, rather than as one of the arguments to the plotting command (which appear inside the brackets, the second argument passed to animate).

You could also use spacecurve instead of plot3d for the helix, and then pick up the color=red option which you seemed to be wanting(?) there. This also makes a smaller memory footprint. The "size" of animation structures in Maple can often affect GUI, or export, time performance, so I thought you might like to know.

restart;
with(VectorCalculus): with(Student[LinearAlgebra]): with(plots):

v[i] := 145000: thetabn := (1/8)*Pi: thetavn := (1/6)*Pi: k := 10: omegac := .5:
lrange := 6*Pi: v[b] := cos(2*thetabn)/cos(thetabn):
v[g] := sin(2*thetabn)/cos(thetabn): n := `<,>`(k*cos(thetabn), k*sin(thetabn), 0):
vr := [v[b]*t, v[g]*sin(omegac*t)/omegac, v[g]*cos(omegac*t)/omegac]:
lambda := v[i]*cos(thetavn)/cos(thetabn):

pt := [t, 0, v[g]/omegac]:
pline := A -> display(plottools:-line(eval(pt,t=lrange), eval(pt,t=A),
                      thickness = 3)):

shockplot := PlanePlot(n, caption = "",
                       planeoptions = [colour = blue, transparency = .5],
                       normaloptions = [shape = cylindrical_arrow, colour = red]):
t1 := textplot3d([k*cos(thetabn), k*sin(thetabn), 0, 'n'], align = above):
B := animate(pline, [A], A = lrange .. 0, paraminfo = false,
             background = display(shockplot, t1)):
C := animate(spacecurve, [[v[b]*t, v[g]*sin(omegac*t)/omegac,
                           v[g]*cos(omegac*t)/omegac],
                          t = 0 .. x, colour = red, thickness = 2],
             x = 0 .. lrange, paraminfo = false, labels = [" ", zeta, xi],
             background = display(shockplot, t1, pline(0))):

display([B, C], insequence,
        axes=none, orientation=[-158,-17,0], scaling=constrained);

 

There appear to be infinitely many solutions in the set determined just by {c11=-1. c9,c3=-1.,c5=-1. c7,omega=0} .

So, as long as you make c11, c3, c5, and omega respect that, then you could make the remaining variables take on whatever scalar values you want.

NULL

restart

eq(1) := 1+c(3)+c(5)+c(7)+c(9)+c(11) = 0

eq(2) := 1.0379456*c(2)*(omega^2)^(1/4)+1.0379456*c(4)*(omega^2)^(1/4)+.89185524*c(6)*(omega^2)^(1/4)+.89185524*c(8)*(omega^2)^(1/4)+1.0379456*c(10)*(omega^2)^(1/4)+1.0379456*c(12)*(omega^2)^(1/4) = 0

eq(3) := 1.1182111*(omega^2)^(3/4)*sin(.27713148*(omega^2)^(1/4))-1.1182111*c(2)*(omega^2)^(3/4)*cos(.27713148*(omega^2)^(1/4))+1.1182111*c(3)*(omega^2)^(3/4)*sinh(.27713148*(omega^2)^(1/4))+1.1182111*c(4)*(omega^2)^(3/4)*cosh(.27713148*(omega^2)^(1/4))+.70938680*c(5)*(omega^2)^(3/4)*sin(.23812535*(omega^2)^(1/4))-.70938680*c(6)*(omega^2)^(3/4)*cos(.23812535*(omega^2)^(1/4))+.70938680*c(7)*(omega^2)^(3/4)*sinh(.23812535*(omega^2)^(1/4))+.70938680*c(8)*(omega^2)^(3/4)*cosh(.23812535*(omega^2)^(1/4))+1.1182111*c(9)*(omega^2)^(3/4)*sin(.27713148*(omega^2)^(1/4))-1.1182111*c(10)*(omega^2)^(3/4)*cos(.27713148*(omega^2)^(1/4))+1.1182111*c(11)*(omega^2)^(3/4)*sinh(.27713148*(omega^2)^(1/4))+1.1182111*c(12)*(omega^2)^(3/4)*cosh(.27713148*(omega^2)^(1/4))+.20600541*omega^2*(cos(.27713148*(omega^2)^(1/4))+c(2)*sin(.27713148*(omega^2)^(1/4))+c(3)*cosh(.27713148*(omega^2)^(1/4))+c(4)*sinh(.27713148*(omega^2)^(1/4))+c(5)*cos(.23812535*(omega^2)^(1/4))+c(6)*sin(.23812535*(omega^2)^(1/4))+c(7)*cosh(.23812535*(omega^2)^(1/4))+c(8)*sinh(.23812535*(omega^2)^(1/4))+c(9)*cos(.27713148*(omega^2)^(1/4))+c(10)*sin(.27713148*(omega^2)^(1/4))+c(11)*cosh(.27713148*(omega^2)^(1/4))+c(12)*sinh(.27713148*(omega^2)^(1/4))-0.10275662e-1*(omega^2)^(1/4)*sin(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(2)*(omega^2)^(1/4)*cos(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(3)*(omega^2)^(1/4)*sinh(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(4)*(omega^2)^(1/4)*cosh(.27713148*(omega^2)^(1/4))-0.88293670e-2*c(5)*(omega^2)^(1/4)*sin(.23812535*(omega^2)^(1/4))+0.88293670e-2*c(6)*(omega^2)^(1/4)*cos(.23812535*(omega^2)^(1/4))+0.88293670e-2*c(7)*(omega^2)^(1/4)*sinh(.23812535*(omega^2)^(1/4))+0.88293670e-2*c(8)*(omega^2)^(1/4)*cosh(.23812535*(omega^2)^(1/4))-0.10275662e-1*c(9)*(omega^2)^(1/4)*sin(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(10)*(omega^2)^(1/4)*cos(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(11)*(omega^2)^(1/4)*sinh(.27713148*(omega^2)^(1/4))+0.10275662e-1*c(12)*(omega^2)^(1/4)*cosh(.27713148*(omega^2)^(1/4))) = 0

eq(4) := 1.1182111*(omega^2)^(3/4)*sin(.27713148*(omega^2)^(1/4))-1.1182111*c(2)*(omega^2)^(3/4)*cos(.27713148*(omega^2)^(1/4))+1.1182111*c(3)*(omega^2)^(3/4)*sinh(.27713148*(omega^2)^(1/4))+1.1182111*c(4)*(omega^2)^(3/4)*cosh(.27713148*(omega^2)^(1/4))+.70938680*c(5)*(omega^2)^(3/4)*sin(.23812535*(omega^2)^(1/4))-.70938680*c(6)*(omega^2)^(3/4)*cos(.23812535*(omega^2)^(1/4))+.70938680*c(7)*(omega^2)^(3/4)*sinh(.23812535*(omega^2)^(1/4))+.70938680*c(8)*(omega^2)^(3/4)*cosh(.23812535*(omega^2)^(1/4))+1.1182111*c(9)*(omega^2)^(3/4)*sin(.27713148*(omega^2)^(1/4))-1.1182111*c(10)*(omega^2)^(3/4)*cos(.27713148*(omega^2)^(1/4))+1.1182111*c(11)*(omega^2)^(3/4)*sinh(.27713148*(omega^2)^(1/4))+1.1182111*c(12)*(omega^2)^(3/4)*cosh(.27713148*(omega^2)^(1/4))-.20600541*omega^2*(-0.79735630e-1*(omega^2)^(1/4)*sin(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(2)*(omega^2)^(1/4)*cos(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(3)*(omega^2)^(1/4)*sinh(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(4)*(omega^2)^(1/4)*cosh(.27713148*(omega^2)^(1/4))-0.68512877e-1*c(5)*(omega^2)^(1/4)*sin(.23812535*(omega^2)^(1/4))+0.68512877e-1*c(6)*(omega^2)^(1/4)*cos(.23812535*(omega^2)^(1/4))+0.68512877e-1*c(7)*(omega^2)^(1/4)*sinh(.23812535*(omega^2)^(1/4))+0.68512877e-1*c(8)*(omega^2)^(1/4)*cosh(.23812535*(omega^2)^(1/4))-0.79735630e-1*c(9)*(omega^2)^(1/4)*sin(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(10)*(omega^2)^(1/4)*cos(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(11)*(omega^2)^(1/4)*sinh(.27713148*(omega^2)^(1/4))+0.79735630e-1*c(12)*(omega^2)^(1/4)*cosh(.27713148*(omega^2)^(1/4))+0.99000000e-2*cos(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(2)*sin(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(3)*cosh(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(4)*sinh(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(5)*cos(.23812535*(omega^2)^(1/4))+0.99000000e-2*c(6)*sin(.23812535*(omega^2)^(1/4))+0.99000000e-2*c(7)*cosh(.23812535*(omega^2)^(1/4))+0.99000000e-2*c(8)*sinh(.23812535*(omega^2)^(1/4))+0.99000000e-2*c(9)*cos(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(10)*sin(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(11)*cosh(.27713148*(omega^2)^(1/4))+0.99000000e-2*c(12)*sinh(.27713148*(omega^2)^(1/4))) = 0

eq(5) := cos(0.51897280e-3*(omega^2)^(1/4))+c(2)*sin(0.51897280e-3*(omega^2)^(1/4))+c(3)*cosh(0.51897280e-3*(omega^2)^(1/4))+c(4)*sinh(0.51897280e-3*(omega^2)^(1/4)) = c(5)*cos(0.44592762e-3*(omega^2)^(1/4))+c(6)*sin(0.44592762e-3*(omega^2)^(1/4))+c(7)*cosh(0.44592762e-3*(omega^2)^(1/4))+c(8)*sinh(0.44592762e-3*(omega^2)^(1/4))

eq(6) := -1.0379456*(omega^2)^(1/4)*sin(0.51897280e-3*(omega^2)^(1/4))+1.0379456*c(2)*(omega^2)^(1/4)*cos(0.51897280e-3*(omega^2)^(1/4))+1.0379456*c(3)*(omega^2)^(1/4)*sinh(0.51897280e-3*(omega^2)^(1/4))+1.0379456*c(4)*(omega^2)^(1/4)*cosh(0.51897280e-3*(omega^2)^(1/4)) = -.89185524*c(5)*(omega^2)^(1/4)*sin(0.44592762e-3*(omega^2)^(1/4))+.89185524*c(6)*(omega^2)^(1/4)*cos(0.44592762e-3*(omega^2)^(1/4))+.89185524*c(7)*(omega^2)^(1/4)*sinh(0.44592762e-3*(omega^2)^(1/4))+.89185524*c(8)*(omega^2)^(1/4)*cosh(0.44592762e-3*(omega^2)^(1/4))

eq(7) := -1.0773311*sqrt(omega^2)*cos(0.51897280e-3*(omega^2)^(1/4))-1.0773311*c(2)*sqrt(omega^2)*sin(0.51897280e-3*(omega^2)^(1/4))+1.0773311*c(3)*sqrt(omega^2)*cosh(0.51897280e-3*(omega^2)^(1/4))+1.0773311*c(4)*sqrt(omega^2)*sinh(0.51897280e-3*(omega^2)^(1/4)) = -4.4787661*c(5)*sqrt(omega^2)*cos(0.44592762e-3*(omega^2)^(1/4))-4.4787661*c(6)*sqrt(omega^2)*sin(0.44592762e-3*(omega^2)^(1/4))+4.4787661*c(7)*sqrt(omega^2)*cosh(0.44592762e-3*(omega^2)^(1/4))+4.4787661*c(8)*sqrt(omega^2)*sinh(0.44592762e-3*(omega^2)^(1/4))

eq(8) := 1.1182110*(omega^2)^(3/4)*sin(0.51897280e-3*(omega^2)^(1/4))-1.1182110*c(2)*(omega^2)^(3/4)*cos(0.51897280e-3*(omega^2)^(1/4))+1.1182110*c(3)*(omega^2)^(3/4)*sinh(0.51897280e-3*(omega^2)^(1/4))+1.1182110*c(4)*(omega^2)^(3/4)*cosh(0.51897280e-3*(omega^2)^(1/4)) = 3.9944110*c(5)*(omega^2)^(3/4)*sin(0.44592762e-3*(omega^2)^(1/4))-3.9944110*c(6)*(omega^2)^(3/4)*cos(0.44592762e-3*(omega^2)^(1/4))+3.9944110*c(7)*(omega^2)^(3/4)*sinh(0.44592762e-3*(omega^2)^(1/4))+3.9944110*c(8)*(omega^2)^(3/4)*cosh(0.44592762e-3*(omega^2)^(1/4))

eq(9) := c(5)*cos(0.28806924e-1*(omega^2)^(1/4))+c(6)*sin(0.28806924e-1*(omega^2)^(1/4))+c(7)*cosh(0.28806924e-1*(omega^2)^(1/4))+c(8)*sinh(0.28806924e-1*(omega^2)^(1/4)) = c(9)*cos(0.33525643e-1*(omega^2)^(1/4))+c(10)*sin(0.33525643e-1*(omega^2)^(1/4))+c(11)*cosh(0.33525643e-1*(omega^2)^(1/4))+c(12)*sinh(0.33525643e-1*(omega^2)^(1/4))

eq(10) := -.89185524*c(5)*(omega^2)^(1/4)*sin(0.28806924e-1*(omega^2)^(1/4))+.89185524*c(6)*(omega^2)^(1/4)*cos(0.28806924e-1*(omega^2)^(1/4))+.89185524*c(7)*(omega^2)^(1/4)*sinh(0.28806924e-1*(omega^2)^(1/4))+.89185524*c(8)*(omega^2)^(1/4)*cosh(0.28806924e-1*(omega^2)^(1/4)) = -1.0379456*c(9)*(omega^2)^(1/4)*sin(0.33525643e-1*(omega^2)^(1/4))+1.0379456*c(10)*(omega^2)^(1/4)*cos(0.33525643e-1*(omega^2)^(1/4))+1.0379456*c(11)*(omega^2)^(1/4)*sinh(0.33525643e-1*(omega^2)^(1/4))+1.0379456*c(12)*(omega^2)^(1/4)*cosh(0.33525643e-1*(omega^2)^(1/4))

eq(11) := -1.0773311*c(9)*sqrt(omega^2)*cos(0.33525643e-1*(omega^2)^(1/4))-1.0773311*c(10)*sqrt(omega^2)*sin(0.33525643e-1*(omega^2)^(1/4))+1.0773311*c(11)*sqrt(omega^2)*cosh(0.33525643e-1*(omega^2)^(1/4))+1.0773311*c(12)*sqrt(omega^2)*sinh(0.33525643e-1*(omega^2)^(1/4)) = -4.4787661*c(5)*sqrt(omega^2)*cos(0.28806924e-1*(omega^2)^(1/4))-4.4787661*c(6)*sqrt(omega^2)*sin(0.28806924e-1*(omega^2)^(1/4))+4.4787661*c(7)*sqrt(omega^2)*cosh(0.28806924e-1*(omega^2)^(1/4))+4.4787661*c(8)*sqrt(omega^2)*sinh(0.28806924e-1*(omega^2)^(1/4))

eq(12) := 1.1182110*c(9)*(omega^2)^(3/4)*sin(0.33525643e-1*(omega^2)^(1/4))-1.1182110*c(10)*(omega^2)^(3/4)*cos(0.33525643e-1*(omega^2)^(1/4))+1.1182110*c(11)*(omega^2)^(3/4)*sinh(0.33525643e-1*(omega^2)^(1/4))+1.1182110*c(12)*(omega^2)^(3/4)*cosh(0.33525643e-1*(omega^2)^(1/4)) = 3.9944110*c(5)*(omega^2)^(3/4)*sin(0.28806924e-1*(omega^2)^(1/4))-3.9944110*c(6)*(omega^2)^(3/4)*cos(0.28806924e-1*(omega^2)^(1/4))+3.9944110*c(7)*(omega^2)^(3/4)*sinh(0.28806924e-1*(omega^2)^(1/4))+3.9944110*c(8)*(omega^2)^(3/4)*cosh(0.28806924e-1*(omega^2)^(1/4))

sys:=eval({seq(eq(i),i=1..12)},
          map(u->u=cat(op(0,u),op(u)),indets({seq(eq(i),i=1..12)},specfunc(c)))):

cand := solve(eval(sys,omega=0));

{c11 = -1.*c9, c3 = -1., c5 = -1.*c7, c7 = c7, c9 = c9}

part := remove(evalb,{omega=0} union cand);

{c11 = -1.*c9, c3 = -1., c5 = -1.*c7, omega = 0}

eval(sys, part);

{0. = 0, 0. = 0.}

 

NULL

Download solve_ac.mw

 

Using Maple 18 (like you),

restart

lambda1 := 0.733e-1:

expr := (Z^(lambda2/lambda1))^2*ln(Z)^2/((Z-1+alpha)^2*(Z^(lambda2/lambda1)-1+alpha)^3):

evalf(Int(expr, Z = 1 .. infinity, method = _Dexp));

0.1150342055e-6

evalf(Int(1/expand(1/expr), Z = 1 .. infinity));

0.1150342058e-6

new := ln(Z)^2/((Z-1+alpha)^2*expand((Z^(lambda2/lambda1)-1+alpha)^3/(Z^(lambda2/lambda1))^2)):

evalf(Int(new, Z = 1 .. infinity));

0.1150342058e-6

 

NULL

Download ask_ac.mw

 

It's possible that `evalf/int/control` is not falling back gracefully, after encountering the overflow.

It might even be fun(?) to use the URL package to look up the current conversion rate and amend the AUD unit's conversion formula.

restart:

Units:-AddUnit(dollar, context=AUD, abbreviations=AUD, conversion=0.75*USD);

Units:-UseUnit(AUD): Units:-UseUnit(1/AUD):

BC:=6000*Unit(AUD); #Battery Cost

6000*Units:-Unit(AUD)

BS:=3*Unit(kWh/d); #Battery Storage

3*Units:-Unit(kWh/d)

EC:=.264*Unit(AUD/kWh); #Electricity Cost

.264*Units:-Unit(AUD/kWh)

BC/EC/(1+.035)^t/BS=t*Unit(yr)

7575.757577*Units:-Unit(AUD)/(Units:-Unit(AUD/kWh)*1.035^t*Units:-Unit(kWh/d)) = t*Units:-Unit(yr)

pt:=fsolve(%,t)

13.18033222

FIT:=0.09*Unit(AUD/kWh); #Feed In Tarrif rate

0.9e-1*Units:-Unit(AUD/kWh)

combine(BS*FIT*pt*Unit(year),units);

1299.783619*Units:-Unit(AUD)

combine(subs(t=pt,convert(EC*BS, units,AUD/yr)*(1+.035)^t*t*Unit(year)),units);

6000.000002*Units:-Unit(AUD)

 

Download CURRENCY_AUD.mw

You can left-align each of a sequence of Typesetting:-mtr rows, and then put them inside a call to Typesetting:-mtable .

(This is similar to how Matrices are typeset, but without the braces.)

I haven't bothered to remove your Tsprintf procedure, now unused. And I haven't bothered to make the conditional branches more streamlined (it shouldn't be necessary to make it all explicit like that).

You could also have various different procedures that each returned their own Typesetting:-mtr call (eg. for different kinds of question). You wouldn't be able to print them, until you could wrapped all such results in a single Typesetting:-mtable call.

restart

TSprintf := proc () Typesetting:-mrow(seq(`if`(e::string, Typesetting:-mn(e), Typesetting:-Typeset(Typesetting:-EV(e))), e = [args])) end proc

multiple := proc (jjj) local dsdsds, ii, tudo1, num1, num, dsd, dsss1, dsss2, dsss3, r, R; dsdsds := rand(1 .. 4); for r to jjj do ii := dsdsds(); tudo1 := [1, 123456, 12345667890, 123456789012345]; num1 := rand(1 .. nops(tudo1())); dsd := sprintf("%a", tudo1[num1()]); dsss1 := sprintf("%a", tudo1[num1()]); dsss2 := sprintf("%a", tudo1[num1()]); dsss3 := sprintf("%a", tudo1[num1()]); if ii = 1 then R[r] := Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("A", mathcolor = `#ff0000`), Typesetting:-mtext(". "), Typesetting:-mtext(dsd))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("B"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss1))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("C"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss2))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("D"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss3))), 'columnalign' = 'left') elif ii = 2 then R[r] := Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("A"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss1))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("B", mathcolor = `#ff0000`), Typesetting:-mtext(". "), Typesetting:-mtext(dsd))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("C"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss2))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("D"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss3))), 'columnalign' = 'left') elif ii = 3 then R[r] := Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("A"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss1))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("B"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss2))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("C", mathcolor = `#ff0000`), Typesetting:-mtext(". "), Typesetting:-mtext(dsd))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("D"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss3))), 'columnalign' = 'left') else R[r] := Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("A"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss1))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("B"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss2))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("C"), Typesetting:-mtext(". "), Typesetting:-mtext(dsss3))), Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mtext("D", mathcolor = `#ff0000`), Typesetting:-mtext(". "), Typesetting:-mtext(dsd))), 'columnalign' = 'left') end if end do; Typesetting:-mtable(seq(op([R[r], `$`(Typesetting:-mtr(), 2)]), r = 1 .. jjj)) end proc

randomize()

multiple(7)

"[["A"". ""123456","B"". ""12345667890","C"". ""12345667890","D"". ""123456789012345"],[],[],["A"". ""1","B"". ""1","C"". ""1","D"". ""123456"],[],[],["A"". ""12345667890","B"". ""123456","C"". ""123456789012345","D"". ""123456789012345"],[],[],["A"". ""12345667890","B"". ""12345667890","C"". ""1","D"". ""1"],[],[],["A"". ""123456","B"". ""123456789012345","C"". ""123456","D"". ""123456789012345"],[],[],["A"". ""12345667890","B"". ""1","C"". ""12345667890","D"". ""123456789012345"],[],[],["A"". ""12345667890","B"". ""123456789012345","C"". ""123456","D"". ""123456"],[],[]]"

``

Download Goi_mapleprime_ac.mw

You can easily generate a sequence of such things.

So, you could use such a generated sequence in the arguments of the Minimize command.

seq(x[i]=1..2, i=1..5);

    x[1] = 1 .. 2, x[2] = 1 .. 2, x[3] = 1 .. 2, x[4] = 1 .. 2, x[5] = 1 .. 2

op(map(v->v=1..2, [W, a, x, y]));

             W = 1 .. 2, a = 1 .. 2, x = 1 .. 2, y = 1 .. 2

expr := a^2+sin(b*Pi+c):

indets(expr, And(name,Non(constant)));

                          {a, b, c}

op(map(v->v=1..2, indets(expr, And(name,Non(constant)))));

               a = 1 .. 2, b = 1 .. 2, c = 1 .. 2

As far as I know it is only possible to specify one light source.

The wording in the documentation might be improved, but I suppose the idea is that it is providing an alternative to the Light1, Light2, etc, stock lighting model choices.

[edited] Sorry, I was in a rush earlier.

I often find it helpful to remember that the results of plotting commands -- plot structures -- are just unevaluated function calls. One can assemble them manually, as well as pick them apart. The stock plotting commands just happen to provide useful functionally for constructing particular plot structures that the GUI renders with some commonly wanted appearances.

There are a few interesting things that can be constructed manually, yet don't have a path to that construction via the stock commands. I don't believe that's the case here.

There are also a few things one can discover.

The PLOT3D function call (structure) can have a MESH substructure as one representation of a surface. The LIGHT function call (substructure) has no effect if it appears as a local plot option within a MESH substructure.

The LIGHT substructure only has an effect as one of the arguments of the outer PLOT3D structure. Sometimes this is referred to as a global plot option, on account of this. And the Standard GUI seems to only utilize the last LIGHT substructure found in the outer PLOT3D structure. In other words, only one lighting source can be specified per PLOT3D structure.

note. One of the important jobs of plots:-display is to sort out what global plot options are present, when passed multiple plot structures, and merge them when possible.

LIGHT_structure.mw

I'm not sure what you want changed.

For your animations, you don't have to put the common plot (common to all frames) in a display call with the other bits. If you use the plots:-animate command then it can look a little tighter, IMO.

Also, if you use a few procedures then you could probably avoid using do-loops that assigned to k, n, etc. And so you might not need to keep unassigning those.

And some plot options like xtickmarks, labels, etc, only need to be supplied to the final display call (or animate).

with(Statistics): with(plots):
ChisquarePDF := unapply(PDF(RandomVariable(ChiSquare(a)),var), [a,var]):
NormalPDF := unapply(PDF(RandomVariable(Normal(mu,sigma)),var), [mu,sigma,var]):

h := algsubs(x = sqrt(2*n)*w + n,sqrt(2*n)*ChisquarePDF(n, x)):
makeN := k -> display(plot(eval(h,n=20*k), w = -3.52 .. 3.52, color=red, thickness=2),
                      textplot([1.8, 0.3, sprintf("n = %a",round(20*k))],
                               font=[TIMES,BOLD,12], color=blue)):
animate(makeN, [k], k=1..15, frames=15, paraminfo=false,
        background = plot(NormalPDF(0, 1, x), x = -3.52 .. 3.52, color = blue, thickness=2),
        title = `pdf of the Sum of Transformed Chi-square(1)\nRandom Variables and the N(0,1) pdf`,
        titlefont=[TIMES,BOLD,12], labels=[``,``],
        xtickmarks=[-3.5+0.5*k$k=0..14], ytickmarks=[0.05*k$k=1..8]);

It would be much better to upload a worksheet with 2D Input, rather than to try and paste that in as plain text.

If your term typed in as 2 k alpha[1] alpha[2]0 is just a typographical mistake, and you intended 2 k alpha[1] alpha[2] instead, then how do you feel about k=0, w=0 ?

solve_sys.mw

For fun, here are a few additional ways to customize plots for this.

You can uncomment some of the options below, for a few more variations.

restart;

plots:-setoptions(gridlines=false):

A := [3, 4, 10, 14, 15, 16];
B := [10, 20, 30, 40, 50, 60];

[3, 4, 10, 14, 15, 16]

[10, 20, 30, 40, 50, 60]

 

plots:-display(((a,b)->plottools:-line([a,0],[a,b],color=blue))~(A,B)
               #, view=[0..max(A),DEFAULT]
               , thickness=1
               #, xtickmarks=A
               );

plots:-display(((a,b,r)->plottools:-line([a,0],[a,b/r],color=blue))~(A,B,add(B))
               , view=[0..max(A),DEFAULT]
               , thickness=3
               , xtickmarks=A
              );

r := add(B):
plots:-display(seq(plottools:-polygon([ [A[i]-1/2, 0], [A[i]-1/2, B[i]/r],
                                        [A[i]+1/2, B[i]/r], [A[i]+1/2, 0] ],
                                      color=blue),
                   i=1..nops(A))
               #, view=[0..max(A)+1/2,DEFAULT]
               , thickness=0
               #, style=surface
               #, xtickmarks=A
              );

plots:-display(((i,b,r)->plottools:-line([i,0],[i,b/r],color=blue))~([$1..nops(A)],B,add(B))
               , view=[0..nops(A),DEFAULT]
               , thickness=3
               , xtickmarks=[seq(i=A[i],i=1..nops(A))]
              );

r := add(B):
plots:-display(seq(plottools:-polygon([ [i-1/2, 0], [i-1/2, B[i]/r],
                                        [i+1/2, B[i]/r], [i+1/2, 0] ],
                                      color=blue),
                   i=1..nops(A))
               #, view=[0..max(A)+1/2,DEFAULT]
               , thickness=0
               #, style=surface
               , xtickmarks=[seq(i=A[i],i=1..nops(A))]
              );

 

NULL

Download Histogram_varieties.mw

Regarding your Question 2, yes, you can construct procedures that can selectively apply trig formulas according to their argument.

Here is one example of using applyrule to selectively apply a formula.

There are several other ways to accomplish your goal. For example, you could programmatically build some side-relation equations -- using chosen names or arguments -- for use within a call to simplify. Or you could utilize applyrule with a general rule and temporarily freeze the trig calls you want untouched. And most of these approaches could be abstracted further, where one writes procedures which generate the rules, or procedures which generate procedures.

restart;

 

Rdcos := proc(ff::algebraic,nm::list(algebraic):=anything)
                local tp, x;
                if nm=anything then tp := nm;
                else tp := :-identical(op(nm));
                end if;
                applyrule([cos(x::tp)^2=(cos(2*x)+1)/2,
                           cos(x::tp)^(-2)=2/(cos(2*x)+1)], ff);
              end proc:

 

Rdcos( 2*cos(t)^2-1 );

cos(2*t)

Rdcos( cos(t)^2 );

(1/2)*cos(2*t)+1/2

Rdcos( cos(p*t+q)^(-2) );

2/(cos(2*p*t+2*q)+1)

# targeted
Rdcos( cos(p*t+q)^(-2) + cos(a*t+c)^(-2), [a*t+c] );

1/cos(p*t+q)^2+2/(cos(2*a*t+2*c)+1)

foo := expand( cos(2*t) + cos(2*s)/2 + 1 + cos(2*phi) ) + cos(3*y)^2;

2*cos(t)^2-3/2+cos(s)^2+2*cos(phi)^2+cos(3*y)^2

# targeted
Rdcos(foo, [t]);

cos(2*t)-1/2+cos(s)^2+2*cos(phi)^2+cos(3*y)^2

# targeted
Rdcos(foo, [t, s]);

cos(2*t)+(1/2)*cos(2*s)+2*cos(phi)^2+cos(3*y)^2

Rdcos(foo);
simplify(%-foo);

cos(2*t)+3/2+(1/2)*cos(2*s)+cos(2*phi)+(1/2)*cos(6*y)

0

 

Download targeted_doubleangle.mw

The call rand(1 .. 2) constructs and returns a procedure which can then be called to obtained a (random) number in the given range.

If instead you call rand(1 .. 2)() then the constructed procedure will be called immediately and return an actual number.

But you don't need to call rand each time through the loop. You can call it once, outside the loop, to construct the random number generating procedure. Then, inside the loop, you can call that procedure to get actual numbers.

restart

a := Vector[row](1 .. 10)

Vector[row](%id = 18446884022782214982)

randomize()

r := rand(1 .. 2); for k to 10 do if r() < 3/2 then a[k] := "H" else a[k] := "T" end if end do

a

Vector[row](%id = 18446884022782214982)

NULL

Download CoinToss_acc.mw

You cannot sensibly assign to xi and xi[0] like that. I suggest using another name instead of xi[0]. The name xi__0 will also prettyrpint as a subscripted name.

restart;
l := -2;
m := 1;
k := sqrt(-1/(6*beta))/l;
w := (1/5)*alpha/(beta*l);
a[2] := -12*sqrt(-1/(6*beta))*alpha*m^2/(5*l*l);
a[0] := 0;
a[1] := 0;
F := -l*C[1]/(m*(C[1]+cosh(l*(xi+xi__0))-sinh(l*(xi+xi__0))));
beta := -2;
alpha := 3;
C[1] := -1/1000;
xi__0 := 1;
xi := k*x-t*w;
u := a[0]+a[1]*F+a[2]*F*F;

plot3d(u, x = -3 .. 3, t = -3 .. 3);

Any fixed image will look pixelated if you zoom in enough. Your example creates a 500-by-500 pixel image, so of course it'll look pixelated with even a moderate amount of zoom, if embedded at the same resolution.

You can either increase the resolution of the image (you had it as 500-by-500), or you can dynamically recreate the image as you zoom in.

Eg, (with all the calls in separete Execution Groups or Document Blocks!)

restart;
# Compare these next two results.
# You can chop, crop, and then rescale the one with higher resolution,
# to get the effect of zooming.

ImageTools:-Embed(Fractals:-EscapeTime:-Julia(900,
                                     -0.01*(1.0+I)+(-1.7-1.7*I),
                                     0.01*(1.0+I)+(1.7+1.7*I),
                                     -0.8 + 0.16*I,
                                     iterationlimit=70, output=layer1)):

ImageTools:-Embed(Fractals:-EscapeTime:-Julia(500,
                                     -0.01*(1.0+I)+(-1.7-1.7*I),
                                     0.01*(1.0+I)+(1.7+1.7*I),
                                     -0.8 + 0.16*I,
                                     iterationlimit=70, output=layer1)):


restart;
# Or you can regenerate and redisplay, to the modest size, as you zoom.

Explore( Fractals:-EscapeTime:-Julia(500,
                                     -0.01*(3.0+I)+(-2.0-2.0*I)/exp(zoom),
                                     0.01*(3.0+I)+(2.0+2.0*I)/exp(zoom),
                                     -0.8 + 0.16*I,
                                     iterationlimit=70, output=layer1)
         , parameters=[ zoom=0.0..4.0 ]
         , size=[500,500]
         , animate
         , placement=left );

julia_zoom.mw

Another alternative is to create a high resolution image just once, and then Explore the fixed smaller resolution (say, 500-by-500) effect of using ImageTools:-Scale to chop and scale that original, thus zooming in. That would also let you pan around. And most of the computational time would be "up front". Here's an example of that with a 6000-by-6000 starting image. (Reduce that initial size, if it uses too much memory for you.) As you can see, no matter how high the resolution of the original, eventually zooming in far enough to a fixed image willl result in a pixelated look. Hence my preference for the former scheme above, where the computation is re-done for every "zoomed" range.

restart;

N := 6000;

# This first computation takes some time. (7sec for me, but YMMV)
raw := Fractals:-EscapeTime:-Julia(N,
                                   -0.01*(1.0+I)+(-1.7-1.7*I),
                                   0.01*(1.0+I)+(1.7+1.7*I),
                                   -0.8 + 0.16*I,
                                   iterationlimit=70, output=layer1):

Z:=proc(N,cv,ch,s)
   uses ImageTools;
   if not [cv,ch]::list(posint) then
     return 'procname'(args);
   end if;
   Scale(raw[ceil(cv-(N/2-s)/2)..floor(cv+(N/2-s)/2),
             ceil(ch-(N/2-s)/2)..floor(ch+(N/2-s)/2)],
             1..500,1..500);
end proc:

Explore(Z(N, cv, ch, s),
        cv=N/4..3*N/4, ch=N/4..3*N/4, s=0..N/2,
        initialvalues=[cv=N/2, ch=N/2]);

image_zoom.mw

If your whole computation is intended to deal with floating-point arithmetic (like your example) then you can improve performance by using either evalhf or Compile, as shown below.

You have unwisely chosen to show us only a portion of your complete work. It's is possibly that other parts of your complete work will not run directly under evalhf or Compile. But in that case you could still split off the portions which do from those which do not. Help cannot be given for the parts you do not reveal to us.

You mentioned memory issues, and name the figure 4Gb, for your complete work. It's not clear at all whether that refers to bytes used or bytes allocated. It's also unclear whether you're main difficulty is in how long the computation takes, or whether the whole problem requires excessive allocation of memory.

restart; FF := proc (xx::Array, nn::integer) local gg, i, j; gg := 0; for i by 3 to nn do for j from i+3 by 3 to nn do gg := gg+1/((xx[i]-xx[j])^2+(xx[i+1]-xx[j+1])^2+(xx[i+2]-xx[j+2])^2) end do end do; return gg end proc; N := 10^4-1; A := Array(1 .. N, [seq(i^2, i = 1 .. N)], datatype = float[8]); CodeTools:-Usage(evalhf(FF(A, N)))

9999

memory used=1.36KiB, alloc change=0 bytes, cpu time=2.09s, real time=2.09s, gc time=0ns

0.166139869037898848e-2

restart; FF := proc (xx::(Array(datatype = float[8])), nn::integer) local gg, i, j; gg := 0.; for i by 3 to nn do for j from i+3 by 3 to nn do gg := gg+1/((xx[i]-xx[j])^2+(xx[i+1]-xx[j+1])^2+(xx[i+2]-xx[j+2])^2) end do end do; return gg end proc; cFF := Compiler:-Compile(FF); N := 10^4-1; A := Array(1 .. N, [seq(i^2, i = 1 .. N)], datatype = float[8]); CodeTools:-Usage(cFF(A, N))

9999

memory used=1.35KiB, alloc change=0 bytes, cpu time=219.00ms, real time=219.00ms, gc time=0ns

0.166139869037898848e-2

``

Download procedure_new_ac.mw

First 165 166 167 168 169 170 171 Last Page 167 of 341