mmcdara

7891 Reputation

22 Badges

9 years, 52 days

MaplePrimes Activity


These are replies submitted by mmcdara

Maybe I missed something, could you be more explicit?
gra423_Omega_Maple2015.mw


My 2015 Maple doesn't offer the VennDiagram function, so I can't deliver you a Maple worksheet.
Nevertheless the usual way to control display precision is the command interface(displayprecision=some_positive_integer)

@acer 

Thanks on behalf of the OP.
I hope that what you did will answer all its questions.

You were  very astute to transform the contourplot into a 3D surface to preserve the colouring (I was stupidely working on cloring the same way both the surface and its 2D projection)

@MAXR 

So here is an answer to your contourplot coloring question
(for your first question use Search in this Mapleprime page to find some answers. If I'm not mistaken @acer did a lot of work on this topic)

restart

with(plots):

data := {
phi1 = 0.3e-1,
phi2 = 0.3e-1,
phi3 = 0.3e-1,
B0 = 0.5e-1,
sigma = .3,
ku = 0.2e-1,
kl = 0.3e-1,
S = 0.2e-1,
beta0 = 1.5,
beta1 = .8,
beta2 = .5,
beta3 = .7,
beta4 = .3,
beta5 = .2,
beta6 = .4,
beta7 = .6,
beta8 = .9,
beta11 = .1,
beta22 = .2,
beta33 = .1,
beta44 = 0.5e-1,
beta55 = 0.8e-1,
beta66 = 0.3e-1,
beta77 = 0.7e-1,
beta88 = 0.4e-1
};

{B0 = 0.5e-1, S = 0.2e-1, beta0 = 1.5, beta1 = .8, beta11 = .1, beta2 = .5, beta22 = .2, beta3 = .7, beta33 = .1, beta4 = .3, beta44 = 0.5e-1, beta5 = .2, beta55 = 0.8e-1, beta6 = .4, beta66 = 0.3e-1, beta7 = .6, beta77 = 0.7e-1, beta8 = .9, beta88 = 0.4e-1, kl = 0.3e-1, ku = 0.2e-1, phi1 = 0.3e-1, phi2 = 0.3e-1, phi3 = 0.3e-1, sigma = .3}

(1)

Nu := B0^2*beta44+S^2*beta88+beta11*phi1^2+beta22*phi2^2+beta33*phi3^2+beta55*sigma^2+beta66*ku^2+beta77*kl^2+B0*beta4+S*beta8+beta1*phi1+beta2*phi2+beta3*phi3+beta5*sigma+beta6*ku+beta7*kl+beta0;

B0^2*beta44+S^2*beta88+beta11*phi1^2+beta22*phi2^2+beta33*phi3^2+beta55*sigma^2+beta66*ku^2+beta77*kl^2+B0*beta4+S*beta8+beta1*phi1+beta2*phi2+beta3*phi3+beta5*sigma+beta6*ku+beta7*kl+beta0

(2)

# Basic coloring

PlotWRT := {phi1, phi2};

Fixed := remove(has, data, PlotWRT);

c := contourplot(
  eval(Nu, Fixed)
  , phi1 = 0.1e-1 .. 0.5e-1
  , phi2 = 0.1e-1 .. 0.5e-1
  , filledregions=true
  , coloring=["Red", "Yellow"]
):

c;

{phi1, phi2}

 

{B0 = 0.5e-1, S = 0.2e-1, beta0 = 1.5, beta1 = .8, beta11 = .1, beta2 = .5, beta22 = .2, beta3 = .7, beta33 = .1, beta4 = .3, beta44 = 0.5e-1, beta5 = .2, beta55 = 0.8e-1, beta6 = .4, beta66 = 0.3e-1, beta7 = .6, beta77 = 0.7e-1, beta8 = .9, beta88 = 0.4e-1, kl = 0.3e-1, ku = 0.2e-1, phi3 = 0.3e-1, sigma = .3}

 

 

# Random colors coloring

c := contourplot(
  eval(Nu, Fixed)
  , phi1 = 0.1e-1 .. 0.5e-1
  , phi2 = 0.1e-1 .. 0.5e-1
  , filledregions=true
):

paint := () -> COLOUR(RGB, seq(rand(0. .. 1.)(), k=1..3)):  

curv, poly := selectremove(has, [op(c)], CURVES):
nreg := nops(poly) - 1;

display(
  PLOT(curv[], map(region -> subsop(-2 = paint(), region), poly[1..nreg])[], poly[nreg+1])
);

9

 

 

# Chosen colors coloring


with(ColorTools):

MyChoice := EvenSpread("Yellow", nreg);
paint    := ToRGB24~( MyChoice ) /~ 255:
display(
  PLOT(curv[], map(n -> subsop(-2 = COLOUR(RGB, paint[n]), poly[n]), [$1..nreg])[], poly[nreg+1])
);
 

[_m4689405984, _m4689400544, _m4689403296, _m4689397824, _m4689392160, _m4689394784, _m4689389248, _m4689383712, _m4689386400]

 

 

poly[nreg+1]

AXESLABELS(phi1, phi2)

(3)
 

 

Download Some_coloring.mw

See file  CQ_v1_mmcdara.mw

A few corrections are yellow highlighted (some are required with my Maple 2015 version, plus a few other things like rhs := ... which seems dangerous to me because rhs is a built_in Maple function).

This put aside, the main point you have to focus on is the black text in procedure EhrenfestSolve.

Correct yourself procedure EhrenfestRHS in order it returns a proper ode (ode system?) and form yourself the differential system by adding the Initial Conditions as explained in dsolve or dsolve/numeric help pages.

More of this your construction of S (vectors Cr and Ci in procedure EhrenfestRHS) does not seem judicious to me.
Didyou want to do something like the notional stuff I do in CQ_v1_mmcdara_2.mw  ?

@JaneCherrytree 

Incidentally, the fact that there is no formal expression for the cumulative distribution function is not that surprising: even the cumulative distribution function of two linearly correlated Gaussian random variables doesn't have one either (unless you integrate its PDF over ellipsoids...but in your  PDF is so complex that I don't think that this kind of integration will work).

