tomleslie

13876 Reputation

20 Badges

15 years, 164 days

MaplePrimes Activity


These are replies submitted by tomleslie

Since 'w' is used as a loop index and hence always a numeric value, it doesn't make much sense (to me) to integrate 'L1' with respect to 'w' -

As provided the quantity 'L1' contains the unknowns a1, a2, b2, c1, c2, c3, f1, k1, k2, k3. Im guessing that these are meant to be a1[w], a2[w], b2[w], c1[w], c2[w], c3[w], f1[w], k1[w], k2[w], k3[w]}

If I make these changes, then 'L1' evaluates to a (complex) numerical constant, in fact

-0.00009976269238 + 0.04386238846*I

for loop index values d=-w and w=0.

See also my comments in the attached worksheet

Download cmplInt.mw

 

 

@dnaviaux 

a simple formatted prin statement ( ie printf() ), as in the attached

  example_results:=<1,2,3,4>:
  example_names:=<"resistor","opamp","name3","name4">:
  printf("\n\n\t\t    Quantity\t    Value\n\n");
  seq( printf( "\t\t%12s:\t%12.8f\n",
               example_names[j],
               example_results[j]
             ),
       j=1..numelems(example_names)
     );

   whihc will produce

            Quantity        Value

              resistor:      1.00000000:
               opamp:      2.00000000:
               name3:      3.00000000:
               name4:      4.00000000:

 

That an alternative is to upload your worksheet here, using the big green up-arrow in the Mapleprimes toolbar and (probably?!) someone here will find/fix the error for you

The dsolve() command is returning a complex number (ie of the form a+I*b)

Maple will handle complex-valued IVP problems but not complex-valued BVP problems - see the extract from the Maple help below (emphasis added)

All IVP methods can be used for complex-valued IVPs with a real-valued independent variable (though for the default stiff and nonstiff IVP methods, it may be necessary to specify that the problem is complex via the complex option). None of the BVP or DAE methods can currently be used for complex-valued problems, requiring the system be converted to a real system before calling dsolve.

Converting your complex-valued system to a real system is not too difficult(?), but can be time-consuming,  so before doing this it makes sense to ask a very simple question.

For your specific problem, does it make sense for any of the dependent variables ( ie f(eta), theta(eta), chi(eta) ) to have complex values?

If you are expecting only real values for your dependent variables, the fact that Maple is producing complex values is (often) a sign that there is  "typo" somewhere in the definition of the system.

 

This is a problem I have always had "occasionally", but over the last couple of days, I haven't been able to display any worksheet.

Not convinced that it is user OS/browser issue - my default is Win7+FireFox

@mmcdara 

See my earlier answer.

We seem to have the same Maple build ID. The only "difference" seems to be that I am running 64-bit Windows 7, while you are using MacOS

It is rare that use of the 'range=' option is "beneficial" - so unless you have a very good reason for using it, then don't

  1. Using this option means that Maple not only generates a suitable procedure to compute the solution it actually uses this procedure to compute/store the solution for the whole of the specified range. It will store the solution at all values of the independent variable(s) used in the calculation. The values of the independent variables will be determined by the "error control" for the solution method. This can result in the storage of a lot of data - most of which you will (probably) never want/need
  2. If this option is omitted then Maple will just generate a procedure which can be used to compute the solution - the solution is not computed/stored at this stage.. Subsequent use of this procedure will actually cause the solution to be computed - and it is rare that such subsequent use will ever require the complete solution to be stored. For example
    1. If you just want the value of dependent variables at (a) specific value(s) of the independent variable(s), then one only needs to store values for the number of preceding points which are necessary to compute the next point. This number will be dependent on the method being used, but (in general) it will be <10 - so one should never run into a storage limit. The solution procedure 'knows' how many previous points are needed to compute the next one - and won't store any more than this.
    2. If you wish to produce plots using odeplot(), then the number of values which have to be stored is essentially under the control of the plot routine - in other words sufficient to produce a nice smooth plot, but (in general) this will far fewer than the number of points required for error control in the ode solving procedure.

 

