## how to use python to call maple and scroll up or d...

how to use python to call maple and scroll up or down scrollbar

I was trying to call a C shared library which calls a Python function. I got the following error:

/directory/of/my/library/libbe.so: libpython2.7.so.1.0: cannot open shared object

file: No such file or directory

Since I was running this using a pbs file, I made sure that I exported LD_LIBRARY_PATH (to libpython.so) inside the specific node. Does anyone have ideas on why this happens? Thank you!

## From Python into Maple...

how to translate python code which use scipy, numpy to maple code

```import numpy as np
from scipy.sparse.linalg import svds
from functools import partial

def emsvd(Y, k=None, tol=1E-3, maxiter=None):
"""
Approximate SVD on data with missing values via expectation-maximization

Inputs:
-----------
Y:          (nobs, ndim) data matrix, missing values denoted by NaN/Inf
k:          number of singular values/vectors to find (default: k=ndim)
tol:        convergence tolerance on change in trace norm
maxiter:    maximum number of EM steps to perform (default: no limit)

Returns:
-----------
Y_hat:      (nobs, ndim) reconstructed data matrix
mu_hat:     (ndim,) estimated column means for reconstructed data
U, s, Vt:   singular values and vectors (see np.linalg.svd and
scipy.sparse.linalg.svds for details)
"""

if k is None:
svdmethod = partial(np.linalg.svd, full_matrices=False)
else:
svdmethod = partial(svds, k=k)
if maxiter is None:
maxiter = np.inf

# initialize the missing values to their respective column means
mu_hat = np.nanmean(Y, axis=0, keepdims=1)
valid = np.isfinite(Y)
Y_hat = np.where(valid, Y, mu_hat)

halt = False
ii = 1
v_prev = 0

while not halt:

# SVD on filled-in data
U, s, Vt = svdmethod(Y_hat - mu_hat)

# impute missing values
Y_hat[~valid] = (U.dot(np.diag(s)).dot(Vt) + mu_hat)[~valid]

# update bias parameter
mu_hat = Y_hat.mean(axis=0, keepdims=1)

# test convergence using relative change in trace norm
v = s.sum()
if ii >= maxiter or ((v - v_prev) / v_prev) < tol:
halt = True
ii += 1
v_prev = v

return Y_hat, mu_hat, U, s, Vt```

## Converting Maple to Python...

hi,

having some issue using the codegeneration function in maple. I have a script written in Maple that I would like to do in Python 2.7. I knew to maple and not sure if my syntax is incorrect or if the program doesnt support the conversion, as an example,

thanks

## Bug in CodeGeneration package for Python

by: Maple

There seems to be a bug in the CodeGeneration package for Python which leads to a deletion of braces in some cases.

# E.g.

CodeGeneration[Python](Pi*(a+2));

cg5 = math.pi * a + 2

which is obviously wrong.

## External creation of a function...

I would like to know if it is possible in an external program (C or Python) to create a Maple function ( Not a one liner, maybe a number of lines of Maple code ). Then call Maple to execute a separate Maple function and get the result back.

## call python in maple...

how can i call python code in maple like external call for C++/Java/C#...

i have a text parser written in python and want to use it

can someone help me?

I am looking to use MapleSim in my MSEE Thesis project. I need to capture input from a hardware system, then use that data to drive a model in MapleSim, using MapleSim as a 3D kinematic model.

I have been using Python for most of my work so far, so that would be a preferred language, but I am also comfortable with C++, it just takes longer.

I am brand new to MapleSim (I have not even received it yet), so if there are some documents you could point me to, then that would be just great!