gkokovidis

2370 Reputation

13 Badges

20 years, 291 days
Draeger Medical Systems, Inc.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

MaplePrimes Activity


These are answers submitted by gkokovidis

See if the examples in this post are helpful.  The concept is the same.

 

Regards,
Georgios Kokovidis
Dräger Medical

The code below is a step in the right direction.  It bypasses the for loop.   The output is in Fortran format, but not exactly what you want.  Using printf might be a better choice.

> restart:
> with(CodeGeneration):
> ans:=[seq(exp(i),i=1.0..10.0)]:
> Fortran(ans):
 

 

Regards,
Georgios Kokovidis
Dräger Medical

Output of solve has 2 solutions for nstart.  By enclosing the output in square brackets, you are puting it into a list.  Then you can select which of the two answers you want to substitue values for.

>eq1 := 1/L = R*(1/nfinal^2-1/nstart^2);

>sol1:=[solve(eq1, nstart)];

>sol1[1];

>sol1[2];

>eval(subs(L = 6.561123702*10^(-7), nfinal = 2, R = 0.1097373e8, sol1[1]));

>eval(subs(L = 6.561123702*10^(-7), nfinal = 2, R = 0.1097373e8, sol1[2]));

 

 

Regards,
Georgios Kokovidis
Dräger Medical

 

>restart:

>eq1:=( 1/L = R*(1/nfinal^2-1/nstart^2) );

eq1 := 1/L = R*(1/(nfinal^2)-1/(nstart^2))

>solve(eq1,L);

-nfinal^2*nstart^2/R/(-nstart^2+nfinal^2)


  I added a multiplication sign after the R. Does this align with what you got?

 

Regards,
Georgios Kokovidis
Dräger Medical

Scilab plot for comparison of cos(x)-x, 100 points over the range.

x=linspace(-10^(-16),10^(-16));

plot(cos(x)-x);

 

Regards,
Georgios Kokovidis
Dräger Medical

Search for DynamicSystems or type ?DynamicSystems and hit the enter key in Maple.

You can browse some of the applications in the Maplesoft Applications Center as well.  Here is a link.

 

 

Regards,
Georgios Kokovidis
Dräger Medical

Take a look at the help files for the subs and alias commands.

>?subs

>?alias

 

Regards,
Georgios Kokovidis
Dräger Medical

Start with the help pages for the mod command.

?mod

The not equal to operator (<>) is useful as well.

If ......  else is one way, while ........ do is another.

This should help to get you started.

Regards,
Georgios Kokovidis
Dräger Medical

The legend option for the plot command is one way to do this.  If you want a label next to each of the curves in a location of your own choosing, then you have to use the textplot command together with plot.

From the help page for plot:

>plot([sin, cos], -Pi..Pi, title="Simple Trig Functions", legend=["Sine", "Cosine"]);

or

>with(plots):

> p := plot([sin, cos], -Pi..Pi):
> t1 := textplot([2,1,`Sin`]):
> t2 := textplot([-1/2,1,`Cos`]):
> display({p,t1,t2});

 

Regards,
Georgios Kokovidis
Dräger Medical

 

Here is one way to do this, if you want to pick a number from a list that you created, in a random fashion.

>restart:

>randomize();

>L:=[seq( sin(Pi*i/7), i=0..10 )];

>K:=nops(L);

>M:=RandomTools[Generate](integer(range=1..K));

>L[M];


 

 

Regards,
Georgios Kokovidis
Dräger Medical

Check the bottom of this page to see if there is something useful there.  If not, post the equation of your curve.

 

Regards,
Georgios Kokovidis
Dräger Medical

Yes, you have to compile it to use it.  See ?examples,ExternalCalling for options on how to do this with different compilers.  Maple comes with the Watcom compiler.  I have successfully used the Microsoft Visual C++ Express Edition, which is a free download from the Microsoft site.

 

Regards,
Georgios Kokovidis
Dräger Medical

 

The Application Center has a routine that might be useful to you for finding roots and displaying the x,y pairs.   Attached is a worksheet with your last function.  Based on the tolerance, your answers will match what you got from the Roots function in the Student Calculus package.  Download 221_roots.mws
View file details

 

Regards,
Georgios Kokovidis

Dräger Medical

 

Using  Student[Calculus1]:-Roots(expr, x = -10 .. 10, numeric);  where expr is your new expression with b:=cos(x), you will get a diiferent set of answers.  So, to answer your question, yes it does.  Did you try it, and did it not work for you?  Below are the values that I got.

[-4.367042332, -3.390886872, -1.144307303, 3.088083981]

 

Regards,
Georgios Kokovidis
Dräger Medical

Use the numeric option when calling Roots, from the Student[Calculus1] package, over the range of interest.

>restart:
>with(Student[Calculus1]):
>Roots(x^2/20-10*x-15*cos(x+15),x=0..210,numeric);

[1.274092075, 200.1193789]

Regards,
Georgios Kokovidis
Dräger Medical

First 32 33 34 35 36 37 38 Last Page 34 of 75