acer

32333 Reputation

29 Badges

19 years, 325 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@sija The first step is to change the undesirable
   Int( f(t), t=-4 .. t) = a
into something like,
   Int( f(t), t=-4 .. T) = a
or,
   Int( f(t), t=-4 .. x) = a
as vv had it. Otherwise it gets muddled up with name `t` serving two purposes.

Then I took rhs-lhs of the equations.

Then I used subsindets to replace the Int calls with a few options to force a fast hardware-float method and digits for the numeric quadrature, ie. when doing evalf(Int(...)).

Then I called fsolve, using unapply to turn the expressions into operator form with a forced evalf[15] to sidestep any Digits-raising by fsolve internally.

The numeric rootfinder fsolve has its own notions of accuracy and working precision, and so does evalf@Int. With one of these invoking the other then some case may be needed to balance the two (... the inner process producing at least as much accuracy --without cruft digits -- as the outer process expects, etc.)

@DJJerome1976 To be clear: for any axis you can always force your own custom tickmarks using a list of value=something items, some or all of which might be constructed conveniently using seq.

The lhs value of such items denotes where the tickmark label will appear. The rhs something denote what will appear there.

I only wrapped the something items in InertForm:-Display so that the fractions like -3*Pi/4 would not get rendered like -3/4*Pi which looks a bit awkward. That is to say, this doesn't look quite as nice:

plots:-polarplot(4, coordinateview = [0 .. 6,0 .. 2*Pi], thickness = 3,
                 axis[2]=[tickmarks=[seq(i*Pi/4=i*Pi/4-2*Pi,i=1..7),0=0],
                          gridlines=[8,subticks=2]]);

@DJJerome1976 

plots:-polarplot(4, coordinateview = [0 .. 6,0 .. 2*Pi], thickness = 3,
                 axis[2]=[tickmarks=[seq(i*Pi/4=InertForm:-Display(i*Pi/4-2*Pi),
                                         i=1..7), 0=0],
                          gridlines=[8,subticks=2]]);


Download polar_ticks_rev.mw

@emendes Yes, my Answer was submitted first. (I saw it alone, right after posting it.)

However, I do not care about votes, etc. Mark as "best" whichever you feel is best.

I have now seen another thread on this site in which later Answers appear at top (even without having more votes). It's a new bug in this forum itself.

@zenterix A few ways, for fun...

restart;

T := <1,2;3,4>;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})

Q := copy(T):
Q[1,2] := K:
Q[2,1] := 700:
Q;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

Matrix(op(1,T),
       (i,j)->`if`([i,j]=[1,2],K,
                   `if`([i,j]=[2,1],700,T[i,j])));

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

Matrix(op(1,T),
       (i,j)->piecewise([i,j]=[1,2],K,
                        [i,j]=[2,1],700,
                        T[i,j]));

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

T;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})

Download misc_mat.mw

Duplicate Question threads on solving this polynomial system F1=eval(ode,K) may be flagged as such and deleted.

You can put your followup queries (eg. about various options to solve, other techniques, post-processing and selection amongst solutions, etc) on solving this polynomial system here.

@salim-barzani I read that other mp3.mw attachment, and the .pdf file. It was a related query on the same underlying topic.

Please put such closely related followup queries in a single Question thread (or at the very least, utilize the Branch button to automatically link them). Wholly separate duplicate threads may get flagged as such and may be deleted.

ps. I have read all the (many) questions/worksheets by previous grad students asking for help on this topic on this forum, as well as all the responses.

@salim-barzani I have deleted yet another duplicate Question thread by you on this problem.

(I discussed this with the site admin a few days ago.)

I have deleted a duplicate Question thread of this.

If you have additional details or related queries on this example/task then please add them here instead of in a separate new Question.

@C_R As stated, your middle paragraph's claim is not true. You wrote, "In Unit:-Simple Maple does not assume anything. The unit of x is left open and no dimensional check is performed unless x is assigned to a value."

Some dimensional checks are done even if x has no assigned value, with Units:-Simple loaded. Perhaps you instead meant to write that no dimensional test is done directly on x itself. That's not what you wrote.

Some dimensional checks are indeed done. That's why the OP's second example fails under Units:-Simple. The dimensional checks performed in that example -- on the terms to which unassigned x is added -- lead to a contradiction.

with(Units:-Simple):

(x+Unit(m))*(x+Unit(s));

Error, (in Units:-Simple:-*) the following expressions imply incompatible dimensions: {Units:-Unit(m)+x, Units:-Unit(s)+x}

Download unsimpex.mw

@Thomas Richard Even with Units:-Simple loaded (via with(Units), or explicitly), there'll always be someone generating expressions with uncombined units.

Eg. using subs instead of the eval export.

@Thomas Richard I feel that another example is useful here, for two reasons:

1) Units:-Split does not first combine units.
2) convert(..,unit_free,t) also allows the unit to be assigned to unevaluated name t.

restart;

expr := 4*x*Unit(cm) + 3*Unit(mm);

4*x*Units:-Unit(cm)+3*Units:-Unit(mm)

 

A,B := Units:-Split(combine(expr,':-units')):

A,B;

(1/25)*x+3/1000, Units:-Unit(m)

S := convert(expr,':-unit_free','T'):

S,T;

(1/25)*x+3/1000, Units:-Unit(m)

Download units_split.mw

Note that with the combine, Split merely returns the expression, and 1 (one) for the unit. (Maple 2024.0)

expr := 4*x*Unit(cm) + 3*Unit(mm);

4*x*Units:-Unit(cm)+3*Units:-Unit(mm)

Units:-Split(expr);

4*x*Units:-Unit(cm)+3*Units:-Unit(mm), 1


Of course, for the OP's original example no extra combine(..,units) or simplify call is needed.

Note that in general that combining also has the effect of turning the result into the base units for the current system, eg. m=meter for SI in the original example. Neither Split alone nor convert(...,unit_free) will affect the units in these (...no addition):

g_moon := 1.635000000*Unit(('m')/'s'^2):

 

A,B := Units:-Split(g_moon):

A,B;

1.635000000, Units:-Unit(m/s^2)

S := convert(g_moon,':-unit_free','T'):

S,T;

1.635000000, Units:-Unit(m/s^2)


These don't change to base units (...no addition).

foo := 1.635000000*Unit(cm/year):

 

A,B := Units:-Split(foo):

A,B;

1.635000000, Units:-Unit(cm/yr)

S := convert(foo,':-unit_free','T'):

S,T;

1.635000000, Units:-Unit(cm/yr)

ps. The Units:-Split command was introduced in Maple 2021, and is not available in earlier versions. The convert(...,unit_free) call works in all previous releases having the Units package.

@salim-barzani See the following attachment, which behaves like dharr's f12, which he ran using Maple 2023.

f12_dharr_ac_2021.2.mw

I converted one expression to `diff` to enable a key substitution to work in Maple 2021, since you have that version.

@salim-barzani 

Please stop posting multiple wholly separate Question threads for the same items.

Such duplicates get flagged as such and may be deleted.

[edit] You can use the Branch button at the bottom of this Question to create a new related Question thread with cross-reference links, so that the content and details are not split.

I have deleted a duplicate of this.

First 31 32 33 34 35 36 37 Last Page 33 of 592