@janhardo 

I always wonder how to interpret a question like "How to show these two expressions are the same?"
Does the author mean "How can we prove by hand these two expressions are the same?" or does it mean "Can Maple prove these two expressions are the same?"  (another example is mintienh's questions for instance).

When I decide to answer them, or contribute to provide a solution, I generally adopt the first stance and try to give, using Maple, a step by step program which leads to the solution (the "How to show " approach)...trying to mimic what I would do by hand.
But maybe this is not what the OP wanted?

@vv has chosen  the second position "Can Maple prove..." providing thus a more concise solution.
Two eminently different viewpoints.

@janhardo 

This not obvious in my answer, maybe I should have done this details.mw instead, it would have been more explicit

@salim-barzani 

This is for the simple reason that I can neither figure out what you're trying to achieve, nor be able to find a relationship between what you say in this reply and the code you provide.

I hope you can find someone smarter than me to help you.
Good luck

@salim-barzani 

Simply because G' never appears at the denominator and because it  is never raised to any power but 1.

Here is the most synthetic writting of G1 I can get:



You can  transform this expression into the sum of two sums of powers of 1/G, but this will not have the form you expect.

See contribution_mmcdara.mw

@dharr : maybe this will help you?

@Andiguys 

A10 depends on Pu, a, theta and writes A*Pu + B*a + C*theta + D where A, B, C, D are numbers
What you could do is something like this

Explore(plot(A10, Pu= some_range)), parameters=[a=some_range, theta=some_range])

where you consider here that A10 is a function of Pu parameterized by a and theta.
Or 

Explore(plot3d(A10, Pu= some_range, a=some_range), parameters=[theta=some_range])

where now A10 is thought as a function of Pu and a parameterized by theta.

To understand this just what you are trying to achieve simply copy-paste the next line in a new worksheet

Explore(plot(2*a+3*b-1), parameters=[a=0. .. 1., b=0. .. 1.])

