Skip to content
Back to formatted view

Raw Message

Message-ID: <CAHLp6SDKVT3StPA_7Lt-0hROg6i0yW_CFrpqMDTmd9iDiX4jSg@mail.gmail.com>
Date: 2017-09-19T09:37:33Z
From: Vivek Sutradhara
Subject: symbolic computing example with Ryacas

Hi all,
I am trying to implement the following matlab code with Ryacas :

syms U x x0 C

d1=diff(U/(1+exp(-(x-x0)/C)),x);

pretty(d1)

d2=diff(U/(1+exp(-(x-x0)/C)),x,2);

pretty(d2)

solx2 = solve(d2 == 0, x, 'Real', true)

pretty(solx2)

slope2=subs(d1,solx2)


I have tried the following :

library(Ryacas)

x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")

my_func <- function(x,U,x0,C) {

  return (U/(1+exp(-(x-x0)/C)))}

FirstDeriv <- deriv(my_func(x,U,x0,C), x)

PrettyForm(FirstDeriv)

slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")

PrettyForm(slope)


I don't understand how I should use the Subst command. I want the slope of
the first derivative at x=x0. How do I implement that?

I would appreciate any help that I can get.

Thanks,

Vivek

	[[alternative HTML version deleted]]