Items tagged with programming programming Tagged Items Feed

Hello,

I would like to plot coupled elliptic parametric curves.

I have a problem in the for loop in my code. The index i of the phi variable is not incremented.

Here my code:

for i to 4
do
u[i]:=t->L/2*cos(w*t);
v[i]:=t->H*sin(w*t+phi[i]);
end do;

The result looks like this :

u[1](t) -> - L cos(w t)
v[1](t) -> H sin(w t + phi[i])

u[2](t) -> - L cos(w t)
v[2](t) -> H sin(w t + phi[i])

u[3](t) -> - L cos(w t)
u[3](t) -> H sin(w t + phi[i])

u[4](t)  -> - L cos(w t)
u[4](t)  -> H sin(w t + phi[i])

And i would have prefered :

u[1](t) -> - L cos(w t)
v[1](t) -> H sin(w t + phi[1])

u[2](t) -> - L cos(w t)
v[2](t) -> H sin(w t + phi[2])

u[3](t) -> - L cos(w t)
v[3](t) -> H sin(w t + phi[3])

u[4](t)  -> - L cos(w t)
v[4](t)  -> H sin(w t + phi[4])

Do you have ideas how I can obtain iteration on my phi variable ?

Thank you for your help.

 a new function from an existing function and how?

http://www.mapleprimes.com/posts/38019-Calling-Out-To-C-From-Maple#

if i can use maple to call c# function such as AForge.QLearning

how to set some tasks for it to guess some system of polynomials to fit hibert series criteria?

how to set a game for it to run itself to discover itself?

When assigning a color to a given wave length I initially used ColorTools WavelengthToColor. Acer commented that this wasn't the most accurate. I looked into this a little further and it seems there could be a better result. The attached document compares some different ways of assigning colors to wave lengths. 

Warning- The CIEDE2000 computation for deltaE is very slow. I think this is because of the hue angle calculations which use piecewise a lot. The CIE94 delta E method produces nearly the same result and takes minutes instead of hours.

 

Questions;

 I think I could speed up my calculation if I could find the position of the minimum element of an Array similar to FindMinimalElement of a list. 

I created my own atan2 function (similar to Excel). If there were a built in Maple equivalent perhaps it would be faster? I didn't see any such function.

6bit_Wavelength_Color_CIEDE2000.mw

Hello,

I have an error in my code. I don't know where it came from. Earlier today I loaded this and it worked fine and now an error comes up. Any help is greatly appreciated! Thank you in advance!

Kind regards,

Gambia Man

with(plots):

``

HyperionOrbit := proc (`θIC`, `ωIC`) local a, Mh, Msat, G, e, beta, M, Eqns, Th, ICs, soln, `ωH`; a := 1.501*10^9; Mh := 5.5855*10^18; Msat := 5.6832*10^26; G := 6.67259/10^11; e := .232; beta := .89; M := Mh+Msat; Eqns := diff(theta(t), t) = omega(t), diff(omega(t), t) = -G*Msat*beta^2*(xH(t)*sin(theta(t))-yH(t)*cos(theta(t)))*(xH(t)*cos(theta(t))+yH(t)*sin(theta(t)))/(xH(t)^2+yH(t)^2)^2.5, diff(xH(t), t) = vxH(t), diff(vxH(t), t) = -G*M*xH(t)/(xH(t)^2+yH(t)^2)^(3/2), diff(yH(t), t) = vyH(t), diff(vyH(t), t) = -G*M*yH(t)/(xH(t)^2+yH(t)^2)^(3/2); Th := sqrt(4*Pi^2*a^3/(G*(Mh+Msat))); `ωH` := 2*Pi/Th; ICs := xH(0) = a*(1+e), yH(0) = 0, vxH(0) = 0, vyH(0) = sqrt(G*M*(1-e)/(a*(1+e))), theta(0) = `θIC`, omega(0) = `ωIC`; soln := dsolve({Eqns, ICs}, numeric); odeplot(soln, [theta(t), omega(t)/`ωH`], 0 .. 5*Th, numpoints = 2000, labels = ["θ(t)","ω(t)/ωH"], axes = boxed) end proc

HyperionOrbit(.5, 1.8*`ωH`)

Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)

 

Error, (in dsolve/numeric/SC/IVPpoints) unable to store '11.3097335529232/Th' when datatype=float[8]

 

``

``

``

 

Download Poincare_section.mw

Hello everyone!