What do you see? Only an horizontal straight line.
Why that?

  • Firstly: there is no plot range in the plot command and  thus Maple considers it (as a default) to be -10..10
  • Secondly: there is specification of a plot name.
    So Maple interprets plot(2*a+3*b-1) as plot(2*a+3*b-1), some_variable=-10..10).... s the horizontal straight line.
  • At last the intercept of this straight line is 2*a+3*b-1, a value which is control by the two sliders.

So what you are trying to do is nothing but plotting parallel horizontal straight lines and  there is no way you can get a display like the one you present (they obviously cannot intersect unless thay are confounded).See this attached file Slider_Q_mmcdara_2.mw and this illustration which comes from it:


As I suggested you in my initial reply you should think more to what you want to displat.
An advice: read the Explore help page and more specifically the worksheet Explore example worksheet
 in the See also section to understand clearly what Explore is aimed to do.

that you have to fix yourself because they come from an unclear definition of what you want to do:

In the attached file simply focus on this:

Verify that what you are about to plot only contains the slider names

indets([A10,A11,A12], name);
indets({[P,0],[P,1]}, name);

P; #unknown

{Pu, a, theta}

 

{P}

 

P

(1)

print~([A10,A11,A12]):

-0.2282639958e-3*Pu+1.666689493*a+0.3260914226e-3*theta+8796.032085

 

1.666666666*a+7000.000000

 

1.007246426*Pu-0.3623238030e-3*a-1.438923466*theta-6.180296835

(2)

# What is wrong?

f := proc(theta, Pu, a)
  plots:-display(
    # This is useless
    # plots:-textplot([]),      
    # This is useless              
    # plots:-pointplot([[]]),                    
    plot(1, t=500..41000000, color=gray),
    # P is undefeined (see above)                     
    # plottools:-line([P,0],[P,1],color=gray),                    
    plot(
      # A10, A11, A12 are both linear relations, but A10 and A12 depend on THREE indeterminates (see above)
      # So theheir graphs are straight lines in... FOUR dimensions.
      # How do you expect to display this using "plot"?
      [A10,A11,A12]
      # What the fell is that?  (commented)
      # ,a=    
      # Watchout: legend are only avaliable for 2D plots (Maple 2015 at least)
      #
      , legend=["A10","A11","A12"]
      # Wrong syntax of view (ar least in Maple 2015)
      # The correct one is vew=[x_range, y_range] for 2D plots
      # , view=-0.4..2.0
      , legendstyle=[location=right]
      , size=[600,400]
    )
  ):
end proc:  

# Once you have correctly defined what you want to plots (black text above)
# run this to see if the procedure "f" returns the expected result:

f(1, 1, 1);

# Once the results is correct come to us again to see how to use Explore

 

 

Download Excerpt.mw

Complete file Slider_Q_mmcdara.mw

@Paras31 

It's not an English issue but a matter of definition.
Are the curves you have in mind closed or not? Can they self intersect? Are they continuously differentible and, is so, uo to what order? And so on.

Here are different examples: Another_random_curve_generator.mw

@Paras31 

What you mean by "random curve" is not clear, but given what you said earlier on this thread I suspect this could be something like this?
 

restart

with(plots):
with(plottools):

RandomizedCircle := proc(N, e::positive, {UnitCircle::boolean:=true})
  # N = number of intermediate points
  # e = absolute amplitude if the random perturbation

  local A := [1, 1]:
  local B := [N+2, 1]:
  local M := seq([n+1, A[2] + rand(-e .. e)()], n=1..N):
  local p := [A, M, B];
  local s := unapply(CurveFitting:-Spline(p, t, endpoints='periodic'), t);

  uses plots:

  display(
    plot(s(1+t*(N+2-1)/(2*Pi)), t=0..2*Pi, coords=polar, color=red, thickness=2)
    , `if`(
            UnitCircle
            , plot(1, t=0..2*Pi, coords=polar, linestyle=3, color=black)
            , NULL
      )
    , scaling=constrained
  )
end proc:

rc := RandomizedCircle(10, 0.3):
display(
  rc
  , axes=none
)

 

# How to draw a randomized ellipse?

display(
  transform((x, y) -> [x+2*y, y-x])(rc)
  , axes=none
)
 

 

rc := RandomizedCircle(10, 0.3, UnitCircle=false):
display(
  rc
  , axes=none
);