@manju 

It is trivial to generate random values for your parameters, plot the required surface and annotate the plot with the parameter values.

My problem is that I do not understand your requirement

"constants should randomly take the best values."

I understand the requirement

"constants should take random values."

and the requirement

"constants should take the best values."

provided that you supply some criteria for deciding what is "best"

But constants cannot be both "random" and "best"

 

@manju 

You say

I want that all the constants should randomly take the best values.

Define 'best' !

@s265344 

SolveEquations() is definitely a command in the DirectSearch package - see my original worksheet, and the attached. I can only assume that you have an installation problem. What happens when you type DirectSearch in the Maple help???

In the attached, increasing the value of 'c' to 1000 - all residuals are quite small, values of all variables are still quite small

b := 20

20

(1)

c := 1000

1000

(2)

``

``

sys := [-2*c*d1^2+2*c*f1*f2-2*c*f2^2+2*a1^2+2*c2^2 = 0, 2*c*d1*d2-2*c*d2^2-2*c*e1^2+2*a2^2+2*b1^2 = 0, 2*c*e1*e2-2*c*e2^2-2*c*f1^2+2*b2^2+2*c1^2 = 0, -2*c*d1*d2+2*c*e1*e2+2*a1*a2 = 0, -2*c*e1*e2+2*c*f1*f2+2*b1*b2 = 0, 2*c*d1*d2-2*c*f1*f2+2*c1*c2 = 0, 2*c*e2^2+2*c*f1^2-2*c*f1*f2+2*c1*c2 = 0, 2*c*d1^2-2*c*d1*d2+2*c*f2^2+2*a1*a2 = 0, 2*c*d2^2+2*c*e1^2-2*c*e1*e2+2*b1*b2 = 0, a1 = b1, b2 = c2, e1 = f1]

[2*a1^2+2*c2^2-2000*d1^2+2000*f1*f2-2000*f2^2 = 0, 2*a2^2+2*b1^2+2000*d1*d2-2000*d2^2-2000*e1^2 = 0, 2*b2^2+2*c1^2+2000*e1*e2-2000*e2^2-2000*f1^2 = 0, 2*a1*a2-2000*d1*d2+2000*e1*e2 = 0, 2*b1*b2-2000*e1*e2+2000*f1*f2 = 0, 2*c1*c2+2000*d1*d2-2000*f1*f2 = 0, 2*c1*c2+2000*e2^2+2000*f1^2-2000*f1*f2 = 0, 2*a1*a2+2000*d1^2-2000*d1*d2+2000*f2^2 = 0, 2*b1*b2+2000*d2^2+2000*e1^2-2000*e1*e2 = 0, a1 = b1, b2 = c2, e1 = f1]

(3)

`union`(`~`[indets](sys)[]); numelems(%); numelems(sys)

12

(4)

fsolve(sys, {a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2})

fsolve([2*a1^2+2*c2^2-2000*d1^2+2000*f1*f2-2000*f2^2 = 0, 2*a2^2+2*b1^2+2000*d1*d2-2000*d2^2-2000*e1^2 = 0, 2*b2^2+2*c1^2+2000*e1*e2-2000*e2^2-2000*f1^2 = 0, 2*a1*a2-2000*d1*d2+2000*e1*e2 = 0, 2*b1*b2-2000*e1*e2+2000*f1*f2 = 0, 2*c1*c2+2000*d1*d2-2000*f1*f2 = 0, 2*c1*c2+2000*e2^2+2000*f1^2-2000*f1*f2 = 0, 2*a1*a2+2000*d1^2-2000*d1*d2+2000*f2^2 = 0, 2*b1*b2+2000*d2^2+2000*e1^2-2000*e1*e2 = 0, a1 = b1, b2 = c2, e1 = f1], {a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2})

(5)

ans := DirectSearch:-SolveEquations(sys, evaluationlimit = 20000)

