Ask Your Question

sononicola's profile - activity

2021-07-12 20:03:45 +0200 received badge  Popular Question (source)
2020-04-08 18:55:06 +0200 received badge  Nice Question (source)
2020-04-06 09:26:03 +0200 commented question How to solve an ODE giving ics as y'(x1) and not y'(x0) ?

No-one can help?

2020-04-03 10:47:50 +0200 received badge  Student (source)
2020-04-03 10:14:12 +0200 received badge  Editor (source)
2020-04-03 10:12:32 +0200 asked a question How to solve an ODE giving ics as y'(x1) and not y'(x0) ?

I'm tryng to solve this ODE that was made in mathematica: htt ps://i.imgur.com/9iyAcBW.jpg

As ICS we have u(0)=0 and e a(L) u'(L)=P

but in sage documentation i don't see anything to defining a point for u' different from x0 but only ics=[x0,y(x0),y'(x0)] or x0,y0,x1,y1

how to do that? this is my code ritgh now:

e,a,p,L,a1,a2,r1,r2=var('e,a,p,L,a1,a2,r1,r2')
u=function('u')(x)
a1=pi()*r1**2
a2=pi()*r2**2
area(x)=a1+(a2-a1)*x/L
sol=desolve(e*diff(area,x)*diff(u,x)+e*area*diff(u,x,2)==0,u,ivar=x,ics=[0,0,e*area(L)*diff(u,x)(L),p])
2020-02-09 08:12:11 +0200 commented answer siunitx comand \SI{number}{units} with sagetex

Thankyou so much. This works perfectly

2020-02-07 07:27:50 +0200 commented answer Spanish numbers using LaTeX

Sorry I read this only now. I didn't receveid any notification. Thanks for your help. I have post a question right now @dsejas

2020-02-07 07:26:49 +0200 asked a question siunitx comand \SI{number}{units} with sagetex

I'm trying to create something more like the command \SI{number}{units} of siunitx package but I have some trouble. Reading the PythonTex documentation this problem doesn't exist.

Starting with the answer /#49745

\begin{sagesilent}
def SIsage(number,units=0):
    if units==0: 
        if number in ZZ or number.parent()==QQ:
            return r"\SI{"+ str(number) + "}"
        else:
            return r"\SI{"+ str(float(number)) + "}"
    else:
        if number in ZZ or number.parent()==QQ:
            return r"\SI{"+ str(number) + "}" +"{"+ units + "}"
        else:
            return r"\SI{"+ str(float(number)) + "}" +"{"+ units + "}"
\end{sagesilent}
\sagestr{SIsage(2442,"\kilo\metre\squared")}
\sagestr{SIsage(2442)}

and it works except when using \newton witch it become "ewton" problably cause to \n

After this I want to create a new custom LaTeX command that replace \SI{}{} but I have some trouble with non-default arguments. I didn't understand how them work. I want be able to use both of \SI{number}{units} that \SI{number} without units. Probably the best choise is to create two different commands(?)

\newcommand{\SIsage_units}[1]{,"#1"}
\newcommand{\SIsage_number}[1]{\sagestr{SIsage(#1}}
\newcommand{\SISAGE}[2]{\SIsage_number{#2}\SIsage_units{#1})} #doesn't work

The command I want:

\SISAGE{21}{\kilo\metre\squared}
 \SISAGE{26}{}

So my problems are:

  1. how to avoid \n
  2. how to set an unic custom command \SISAGE

Thanks everybody

2020-02-02 12:51:52 +0200 answered a question Spanish numbers using LaTeX

I'm trying to create something more like the command \SI{number}{units} of siunitx package but I have some trouble.

Starting with the answer of @Juanjo I'm arrived here:

\begin{sagesilent}
def SIsage(number,units=0):
    if units==0: 
        if number in ZZ or number.parent()==QQ:
            return r"\SI{"+ str(number) + "}"
        else:
            return r"\SI{"+ str(float(number)) + "}"
    else:
        if number in ZZ or number.parent()==QQ:
            return r"\SI{"+ str(number) + "}" +"{"+ units + "}"
        else:
            return r"\SI{"+ str(float(number)) + "}" +"{"+ units + "}"
\end{sagesilent}
\sagestr{SIsage(2442,"\kilo\metre\squared")}
\sagestr{SIsage(2442)}

and it works except when using \newton witch it become "ewton" problably cause to \n

After this I want to create a new custom LaTeX command that replace \SI{}{} but I have some trouble with non-default arguments. I didn't understand how them work. I want be able to use both of \SI{number}{units} that \SI{number} without units. Probably the best choise is to create two different commands(?)

\newcommand{\SIsage_units}[1]{,"#1"}
\newcommand{\SIsage_number}[1]{\sagestr{SIsage(#1}}
\newcommand{\SISAGE}[2]{\SIsage_number{#2}\SIsage_units{#1})} #doesn't work

The command I want:

\SISAGE{21}{\kilo\metre\squared}
 \SISAGE{26}{}

So my problems are:

  1. how to avoid \n
  2. how to set an unic custom command \SISAGE

Thanks everybody