Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

I get this plot:

It's a circle of radius 5 centered at the orgin bisected by a diameter pitched at angle Pi/9. That seems to be exactly what you specified. So, what's wrong?

@Racine65 Don't be misled that that's giving you the exact value of (1/2)! just because you used the keyword exact. Rather, it's giving you the exact rational value of 0.8862269255, which is the 10-digit decimal approximation of (1/2)!.

The simplest form of the exact value is sqrt(Pi)/2. It's an irrational number, and Maple has many ways to get there starting from (1/2)!. Is that not acceptable to you?

@izhammulya Sure: You can color particular edges or all edges the same color or each edge a different color all with GraphTheory:-HighlightEdges. In the example below, I continue from the code above and color each edge based on its relative length:

Dist:= (v1,v2)-> evalf(norm(<P[v1]-~P[v2]>, 2)): #P is your list of vertex coordinates.
E:= [GT:-Edges(G)[]]: # [...[]] converts set to list
dists:= (Dist@op)~(E): #List of edge lengths.
(maxD,minD):= (max,min)(dists):
GT:-HighlightEdges(G, E, [seq(COLOR(HSV, .85*(d-minD)/(maxD-minD), .85, .85), d= dists)]);
GT:-DrawGraph(G);

A similar treatment can be given to the vertices using GraphTheory:-HighlightVertex.

@muchlove What data should I use for the x-errors? Do you have a separate list of those?

@garth 
 

restart:

#All given info:
ode:= diff(y(t),t) = (3-y(t))*(y(t)+1); #NB: y(t), not just y
(a,b):= (0,5); #interval
ic:= y(a) = 4;
Delta__t:= 1.0;

diff(y(t), t) = (3-y(t))*(y(t)+1)

0, 5

y(0) = 4

1.0

Y__exact:= dsolve({ode, ic});

y(t) = -(exp(-4*t)+15)/(exp(-4*t)-5)

Y__Euler:= dsolve(
   {ode, ic}, numeric, method= classical[foreuler], stepsize= Delta__t,
   output= Array([seq(k, k= a..b, Delta__t)])
);

Vector(2, {(1) = Vector[row](2, {(1) = t, (2) = t}), (2) = Matrix(6, 2, {(1, 1) = 0., (1, 2) = 4., (2, 1) = 1.0, (2, 2) = -1.0, (3, 1) = 2.0, (3, 2) = -1.0, (4, 1) = 3.0, (4, 2) = -1.0, (5, 1) = 4.0, (5, 2) = -1.0, (6, 1) = 5.0, (6, 2) = -1.0})})

Arrows:= DEtools:-dfieldplot(ode, y(t), t= a..b, y= -2..5, color= yellow);

Curves:= plot(
   [eval(y(t), Y__exact), Y__Euler[2,1]], t= a..b,
   style= [line, pointline], linestyle= [solid, dash], legend= [Exact, Euler],
   thickness= [2,1],
   symbolsize= 20
);

plots:-display([Arrows, Curves], gridlines= false);

 


 

Download Euler_fieldplot.mw

This site renders the plots (rather than just using a GIF) and makes a few errors in doing so. The plot actually looks like this:

@radaar Please post your code. I may be able to re-arrange your evalhf so that it works. However, I won't be able to do it if the computation is inherently symbolic. You just need to post the plaintext file that you pass to read; I don't need to see any output.

@radaar You cannot use a restart statement in "a procedure or from a file being read by the read statement." Recalling your other recent Question, I believe that you are using a read statement, on my recommendation.

Regarding evalhf: It often requires some arcane and lengthy syntax to workaround evalhf's severe restrictions, but it is very often worth it. I often get a factor-of-25 speedup from it. 

@colin12345678 The scope of the derivative in the reference that you linked does not include the integral. The derivative is specified as dK/dbeta, which is just a simple derivative rather than a differential operator.

Your 25%-75% x 100x algorithm sounds very strange to me. Do you have a reference for it, or did you just make it up? Is there something unusual about this dataset?

@Hassan Alkomy Your work is okay. It wasn't clear in your original Question that FyjR is an expression that depends on j. From what you've shown, it appears to be a simple variable name. If it depends on j, everything is fine with the sums.

Please re-enter both your original expression for Gc and your desired simplified form with all multiplications explicitly specified.

Also, you say that ab, and are to be determined by Maple, yet b (definitely) and (possibly) appear in the original Gc, so it doesn't make sense to me to "determine" them. So please clarify that. 

I think that the fastest code to calculate an arbitrary position[*1] in the Fibonacci sequence is also the briefest:

F:= n-> (<1,1;1,0>^(n-1))[1,1];

(For the OP: <1,1;1,0> is the 2x2 matrix

1  1
0  1,

and the [1,1] selects the row 1, column 1 entry.)

I believe that the TI-84 handles small-matrix arithmetic. You may need to make a free download from TI to get a matrix upgrade.

A similar matrix method can be constructed for any linear recurrence with constant coefficients (regardless of order).

[*1]Direct application of the recurrence is probably fastest for generating an entire initial segment of the sequence.

 

@radaar So, nothing at all happens when you enter the read command at the prompt, then press Enter? You don't even get a new prompt? What happens if you enter 2+2;? What about sin(Pi);?

@Kitonum The OP means that given a positive rational number u, find rational numbers abc, such that u = a*b/2 and a^2 + b^2 = c^2.

@radaar Assuming that the file contains commands that would ordinarily display output (e.g., they end with semicolon), it should appear immediately on your screen.

First 280 281 282 283 284 285 286 Last Page 282 of 708