[6.201567654269949*10^(-17), _rtable[36893488148124719812], [a1 = -0.4025546389926265e-4, a2 = -0.35248073005432847e-5, b1 = -0.4025631964833346e-4, b2 = -0.33120019273548416e-4, c1 = 0.2541197545818328e-4, c2 = -0.33116882774305545e-4, d1 = -4.0769802316916546*10^(-7), d2 = -7.566476304807598*10^(-7), e1 = 4.6269827823357826*10^(-7), e2 = 0.12377407238374901e-5, f1 = 4.621619184912858*10^(-7), f2 = 4.21583298228029*10^(-7)], 12562]

(6)

``

Download DS2.mw

@mmcdara 

Maybe one of the options in the attached covers your requirement?

  restart;
  sol:=dsolve( {diff(x(t),t,t)+diff(x(t),t)=a*t+b, x(0)=0, D(x)(0)=1}, numeric, parameters=[a,b]):
#
# NB parameter names are not necessary - only
# order really matters
#
  sol(parameters=[2,1]):
  plots:-odeplot(sol, [t, x(t)], t=0..10);

 

  restart;
  sol:=dsolve( {diff(x(t),t,t)+diff(x(t),t)=a*t+b, x(0)=0, D(x)(0)=1}, numeric, parameters=[a,b]):
#
# You can extract the 'local' parameter names, convert
# them to globals
#
  globs:=convert~( lhs~(sol(parameters)), `global`);
#
# Then use the global names in
#
  sol(parameters=[ globs[1]=2, globs[2]=1]);
  sol(1);
  plots:-odeplot(sol, [t, x(t)], t=0..10);

[a, b]

 

[a = 2., b = 1.]

 

[t = 1., x(t) = HFloat(1.264241209147557), diff(x(t), t) = HFloat(1.7357587908524432)]

 

 

 

 


 

Download globLoc2.mw

@vv

Your final execution group produces a 1X2 array of plots.

For reasons which escape me, no plot arrays never render correctly on this site

With the latest Physics Version (884), I find that the setting of warnlevel() makes no difference!????

Only obvious difference between nm's installation and mine, is that I'm (still) running Windows7, although I can't believe the underlying OS should make any difference


 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2020.2, Windows 7, November 11 2020 Build ID 1502365`

(1)

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 884 and is the same as the version installed in this computer, created 2020, November 25, 16:49 hours Pacific Time.`

(2)

interface(warnlevel=0);

3

(3)

ic:=y(0)=3:
ode := diff(y(x),x)*y(x)/(1+1/2*sqrt(1+diff(y(x),x)^2))=-x:
sol_1:=dsolve([ode,ic],y(x),singsol=all);

y(x) = -3+(-x^2+36)^(1/2), y(x) = 1+(-x^2+4)^(1/2)

(4)

restart;

ic:=y(0)=3:
ode := diff(y(x),x)*y(x)/(1+1/2*sqrt(1+diff(y(x),x)^2))=-x:
sol_2:=dsolve([ode,ic],y(x),singsol=all);

y(x) = -3+(-x^2+36)^(1/2), y(x) = 1+(-x^2+4)^(1/2)

(5)

 


 

Download warnDiff.mw

 

@Jaqr 

that you use the big green up-arrow in the Mapleprimes toolbar to upload the actual worksheet demostrating the problem. rather than have us guess what it content might be.

@acer 

It has always bothered me that the help page for seq() states (emphasis added)

Note: The index variable i is NOT private to the seq invocation.  It is recommended that you always explicitly declare the index variable to be local inside procedures.

This begs the obvious questions:

  1. Why only "inside procedures", what about "top-level"?
  2. Why is it  "recommended" rather than "mandatory"

Observe that the the help page for the (more-or-less-related) commands add() and mul() states

Note also that any previously existing value assigned to the index variable i is restored after the add or mul invocation. Thus the value of any local or global variable of the same name visible at the time the add or mul is executed will not be affected.

 

 

 

 

 

First 40 41 42 43 44 45 46 Last Page 42 of 207