This is a procedure which I have writern. I know I write false, X=x because in maple, x is a table.although I did write x::Vector. Can you help me? Sorry, my English is not very good! :( 

JACOBI.mw

Hello everbody!

Jacobi:=proc(A::Matrix,b::Vector,x,epsilon,m)  

uses LA=LinearAlgebra;  

local      i,k,n:= LA:-RowDimension(A),    

        x:= Vector(LA:-RowDimensions(A)),    

        p:= Vector(LA:-RowDimensions(A));  

k:=1;

 while  k<=n do      

       for i to n while i<>j do          

          x[i]:=1/(A[i,i])*(-add(A[i,j]*p[j],j=1..n)+b[i]);       end do;      

        if abs(x-p)<epsilon do return x; end if;    

       k:=k+1;    

       p:=x;

 end do;  

x;  

end proc:

Hello,

I'm having some issues with this procedure it seems to take a very long time to evaluate. There is also an error in the Histogram I can't seem to fix... Does anybody know why? Any help would be greatly appreciated! Thank you in advance!

Kind regards,

Gambia man

Last_part2.mw

Hi everyone, I'd like to know if it's possible to use the startup code editor as a general editor when writing large programs. It nicely recognizes keywords such as "if" and "proc" and you can indent code using TAB. However I'm not sure whether you can/should use it as a general editor to run code. I've read something about user-profiles related to the startup code but I just don't understand how it works.

Hello, 

Im a chemical engineer student with very little knowledge of Maple and its possibilities (which seem endless). I have very little coding experience, even though i do write in LaTeX (which i suppose is referred to as pseudo-code). 

I figured, that as a student, i often run into the same number x problems, that each can be solved in x different ways. Since Maple is so good with units and calculations, aswell as defining variables. I could make some very smart notes, which would allow me to solve different (mostly simple) problems in a very easy and fast manner. 

Now, since i dont know much about Maple, i want to seek som help. 

How do i proceed to make such a document / multiple documents for my purpose? My first idea was to simply create a bunch of different variables defined to a given input, and then simply change the variables as i get a new problem. But i figured that there must be smarter and more neet ways to make this. 

Let me know what you think. 

 

Sincerely, Mikkel.

Hello

i was stuck with some simple problem. I tried using if condition in program that involves a truth condition. If maple cannot determine the condition is true or false i want to assign o to a particular varable. I  show a similar program.

 

restart;


h[1] := -1;

for i from 1 by 1 while(i<150 and h[i]<0) do


p1[i] := .989347189582843*x^2-0.139423979061219e-1*x-1.82559474469870*10^8*x^15+1.30761381361453*10^8*x^16-6.88520063191821*10^7*x^17+2.51079317463498*10^7*x^18-5.66094206949155*10^6*x^19+5.94129446612678*10^5*x^20-6812.74182685426*x^5+59230.0931084044*x^6-3.83520584559500*10^5*x^7+1.90126822307036*10^6*x^8-7.34991883857609*10^6*x^9+2.24203561757434*10^7*x^10-5.43284775909785*10^7*x^11+1.04806113793011*10^8*x^12-1.60600324339222*10^8*x^13+1.94090536353833*10^8*x^14+559.557918804679*x^4-30.6576714427729*x^3-3.93727537464007*10^(-15)-i^2-i; fsolve(p1[i]-0.312e-1, x, -1 .. 1);


if fsolve(p1[i]-0.312e-1, x, -.2 .. 0) < 0 then h[i+1] := fsolve(p1[i]-0.312e-1, x, -.2 .. 0) elif FAIL then h[i+1] := 0 end if;

print(i, h[i])

end do;

i got an error message

Error, cannot determine if this expression is true or false: () < 0

how can i get a value of 0 for h[i] if the error comes.

 

Thanks.

Aditya



 

Can i make a system of equations like this in maple?

 

What i am trying to do is i want to get all system of equations. For example when n=2, then we should get 8 equations like D(1,1,1), D(1,1,2),D(1,2,1),D(1,2,2),D(2,1,1),D(2,1,2),D(2,2,1) and D(2,2,2). If n=3 then the number of equations is 27 and so on. Can someone please advice me on this?

thanks

witribm

Maple’s Code Generation makes it possible to translate your Maple code to various other programming languages including C, Python, and several others. In Maple 2015, we added a new Code Generation target to one of my other personal favourite languages, R. R is a programming language designed for statistical computing and graphics, so no code translation from Maple to R would be complete without attempting to translate as many commands as possible from Maple’s Statistics package. 

Translating code from one language to another is tricky business. Maple 2015 represented the first time that any Code Generation target language added the ability to translate commands from the Statistics package. With R, we found that many common statistics commands had almost a one-to-one mapping, such as Statistics:-Mean = mean, but several others were much more complicated, including several commands for dealing with probability functions that did not have direct mappings due to differences in how the systems handle symbolic probability functions.

A list of statistics commands that can be translated from Maple to R can be found here.

In addition to assisting me recall the correct syntax in R, having worked with CodeGeneration[R] for several months now, I find that one of my most common uses for Maple’s code generation to R is simply to pass data between the systems. A simple example:

 CodeGeneration:-R( LinearAlgebra:-RandomMatrix( 5, 2 ) );

translates to the following in R:

 cg <- matrix(c(-4,27,8,69,99,29,44,92,-31,67),nrow=5,ncol=2)

To see a couple more short examples, here’s a short video that I recorded on Code Generation to R: https://www.youtube.com/watch?v=0Mn1W2j56aA

 

A little known fact about Code Generation is that the translation files can be viewed in from the “samples” directory in your Maple install directory. Similar to many of Maple’s packages, you can view all of the source code that Code Generation uses for its translations. For example, you can view the translations for the commands that I mentioned above from the “FunctionTable.mm” file inside of your “%MapleInstallDir%/ samples/CodeGeneration/R” directory.

Should you have any feedback on this translation, or any other, please feel free to contact us. We’re also on the hunt for our next code generation targets, so let us know what other languages you would like to see added as Code Generation targets.

I have a large program and when i add a line, i obtain as result [La longueur de sortie dépasse la limite de 1% noeuds]. pLease, can someone help me to continue my program.

Thanks in advance.

I have an expression of derrivative, lets say (D[2, 2](G))(x, y).

How to get this numbers - [2,2] programmicaly from it?

1 2 3 4 5 6 7 Page 1 of 8