Carl Love

Carl Love

28015 Reputation

25 Badges

12 years, 296 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

Your first version of eqd has a coefficient of omega0^2 on the y(t) term. The coefficient is omitted in the second version. If I include the coefficient in the second version, then I get the same phase portrait, the nearly concentric circles.

plot([B(t), A(t), t= t1..t2]);

where t1..t2 is some definite range of t-values.

For your first case, the derivative of f(x,y) with respect to t is, of course, 0. Perhaps you mean Diff(f(x,y,t), t, t)?

Your second case is a partial differential equation because the unknown function has more than one independent variable. Consequently, the command is pdsolve rather than dsolve.

pdsolve((Diff(f(x,y), (x,y), (x,y)))*x+(Diff(f(x,y), (x,y)))*y = 0, f(x,y));

In Kitonum's answer, take the line with the map command, and change the last character of that line from a colon (:) to a semicolon (;). Then you will see the output.

You could also do f(0.5), f(0.9), etc.

I wasn't chastising you for bad vocabulary. I truly didn't understand which alternative you meant. But Kitonum figured it out.

When you assigned sysdiff and fcns, you used curly braces ({ }). In your dsolve command you used them again. So the first argument is now a set containing a set rather than the set containing equations that is expected. So, changing the dsolve command to dsolve(sysdiff, fcns) will produce a solution. But like your other systems from today, the solution contains spurious constants of integration. So once again, make the command

dsolve(sysdiff, fcns, method= laplace);

This is very similar to an earlier problem you had from today where Preben suggested adding method= laplace to the dsolve arguments. That works here also, and it is the only thing that you need to add to get the plots. I don't know why it works. The reason that the result from the plain dsolve would not plot was that there were still integration constants left in the solution. (Should it be considered a bug?)

Remember, if you use dsolve(..., numeric) then you should use plots:-odeplot for the plotting (it is possible to use plot also with numeric, but it requires a different syntax).

It's essentially the same situation as with your last question. The difference is that this is solve rather than dsolve. You assign the result of the solving command to a variable. In this case, you used solution as the variable. Then my recommended technique is to access the contents of solution with the eval. To get the plot in this case, try

plot(eval(C2, solution), omega= 0..2, -3..3);

You wrote: How to get all solution?

I would think that with the huge number of similar Questions that you've asked (and have been Answered) over the past year that you'd be able to figure that out on your own by now.

I think that it is silly to ask for all solutions to this problem because there are a huge number, and most subsets of four points are a solution.

Nonetheless, all the solutions can be obtained with this code, which takes more than 30 minutes to run:

Sols:= table():
for P4 in combinat:-choose(L,4) do
     ct:= 0; #count non rt triangles for this group of 4 pts.
     for P3 in combinat:-choose(P4,3) do
          geom3d:-triangle(
               ABC,
               [seq](geom3d:-point(A||k, P3[k][]), k= 1..3)
          );
          if geom3d:-IsRightTriangle(ABC) then  break  end if;
          ct:= ct+1
     end do;
     # 4 triangles can be made from 4 pts: C(4,3) = 4.
     if ct = 4 then  Sols[P4]:= [][]  end if
end do:

Sols:= {indices}(Sols, nolist):
nops(Sols);

                             276392

A better technique is to use a Monte Carlo method to approximate the number of solutions. We use combinat:-randcomb to repeatedly select four points at random.

N:= 2^10:   #number of random trials
sol_ct:= 0: #number of solutions found
for k to N do
     P4:= combinat:-randcomb(L, 4);
     ct:= 0; #count non rt triangles for this group of 4 pts.
     for P3 in combinat:-choose(P4,3) do
          geom3d:-triangle(
               ABC,
               [seq](geom3d:-point(A||k, P3[k][]), k= 1..3)
          );
          if geom3d:-IsRightTriangle(ABC) then  break  end if;
          ct:= ct+1
     end do;
     # 4 triangles can be made from 4 pts: C(4,3) = 4.
     if ct = 4 then  sol_ct:= sol_ct+1  end if
end do:

trunc(evalf(sol_ct/N)*binomial(nops(L), 4));


                             278336

There are two ways: You can use dsolve(..., numeric) and plots:-odeplot, or you can use an analytic dsolve solution with a parametric plot.

restart:

sys:= diff(x1(t), t$2) = f, diff(x2(t), t$2) = g:

fcns:= x1(t), x2(t):

ICs:= x1(0) = -1, D(x1)(0) = 0, x2(0) = 0, D(x2)(0) = 0:

f:= -k1*x1(t) + k2*(x2(t)-x1(t)):

g:= -k2*(x2(t)-x1(t)) - k3*x2(t):

k||(1..3):= 4, .8, 4:

Purely numeric solution allows you to use odeplot.

Sol_N:= dsolve({sys,ICs}, {fcns}, numeric):

plots:-odeplot(Sol_N, [D(x1)(t), x1(t)], t= -10..10, numpoints= 2^10);

And do likewise for the other plot that you want.

 

We can get the same plots with the purely analytic solution.

Sol_A:=  dsolve({sys, ICs}, {fcns});

{x1(t) = -(1/2)*cos(2*t)-(1/2)*cos((2/5)*35^(1/2)*t), x2(t) = -(1/2)*cos(2*t)+(1/2)*cos((2/5)*35^(1/2)*t)}

There's no need to use evalf. I would like to discourage you from using assign. Usually, eval is easier to work with.

plot(eval([diff(x1(t), t), x1(t), t= -10..10], Sol_A), numpoints= 2^10);

 