display(
  transform((x, y) -> [x+y^2, y])(rc)
  , axes=none
)

 

 

display(
  transform((x, y) -> [(x^2+y^2)^3, 3*y^2])(rc)
  , axes=none
)

 

 

 

Download random_curves.mw


If you want BOTH a “hand-drawn” style curve and a “hand-drawn” style path, you could use this:
 

restart

with(plots):
with(plottools):

randomize()

174558185530126

(1)

RCCP := proc(N, e::positive, a, b, Ni, ei, {UnitCircle::boolean:=true})
  # N  = number of intermediate points on the closed curve
  # e  = absolute amplitude of the random perturbation on the closed curve
  # a  = first inside point
  # b  = second inside point
  # Ni = number of intermediate points on the path
  # ei = absolute amplitude of the random perturbation on the path
  local A, B, M, p, s, hx, hy, Mi, sx, sy, pi, ps:

  uses plots:

  # Outer curve
  A := [1, 1]:
  B := [N+2, 1]:
  M := seq([n+1, A[2] + rand(-e .. e)()], n=1..N):
  p := [A, M, B];
  s := unapply(CurveFitting:-Spline(p, t, endpoints='periodic'), t);


  # Inner path from a to b

  if a[1] < b[1] then
    A := a:
    B := b:
  else
    A := b:
    B := a:
  end if:

  hx := (B[1]-A[1])/(Ni+1):
  hy := (B[2]-A[2])/(Ni+1):
  Mi := seq([A[1] + n*hx + rand(-ei .. ei)(), A[2] + n*hy + rand(-ei .. ei)()], n=1..Ni):
  p  := [A, Mi, B];
  
  sx := unapply(CurveFitting:-Spline(map(n -> [n, p[n][1]], [$1..Ni+2]), x), x):
  sy := unapply(CurveFitting:-Spline(map(n -> [n, p[n][2]], [$1..Ni+2]), y), y):

  pi := plot(v, v=1..Ni+2, color=blue, thickness=2):
  ps := transform((x, y) -> [sx(x), sy(y)])(pi):
  display(
    plot(s(1+t*(N+2-1)/(2*Pi)), t=0..2*Pi, coords=polar, color=red, thickness=2)
    , `if`(
            UnitCircle
            , plot(1, t=0..2*Pi, coords=polar, linestyle=3, color=black)
            , NULL
      )
    , ps
    , plot(p[[1, Ni+2]], style=point, symbol=solidcircle, color=black, symbolsize=15)
    , textplot([a[], "A"], 'align'={'left' , `if`(a[2] < b[2], 'below', 'above')})
    , textplot([b[], "B"], 'align'={'right', `if`(a[2] < b[2], 'above', 'below')})
    , scaling=constrained
  )
end proc:

# Maybe you will have to run this a few times in order that for the random path
# to be totaly within the random closed curve.

c := plots:-display(
       RCCP(20, 0.4, [-0.5, -0.5], [0.5, 0.5], 3, 0.2, UnitCircle=false)
       , axes=none
     ):

display(c)

 

display(
  transform((x, y) -> [x+2*y, 4*y^3-x])(c)
  , axes=none
)

 

 


 

Download RandomCloedCurveAndPath.mw

@C_R 

The title of the plot is a little bit luring.
You're right, this is close to the arithmetic mean of abs(theta(t, Omega))... except that I don't use the integral expression which appears in the title but its approximation based on the evaluation of abs(theta(tn, Omega)) where tn is an integer ranging from T1 to T2 .

More of this at each abscissa Omega there are 4 points: the first one corresponds to the range T1 .. T2 = 601..650, the second to the range T1 .. T2 = 651..700, ... and the last one to the range T1 .. T2 = 751..800 (or almost). The fact the verticaly aligned points are very closed enables confirming that the system is likely not in a chaotic regime.

About the pi/2 factor... infact the purpose of this example was essentially illustrativeand I didn't push it too far as I belive it is uo to the OP to clarify its question.

Concerning your last question: I haven't looked at your file yet, but I'll get to it right away. I'll get back to you soon

1 2 3 4 5 6 7 Last Page 3 of 154