Items tagged with map

Maple

It appears google doesn't know about the haversine formula.  Huh?  Well at least google can't draw the proper path for it.  I typed in google "distance from Pyongyang to NewYork city"  and got 10,916km.  Ok that's fine but then it drew a map

The map path definitely did not look right.  Pulled out my globe traced a rough path of the one google showed and I got 13 inches (where 1 inch=660miles) -> 8580 miles = 13808 km .. clearly looks like google goofed.

So we need Maple to show us the proper path.

```with(DataSets):
with(Builtin):
m := WorldMap();
Display(m):
```

Ok so you say that really doesn't look like the shortest path.  Well, lets visualize that on the globe projection

`Display(m, projection = Globe, orientation = [-180, 0, 0])`

Ah, now it is clear
Pyonyang_to_NewYork.mw

Unable to find where in my code "Thaw" is being ca...

Hello,

I'm having trouble seeing which command is calling the "thaw" for the code below and was wondering if someone is able to save me the trouble from working it out myself. i know its not when the "is" function is called from viewing the showstat for it, but the output prior to mapping that function pops out with no troubles, so im guessing its the generic mapping proc, but of course, in built function so i can only assume its the same way i would write it but im pretty sure i dont use thaw either so anyway the line in question:

map(is, seq(seq(map(eval, Matrix(3, omega[1]) = Matrix(3, omega[0]), [n = i, m = j]), i = 1 .. 10), j = 1 .. 10));
Error, (in thaw) too many levels of recursion

variable programing?...

hey is there a easy way to make maple solve an equation with similar different variables,

for eksample

defining the different variables

x_0:=1       x_1:=4           x_2:=10

setting up and equation

solve x * 5

recieving answers for all defined x variables

= [5,20,50]

back on the horse of course...

Hi, my question is concerning a "summand counting function" i require ie suppose for the following input

of [a+b+c,a+b,a+b+c+d,a] mapping this function will produce the output [3,2,4,1]

Append number to a list...

Experts,

This may sound like a dumb question, but i'm seeking a procedure to do it better.

with(combinat, setpartition) :
P := [\$2..5] :

Tours := setpartition(P);M:=nops(Tours)

 (1)

number of elements in each 'group'

seq(nops(Tours[i]),i=1..nops(Tours))

 (2)

i need to add 1 to each 'subgroup' : These are the first two:

[[[1,op(Tours[1,1])],[1,op(Tours[1,2])]],[[1,op(Tours[2,1])],[1,op(Tours[2,2])],[1,op(Tours[2,3])]]]

 (3)

I need to add 1 to each 'subgroup' in a more automatic way.

Vectorization of Symbolic Functions...

Maple provides efficient vectorization and automatic parallelization for many common operators. For example

`x -> 2*~x*~cos~(x*~x)`

But in my application it is common to want to create rather long vectorized operators starting from some complicated symbolic computations. Doing conversions by hand from symbolic expressions to element-wise operations is laborious and error prone.

As a very simple example consider that it is possible to obtain (almost) the same result as above by writing the following as a vectorized operation

`D(x->sin(x^2))~`

But there are at least two problems with this. First of all it is not nearly as efficient as the first operator and second, perhaps not unrelated, is that the datatype returned when applying this operator to a Vector/rtable of hardware floats (e.g. datatype=float[8]) becomes something  more general.

My question is how can I convert a complicated symbolic expression into an efficient numeric element-wise vector operation?

I have tried several different approaches but so far without success. In the case above for example it seemed natural to expect that the following derivative

`D(x->sin~(x^~2))`

would produce a vectorized result, but this is not the case. In another attempt I was unable to see how to perform substitions into an expression, e.g. like this

`unapply(subs(`*`=`*`~, cos=cos~, diff(sin(x),x)), x)`

I would be glad to receive suggestions and/or references to relevant documentation.

how to use foldr to generalize two maps into one m...

let aa = map (+1.2) [1,2]
let bb = map (+1.4) [2,3]
foldr (aa . bb) [3.0,4.0]

Apply '/' to a list of lists...

I have a long list of two element lists, for example,

A := [ [2,3], [4,5] ,[6,7]];

I want apply '/' to the elements of each sublist.

The result will be

R := [2/3, 4/5, 6/7];

I do not need the list, I could use vectors or matrices.

Is it possible to do this other than by iteration?

Tom Dean

Kernel of a map between two polynomial rings...

Assume we have a map f from a polynomial ring R to another polynomial ring S, I know how to compute kernel (a generator for the kernel ideal) of these maps by Singular, but I want to know can I do it with Maple too? Thanks.

An example;

Consider the homomorphism f:k[x,y]-->k[u,v] sending x to v and y to v^2 then using Singular;

ring r1=0,(x,y),lp;

ring r2=0,(u,v),lp;

ideal i=v,v2;

map f=r1,i;

setring r1;

kernel(r2,f);

_[1]=x2-y

So at above I took k a field of characteristic zero. The kernel is the ideal generated by x^2-y.