Download phaseportrait.mw

I've experimented computationally with f(n) and discovered some very interesting properties. These would need to be proven of course.

Conjecture 1: If n > 2 and 2*n - 1 is prime, then f(n) is divisible by 2*n - 1.

I've verified this up n = 6940.

My second conjecture implies the first, and is much stronger. I've also verified it up to n = 6940.

Conjecture 2:If n > 2 and 2*n - 1 is prime, then 2*n - 1 is the largest prime factor of f(n).

So, even though f(6940) is a huge number with 4173 decimal digits, its largest prime factor is only 2*6940 - 1 = 13,879 (with only 5 digits). That's amazing!

Considering the huge size of f(n), my next conjecture "almost implies" the first two.

Conjecture 3: If n > 0, then f(n) has no prime factor greater than 2*n - 1.

Since your worksheet is long, I stopped reading after I found the first mistake. So, I don't know if this mistake is the ultimate cause of your issue. Correct the mistake, and if you still have your issue, then repost the corrected worksheet, and I'll have another look. (And if you don't still have the issue, please post a followup and say so!)

The mistake is that at one point you mispelled unapply as unpply. It's when you're defining I[Lm2] almost halfway through the worksheet.

You have three problems. The first is a trivial typo. Before the fprintf, you have a "*" which should be a ";". The second is that solve returns multiple solutions, some of which are not real. Your formatting is expecting a single real value. To get a single real value, use fsolve instead of solve (in both cases). The third problem is that with your current settings, each loop is going to execute 3 million times. Do you really want to spend the time required for that? If not, then you either need to reduce the 81920 or increase the value of dtt.


Set all variables to their initial state:

restart:

Define a function...

f:= x-> x^2 + 2*x - 3;

proc (x) options operator, arrow; x^2+2*x-3 end proc

...and its derivative

df:= D(f)(x);

2*x+2

The derivative evaluated at x = 2.

eval(df, x= 2);

6

Another way for the same thing.

D(f)(2);

6

Equation of tangent line at x = 2:

TanLine:= y = f(2) + D(f)(2)*(x - 2);

y = -7+6*x

Plot of the function and the tangent line near the point of tangency.

plot([f(x), eval(y, TanLine)], x= -2..4);

Solve for the derivative being 0.

solve(df = 0, {x});

{x = -1}

 


Download 1stMapleCalcI.mw

The desired expansion is not true for general A and B. (Consider A = B = -1, a = 1/2.) It is necessary to assume that they are positive. The sign of a doesn't matter.

Here are three ways:

expand((A*B)^a) assuming A>0, B>0;

expand((A*B)^a) assuming positive;

simplify((A*B)^a, symbolic);


[Edit: I completely redid this Answer, using all the original variable names, minus the underscores.]

There is a unique solution to your system. To reduce the visual space needed to present the solution, I removed the underscores from all of your names.

 

restart:

for k to 4 do
     e||k:= Vector(4);
     e||k[k]:= 1;
     X||k:= Vector(4, symbol= x||k);
od:

B:= [e1+e4, e2, 0, e1+e4]:

C:= [a,b,c,d]:

for k to 4 do
     eq||k:= add(cat(C[j],k) * X||j, j= 1..4) =~ B[k]
od:

Sol:= solve(
     convert(< eq||(1..4) >, list),
     [seq](seq(x||k[j], j= 1..4), k= 1..4)
):

The solutions all have the same denominator, of course---the determinant of the coefficient matrix. To save space I'll remove the denominators from the solutions.

Numers:= map(lhs=numer@rhs, Sol[]);

[x1[1] = -b1*c2*d3+b1*c3*d2+b2*c1*d3-b2*c3*d1+b2*c3*d4-b2*c4*d3-b3*c1*d2+b3*c2*d1-b3*c2*d4+b3*c4*d2+b4*c2*d3-b4*c3*d2, x1[2] = -b1*c3*d4+b1*c4*d3+b3*c1*d4-b3*c4*d1-b4*c1*d3+b4*c3*d1, x1[3] = 0, x1[4] = -b1*c2*d3+b1*c3*d2+b2*c1*d3-b2*c3*d1+b2*c3*d4-b2*c4*d3-b3*c1*d2+b3*c2*d1-b3*c2*d4+b3*c4*d2+b4*c2*d3-b4*c3*d2, x2[1] = a1*c2*d3-a1*c3*d2-a2*c1*d3+a2*c3*d1-a2*c3*d4+a2*c4*d3+a3*c1*d2-a3*c2*d1+a3*c2*d4-a3*c4*d2-a4*c2*d3+a4*c3*d2, x2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b2*c3-a1*b3*c2-a2*b1*c3+a2*b3*c1-a2*b3*c4+a2*b4*c3+a3*b1*c2-a3*b2*c1+a3*b2*c4-a3*b4*c2-a4*b2*c3+a4*b3*c2, (2) = a1*b3*c4-a1*b4*c3-a3*b1*c4+a3*b4*c1+a4*b1*c3-a4*b3*c1, (3) = 0, (4) = a1*b2*c3-a1*b3*c2-a2*b1*c3+a2*b3*c1-a2*b3*c4+a2*b4*c3+a3*b1*c2-a3*b2*c1+a3*b2*c4-a3*b4*c2-a4*b2*c3+a4*b3*c2})

 

To be completely rigorous, we need to show that there is at least one assignment of numeric values to the coefficients that makes the denominator non-zero. This is of course trivial to do, and I leave it to you.

Download 16eqns.mw

 

First 362 363 364 365 366 367 368 Last Page 364 of 394