tomleslie

5348 Reputation

17 Badges

9 years, 299 days

MaplePrimes Activity


These are answers submitted by tomleslie

You need to tell maple that the function q1(t) has units of Coulombs, and similarly diff(q1(t), t) has units of coulombs/sec (or amperes if you prefer). The following executes

restart:
R := 500*Unit(ohm);
C := .5*Unit(microfarad);
V := 20*Unit(volt);
ode := R*diff(q1(t), t)*Unit(coulomb)/Unit(second)+q1(t)*Unit(coulomb)/C = V;
dsolve(ode);

but the result for q1(t) is displayed without units :-(

I've tried a few variations of the above, same outcome

I obviously misunderstood - still you could use

   restart;
   convert(taylor(y(x+h), h=0, 4), polynom);
   convert(%,diff);

where the last line is only necessary if you don't happen to like D-operator format

I think that the fundamental issue is with the value of numpoints - you are "subsampling" the ode solution for plotting purposes - which makes the plot *look* really weird: I (rather arbitrarliy) set numpoints=10*tmax, in an attempt to ensure that I always got the same number of point on each cycle, regardless of the number of cycles performed: this seemd to make things *appear* more sensible.

I thought that using dsolve/odeplot might give simpler control over numeric errors compared with DETools/DEPlot - this doesn't *seem* to be true. Both give approximately the same answers up to tmax=2000 (with numpoints=10*tmax), although I do have to explicitly remove the maxfun limit in the dsolve() command.

From around tmax~800, one can start to see error issues, although both solution methods still show the solution in the limit cycle

I tried it all the way up to tmax=2000 and the solution stays within the limit cycle.

See attached

nonLinOsc.mw

Don't have Mathematica so can't really check, but as far as I can tell

  1. Maple imports .mma, but does not export it
  2. Mathematica does not import or export .mw(s)
  3. So only option would seem to be: pick a format both support - eg mathML(?). Maple exports it and Mathematica imports it. I suspect that success/failure of this approach depends on the "complexity" of the info to be exported/imported

From maple MathML:-Export

appears to work (no messgaes/complaints) for both of the expressions you quote.

Like I said earlier, I can't check whether Mathematica's mathML import, will import/convert correctly

The attached runs in about 0.25secs on my machine and produces plausible-looking plots

DEprob.mw

 

I think there may be a few problems with the code you posted

  1. if you want 3.14159... you have to use Pi everywhere, not pi
  2. there seems to be a missing operator in the expression

#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));
arctan(tan(q), 1 - 0.3055555556 tan(q))      <--  6 tan ?????

If I use Pi for pi throughout, and replace the above snippet with

#funzione desiderata
Yd(q) := arctan(tan(q),(1 - b*tan(q)/2/p));
arctan(tan(q), 1 - 0.3055555556 * tan(q))

Then NLPsolve still returns the error message

Error, (in Optimization:-NLPSolve) abs is not differentiable at non-real arguments

:-(

However

DirectSearch[Search](rms, [z = -0.4..0,
                                         alpha0 = 0..Pi/3,
                                         alpha1 = Pi/2..5*Pi/4,
                                         l1 = 0.3..1,
                                         l2 = 0.001..0.3,
                                         l3 = 0.01..0.3
                                      ]
                              )

returns

1.20098330185160, [alpha0 = 9.10801161719342*10^(-8), alpha1 = 1.57079638010262, l1 = .496239599198213, l2 = .260891601089832, l3 = 0.100000115197816e-1, z = -0.841913363553979e-2], 84]

If I understand your requirement correctly, then the attached performs the relevant calculation. Results aren't very exciting though!

pdeProb.mw

  1. Why use partial derivative symbols when you seem to have functions (u and v) of only one variable?
  2. You have to make the function dependencies obvious - easiest way is to write u(x), v(x)

See the execution groups I have added to your worksheet

intPar.mw

Since it seems(?) that you want to plot *real* values (which Maple won't assume), then you could use

with(RealDomain):
plot(x^(1/3), x=-1..1);
plot(x^(4/3)*sin(1/x), x=-1..1)

  1. Don't understand why you have defined your own atan2() function because Maple already has always had an inbuilt 2-element arctan() function, although you will have to multiply by 180/Pi if you want it in degrees
  2. The builtin functions min[index](A) and max[index](A) wil return the index values of minimum (maximum) elements for pretty much any indexable structure A- list, array, matrix whatever. I believe that this functionality was added for Maple 2015, so if you have an earlier version.......
  1. I commented out the forget(evalf) and Digits() commands because I don't think you need them. Uncomment them if you want to
  2. I added some plot options (color, symbol) so that I/you could easily tell which plot was being generated by which command

So just run the attached

plotProb.mw

  1. The function ge() is not doing what you think! ge(x,y) returns 1 if x>=y and 0 otherwise. You should be using >=.
  2. However making the above change does not solve your problem. As the manual says "The isolve command has some limited ability to deal with inequalities"
  3. You can however use solve() with assumptions, as in

restart;
n := 2;
solve(sum(a[k], k = 1 .. n)-1 = 1, useassumptions) assuming a[1]::nonnegint, a[2]::nonnegint;

Counterexample: since 5*15 = 75 mod 90 and 75 is not a member of {5, 15, 25, 45, 55, 65}, the set does not exhibit closure under the defined operation and hence cannot be a group

Based on your response last time, best thing I can do is make absolutely no comment on the code whcih you posted.

Assuming I haven't made any typos, I think  the graphs you want are shown below

restart;
with(plots):
ode := diff(y(x), x, x) = x*y(x)+x^(17/12);
ics := y(1000) = 0, y(1001) = 1;
sol:=dsolve({ode,ics}, numeric);
odeplot( sol,[x, y(x)], x=1000..1001);

First 104 105 106 107 108 109 110 Last Page 106 of 119